3

We have an existing master-slave MySQL replication setup where we would like to promote the second slave to a master in order to achieve a master-master setup with no or only minimal downtime.

Is it sufficient to do a SHOW MASTER STATUS on the slave and do a CHANGE MASTER TO ... on the current master or will this result in a replication error?

4

On a basic level, yes. Just set up the current Master like you would any normal slave database.

However, there are some things to consider first.

Is the second slave set to READ-ONLY, as you want to avoid writing to both masters at once.

You probably want to set auto_increment_increment=2 and auto_increment_offset=1 on the first master, and auto_increment_increment=2 and auto_increment_offset=2 on the second master.

This prevents the two masters from creating the same auto_increment primary keys.

You also want to make sure you have no replication filters (binlog-do-db, replicate-do-db etc) set up as they can cause problems too).

  • Also log_slave_updates and log_bin. – Rick James Apr 9 '16 at 0:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.