Browse Source

master-to-master options with todo

master
dimti 4 years ago
parent
commit
9c90b37e48
  1. 17
      readbinlog.sh

17
readbinlog.sh

@ -6,6 +6,10 @@ set -a
. "${CONFIG_FILE}"
set +a
replication_user=`cat ./.remote.my.cnf | grep user | cut -d'=' -f2`
replication_password=`cat ./.remote.my.cnf | grep password | cut -d'=' -f2`
replication_host=`cat ./.remote.my.cnf | grep host | cut -d'=' -f2`
# Установка локально и удаленно MASTER-параметров
echo "Get master status from remote server" >> $log_file
remote_master_status=`mysql --defaults-extra-file=./.remote.my.cnf -e "SHOW MASTER STATUS;" -N`
@ -14,9 +18,14 @@ remote_master_log_file=`echo $remote_master_status | cut -d' ' -f1`
remote_master_log_pos=`echo $remote_master_status | cut -d' ' -f2`
echo "Apply bin log position to local mariadb db instance" >> $log_file
mysql --defaults-extra-file=./.my.cnf -e "CHANGE MASTER TO MASTER_HOST = '$replication_host', MASTER_USER = '$replication_user', MASTER_PASSWORD = '$replication_password', MASTER_LOG_FILE = '$remote_master_log_file', MASTER_LOG_POS = $remote_master_log_pos;"
replication_user=`cat ./.remote.my.cnf | grep user | cut -d'=' -f2`
replication_password=`cat ./.remote.my.cnf | grep password | cut -d'=' -f2`
replication_host=`cat ./.remote.my.cnf | grep host | cut -d'=' -f2`
#echo "Get master status from local server" >> $log_file
#local_master_status=`mysql --defaults-extra-file=./.my.cnf -e "SHOW MASTER STATUS;" -N`
mysql --defaults-extra-file=./.my.cnf -e "CHANGE MASTER TO MASTER_HOST = '$replication_host', MASTER_USER = '$replication_user', MASTER_PASSWORD = '$replication_password', MASTER_LOG_FILE = '$remote_master_log_file', MASTER_LOG_POS = $remote_master_log_pos;"
#local_master_log_file=`echo $local_master_status | cut -d' ' -f1`
#local_master_log_pos=`echo $local_master_status | cut -d' ' -f2`
#echo "Apply bin log position to remote mariadb db instance" >> $log_file
#TODO: $local_host replace to option --master-to-master=self_ip_address
#mysql --defaults-extra-file=./.remote.my.cnf -e "CHANGE MASTER TO MASTER_HOST = '$local_host', MASTER_USER = 'replication_user', MASTER_PASSWORD = 'replication_password', MASTER_LOG_FILE = '$local_master_log_file', MASTER_LOG_POS = $local_master_log_pos;"
Loading…
Cancel
Save