|
@ -35,32 +35,7 @@ echo "Start local slave" >> $log_file |
|
|
mysql --defaults-extra-file=./.my.cnf -e "START SLAVE;" |
|
|
mysql --defaults-extra-file=./.my.cnf -e "START SLAVE;" |
|
|
|
|
|
|
|
|
if [[ "$1" = "master-to-master" ]]; then |
|
|
if [[ "$1" = "master-to-master" ]]; then |
|
|
echo "Started activation of master-to-master replication" >> $log_file |
|
|
|
|
|
|
|
|
|
|
|
echo "Stop remote slave" >> $log_file |
|
|
|
|
|
mysql --defaults-extra-file=./.remote.my.cnf -e "STOP SLAVE;" |
|
|
|
|
|
|
|
|
|
|
|
echo "Execute command on local server with push local binlog position to remote server" >> $log_file |
|
|
|
|
|
|
|
|
|
|
|
LOCAL_SQL= |
|
|
|
|
|
|
|
|
|
|
|
for i in ${databases[@]} |
|
|
|
|
|
do |
|
|
|
|
|
LOCAL_SQL=LOCAL_SQL' USE '$i'; FLUSH TABLES WITH READ LOCK;' |
|
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
LOCAL_SQL=LOCAL_SQL' system ./_activate-master-to-master.sh;' |
|
|
|
|
|
|
|
|
|
|
|
for i in ${databases[@]} |
|
|
|
|
|
do |
|
|
|
|
|
LOCAL_SQL=LOCAL_SQL' USE '$i'; UNLOCK TABLES;' |
|
|
|
|
|
done |
|
|
|
|
|
|
|
|
|
|
|
mysql --defaults-extra-file=./.my.cnf -e "$REMOTE_SQL" |
|
|
|
|
|
|
|
|
|
|
|
echo "Start remote slave" >> $log_file |
|
|
|
|
|
|
|
|
|
|
|
mysql --defaults-extra-file=./.remote.my.cnf -e "START SLAVE;" |
|
|
|
|
|
|
|
|
./replication-master-to-master.sh; |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|