Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am in the process of adding a new slave to a replicated MySQL setup. I'm proposing the following process:

  1. clone one of the nodes to a new VM
  2. start it with no networking
  3. stop mysql
  4. change the server-id in my.cnf to a new id
  5. restart mysql and networking

Should this work correctly? Or will MySQL get confused because it used to be a different server id?

OS: Ubuntu 10.10

VM Platform: VMWare 5

MySQL : Server version: 5.1.49-1ubuntu8.1-log (Ubuntu)

share|improve this question

migrated from Sep 28 '12 at 20:54

This question came from our site for professional and enthusiast programmers.

Operating system? VM platform? – tomfanning Sep 28 '12 at 16:14
Info added (mysql version too) – Ben Holness Sep 28 '12 at 16:28
Yes you will have a problem because of the bin logs – topdog Sep 28 '12 at 20:58
Have you tried what you proposed in your question? – smcg Sep 28 '12 at 21:31
I just tried it, but it gave me lots of table crashed errors, so I aborted and I am just copying the slave as per… – Ben Holness Sep 28 '12 at 22:21

I am unfamiliar with VMWare, but I am familiar with doing this process across arbitrary logical volumes. First, you have to clone the VM in such a way that your VM snapshot copies the server in a consistent state (like an LV Snap). You also need to be able to grab the slave's current replication coordinates as you begin your copy. Because of this, the following mechanism would be required:

  2. SHOW SLAVE STATUS a. Retrieve Exec_Master_Log_Pos and Relay_Master_Log_File from this output, these are your coordinates to use when setting up replication on the new slave
  3. -- Begin creating snapshot

Once this is done and the new server has been built from image, you will need to execute a CHANGE master statement on the slave to update these binlog coordinates:

CHANGE MASTER TO MASTER_LOG_FILE="${Relay_Master_Log_File from 2a}", MASTER_LOG_POS=${Exec_Master_Log_Pos from 2a};

This method would work with an LV snaphsot for exmaple. Some tools such as hollandbackup support this style of LVM copy:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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