From 96c811950fc5b8b932a7ecbc6598dcc81aa1576a Mon Sep 17 00:00:00 2001 From: Alexander Demidov Date: Wed, 27 Jan 2021 18:05:08 +0000 Subject: [PATCH] + port to remote config --- .remote.my.cnf-example | 1 + _activate-slave.sh | 3 ++- start-replication.sh | 4 +--- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.remote.my.cnf-example b/.remote.my.cnf-example index 1298f2c..6743ea1 100644 --- a/.remote.my.cnf-example +++ b/.remote.my.cnf-example @@ -2,3 +2,4 @@ user=replicationuser password=replicationpassword host=remotehostip +port=3306 diff --git a/_activate-slave.sh b/_activate-slave.sh index 58be2bb..587e4ad 100755 --- a/_activate-slave.sh +++ b/_activate-slave.sh @@ -19,5 +19,6 @@ echo "Apply bin log position to local 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_host=`cat ./.remote.my.cnf | grep host | cut -d'=' -f2` +replication_port=`cat ./.remote.my.cnf | grep port | 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;" +mysql --defaults-extra-file=./.my.cnf -e "CHANGE MASTER TO MASTER_HOST = '$replication_host', MASTER_PORT = $replication_port, MASTER_USER = '$replication_user', MASTER_PASSWORD = '$replication_password', MASTER_LOG_FILE = '$remote_master_log_file', MASTER_LOG_POS = $remote_master_log_pos;" diff --git a/start-replication.sh b/start-replication.sh index a1d5476..2c91ac3 100755 --- a/start-replication.sh +++ b/start-replication.sh @@ -19,9 +19,7 @@ do REMOTE_SQL=$REMOTE_SQL' USE '$i'; FLUSH TABLES WITH READ LOCK;' done -REMOTE_SQL=$REMOTE_SQL' system ./_activate-slave.sh;' - -REMOTE_SQL=$REMOTE_SQL' system ./_dump.sh;' +REMOTE_SQL=$REMOTE_SQL' system ./_activate-slave.sh; system ./_dump.sh;' for i in ${databases[@]} do