* correct use extra files between set slave and set master-to-master replication

This commit is contained in:
2020-10-17 00:24:02 +03:00
parent 0f0f3dcd7f
commit 014d14beaa
2 changed files with 7 additions and 7 deletions

View File

@ -7,8 +7,8 @@ set -a
set +a
# Установка локально и удаленно MASTER-параметров
echo "Get master status from remote server" >> $log_file
local_master_status=`mysql --defaults-extra-file=./.remote.my.cnf -e "SHOW MASTER STATUS;
echo "Get master status from local server" >> $log_file
local_master_status=`mysql --defaults-extra-file=./.my.cnf -e "SHOW MASTER STATUS;
" -N`
local_master_log_file=`echo $local_master_status | cut -d' ' -f1`
@ -16,8 +16,8 @@ local_master_log_pos=`echo $local_master_status | cut -d' ' -f2`
echo "Apply bin log position to remote mariadb db instance" >> $log_file
replication_user=`cat ./.remote.my.cnf | grep user | cut -d'=' -f2`
replication_password=`cat ./.remote.my.cnf | grep password | cut -d'=' -f2`
replication_user=`cat ./.my.cnf | grep user | cut -d'=' -f2`
replication_password=`cat ./.my.cnf | grep password | cut -d'=' -f2`
replication_host=$localdatabasepublicip
mysql --defaults-extra-file=./.remote.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;"

View File

@ -16,8 +16,8 @@ remote_master_log_pos=`echo $remote_master_status | cut -d' ' -f2`
echo "Apply bin log position to local mariadb db instance" >> $log_file
replication_user=`cat ./.my.cnf | grep user | cut -d'=' -f2`
replication_password=`cat ./.my.cnf | grep password | cut -d'=' -f2`
replication_host=`cat ./.my.cnf | grep host | cut -d'=' -f2`
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`
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;"