You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-12-20 01:42:27 +03:00
MariaDB Enterprise won't accept our canned replication passed. This patch updates it to a stronger one it will accept.
100 lines
2.7 KiB
Bash
100 lines
2.7 KiB
Bash
#!/bin/bash
|
|
#
|
|
# $Id$
|
|
#
|
|
# generic MariaDB Columnstore Master Replication script.
|
|
#
|
|
# Notes: This script gets run by ProcMon during installs and upgrades:
|
|
|
|
# check log for error
|
|
checkForError() {
|
|
grep ERROR ${tmpdir}/master-rep-status-$hostipaddr.log > ${tmpdir}/error.check
|
|
if [ `cat ${tmpdir}/error.check | wc -c` -ne 0 ]; then
|
|
echo "ERROR: check log file: ${tmpdir}/master-rep-status-$hostipaddr.log"
|
|
rm -f ${tmpdir}/error.check
|
|
exit 1
|
|
fi
|
|
rm -f ${tmpdir}/error.check
|
|
}
|
|
|
|
pwprompt=
|
|
for arg in "$@"; do
|
|
if [ `expr -- "$arg" : '--hostIP='` -eq 9 ]; then
|
|
hostipaddr="`echo $arg | awk -F= '{print $2}'`"
|
|
elif [ $(expr -- "$arg" : '--tmpdir=') -eq 9 ]; then
|
|
tmpdir="$(echo $arg | awk -F= '{print $2}')"
|
|
fi
|
|
done
|
|
|
|
. @ENGINE_SUPPORTDIR@/columnstore_functions
|
|
|
|
repUser="idbrep"
|
|
password="C0lumnStore!"
|
|
|
|
>${tmpdir}/master-rep-status-$hostipaddr.log
|
|
|
|
#
|
|
# Create Replication User
|
|
#
|
|
echo "Create Replication User $repUser for node $hostipaddr" >>${tmpdir}/master-rep-status-$hostipaddr.log
|
|
cat >${tmpdir}/idb_master-rep.sql <<EOD
|
|
CREATE USER IF NOT EXISTS '$repUser'@'$hostipaddr' IDENTIFIED BY '$password';
|
|
GRANT REPLICATION SLAVE ON *.* TO '$repUser'@'$hostipaddr';
|
|
EOD
|
|
|
|
cat ${tmpdir}/idb_master-rep.sql >>${tmpdir}/master-rep-status-$hostipaddr.log
|
|
mysql \
|
|
--user=root \
|
|
calpontsys <${tmpdir}/idb_master-rep.sql >>${tmpdir}/master-rep-status-$hostipaddr.log 2>&1
|
|
|
|
checkForError
|
|
|
|
#
|
|
# Grant table access for created user
|
|
#
|
|
echo "Grant table access for $repUser for node $hostipaddr" >>${tmpdir}/master-rep-status-$hostipaddr.log
|
|
cat >${tmpdir}/idb_master-rep.sql <<EOD
|
|
use mysql
|
|
grant all on *.* to '$repUser'@'$hostipaddr' identified by 'C0lumnStore!';
|
|
grant REPLICATION SLAVE on *.* to '$repUser'@'$hostipaddr' identified by 'C0lumnStore!';
|
|
EOD
|
|
|
|
cat ${tmpdir}/idb_master-rep.sql >>${tmpdir}/master-rep-status-$hostipaddr.log
|
|
mysql \
|
|
--user=root \
|
|
calpontsys <${tmpdir}/idb_master-rep.sql >>${tmpdir}/master-rep-status-$hostipaddr.log 2>&1
|
|
|
|
checkForError
|
|
|
|
#
|
|
# Run SHOW MASTER STATUS
|
|
#
|
|
echo "Run SHOW MASTER STATUS to node log" >>${tmpdir}/master-rep-status-$hostipaddr.log
|
|
cat >${tmpdir}/idb_master-rep.sql <<EOD
|
|
SHOW MASTER STATUS
|
|
EOD
|
|
|
|
cat ${tmpdir}/idb_master-rep.sql >>${tmpdir}/master-rep-status-$hostipaddr.log
|
|
mysql \
|
|
--user=root \
|
|
calpontsys <${tmpdir}/idb_master-rep.sql >>${tmpdir}/master-rep-status-$hostipaddr.log 2>&1
|
|
|
|
checkForError
|
|
|
|
echo "Run SHOW MASTER STATUS to master status log ${tmpdir}/show-master-status.log" >>${tmpdir}/master-rep-status-$hostipaddr.log
|
|
cat >${tmpdir}/idb_master-rep.sql <<EOD
|
|
SHOW MASTER STATUS
|
|
EOD
|
|
|
|
cat ${tmpdir}/idb_master-rep.sql >${tmpdir}/show-master-status.log
|
|
mysql \
|
|
--user=root \
|
|
calpontsys <${tmpdir}/idb_master-rep.sql >>${tmpdir}/show-master-status.log
|
|
|
|
|
|
#alls good, 'OK' for success
|
|
echo "OK"
|
|
exit 0
|
|
|
|
|