Wednesday, September 2, 2009

Enable mysql replication on production server

How to add slave mysql server without stopping master?

Bin-logging must be enabled on master. Then just dump all data from master:
mysqldump  --defaults-file=/etc/mysql/debian.cnf -BA --master-data | gzip > /pathtogzipfile/filename
This command dump all data from master and store master "binlog filename" and log position.

Copy gzipped dump to slave. Ungzip and apply (mysql < yourfile.sql). Execute "slave start;" (slave must be configured for replication before this step :)

1 comment: