Initial commit

This commit is contained in:
2020-04-29 01:29:07 +03:00
commit 3a1f5905d2
7 changed files with 74 additions and 0 deletions

27
start-replication.sh Normal file
View File

@ -0,0 +1,27 @@
#!/bin/bash
export DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
CONFIG_FILE=$DIR/_config.sh
[[ ! -r "${CONFIG_FILE}" ]] && { echo "Could not read ${CONFIG_FILE}!"; exit 1; }
set -a
. "${CONFIG_FILE}"
set +a
for i in ${databases[@]}
do
REMOTE_SQL=$REMOTE_SQL' USE '$i'; FLUSH TABLES WITH READ LOCK;'
done
REMOTE_SQL=$REMOTE_SQL' system ./readbinlog.sh;'
REMOTE_SQL=$REMOTE_SQL' system ./dump.sh;'
for i in ${databases[@]}
do
REMOTE_SQL=$REMOTE_SQL' USE '$i'; UNLOCK TABLES;'
done
echo "Start execution all commands on remote server" > $log_file
mysql --defaults-extra-file=./.remote.my.cnf -e "$REMOTE_SQL"
mysql --defaults-extra-file=./.my.cnf -e "START SLAVE;"