I am in the process of adding a new slave to a replicated MySQL setup. I'm proposing the following process:
- clone one of the nodes to a new VM
- start it with no networking
- stop mysql
- change the server-id in my.cnf to a new id
- 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)
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:
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: http://wiki.hollandbackup.org/mysqllvm