Mysql – Two slaves using the same server-id

MySQLreplication

I have a MySQL master with two slaves. Due to poor configuration both slaves had the same server-id.

My questions are:

  1. Is the slaves' data fully synced with the master or did they miss transactions and I should start a new replication ?
  2. During the past 4 days the master server was getting stuck randomly (3 times) with no apparent reason – is this the cause? if so, why would it get stuck? (By stuck I mean that it was running, no errors in the log, but not accepting connections)
  3. The slaves have been busy for 3 days with a big ALTER that the master long finished, does this have anything to do with it?

Best Answer

The server ID is used for replication to enable master and slave servers to identify themselves, uniquely. While replication may work if two slaves have the same server ID, it could affect performance. Also, having them all unique can provide help in managing and monitoring the MySQL servers participating in the replication. Currently, a MySQL master server allows slaves with the same server-ID. This is a known problem, and could cause slaves to make several smaller relay logs files. Closing and opening files as a result will consequently slow down the replication process.