My (SQL) WorkLog: MySQL - Syncing slave with the master

Sunday, June 21, 2009

MySQL - Syncing slave with the master

Manual procedure of syncing slave with he master

Below commands to be run on Slave

1. Check the slave status and Stop the slave its is running


mysql> show slave status\G

mysql> stop slave;

2. Get the dump of master server


shell> time mysqldump --opt -master_server_ip --master-data=1 --triggers --routines --databases DB1 DB2 DB3 DBn | gzip > /path/to/dumpfile.gz


3. Once the above dump is over, you can start importing


shell> time gunzip –c /path/to/dumpfile.gz | mysql





Once the above import is done, start slave on slave server<!--[endif]-->




mysql> show slave status\G

mysql> start slave;


In production environment you can do this kind of sync activity by taking a maitenance window/down time during the dump process(mysqldump command)




No comments:

Post a Comment