Question

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?

Était-ce utile?

La solution

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à dba.stackexchange
scroll top