Commit c7f0d9a6 authored by Vitaly Lipatov's avatar Vitaly Lipatov

update mysql repl script

parent 0af35eb5
......@@ -29,14 +29,23 @@ if [ "$1" = "--status" ] ; then
exit
fi
if [ "$" != "--force" ] ; then
echo "Call LAV before run this script. 28.11.2015"
exit
fi
mysqldump --routines -h mysql.auth -p$PASSWD mail >mail-dump.sql
mycommand "stop slave"
mycommand "reset slave"
myrcommand "show master status\G"
#mycommand "show slave status\G"
POSITION=$(myrcommand "show master status\G" | grep "Position:" | sed -e "s|.*Position: ||g")
MASTERFILE=/var/lib/mysql/db/$(myrcommand "show master status\G" | grep "File:" | sed -e "s|.*File: ||g")
# file name only
MASTERFILE=$(myrcommand "show master status\G" | grep "File:" | sed -e "s|.*File: ||g")
mysql mail -p$PASSWD <mail-dump.sql
#mycommand "CHANGE MASTER TO MASTER_LOG_FILE='$MASTERFILE', MASTER_LOG_POS=$POSITION"
mycommand "CHANGE MASTER TO MASTER_LOG_POS=$POSITION"
#mycommand "CHANGE MASTER TO MASTER_LOG_POS=$POSITION"
# TODO: use special user for replication
mycommand "CHANGE MASTER TO MASTER_HOST='mysql.auth', MASTER_PORT=3306, MASTER_USER='root', MASTER_PASSWORD='$PASSWD', MASTER_LOG_FILE='$MASTERFILE', MASTER_LOG_POS=$POSITION"
mycommand "start slave"
mycommand "show slave status\G"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment