Mysql – Lost entire MySQL Server. Unsure if “master-slave” or “master-master” – How to tell

master-slave-replicationMySQLrecovery

Yup – my db02 server lost a disk, and the array itself is corrupt (RAID5, yet corrupt data.) I was able to get the OS back online, but the corruption is severe. I have zero documentation about the mysql configuration, other than a copy of the /etc/my.cnf file from the failed host. (one small joy in this.)

1) How would I determine if it was in a m-s or m-m configuration?

2) Since I am lucky enough to have the /etc/my.cnf file, is there a clean way of restoring from the master?

3) Anyone have any other ideas as to what I should look for, in order to make sure what else needs to be put back in place? Backups are managed via scripting, from yet another system.

Best Answer

For M-M, both need to be masters and both need to be slaves. Those need

log_slave_updates
log_bin

These should show something, even if not actively replicating at the moment:

SHOW SLAVE STATUS;
SHOW MASTER STATUS;

If you can't run things on the broken machine, then I suggest you do

  • Clone the good machine's disk to the bad
  • Change my.cnf to have a different server_id
  • Turn on the two flags above
  • CHANGE MASTER ... on both -- to establish being a Slave, and provide the pwd for the replication 'user'.

Now you will have Master-Master. (There is not a lot of differences between M-S and M-M, so you may as well go for M-M.)