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 :)

3 comments:

  1. Thanks, you saved my day!

    ReplyDelete
  2. Today, I was just browsing along and came upon your blog. Just wanted to say good blog and this article helped me a lot, due to which I have found exactly I was looking. erklärvideo agentur

    ReplyDelete
  3. Enjoyed every single word of your blog article. Thanks to share it!

    ReplyDelete