A new slave can be added to an existing replication without stopping the master. Setup the new slave by making a copy of existing slave. Dont forget to change the server-id value .
To copy an existing slave :
Stop the slave : >mysqladmin shutdown
Copy the data directory from existing slave to new slave. Using rsync..
3.In order to avoid error message like the one below, use same –relay-log on the new slave as the one used in the existing slave.
Neither –relay-log nor –relay-log-index were used; so
replication may break when this MySQL server acts as a slave and has his hostname
changed!! Please use ‘–relay-log=new_slave_hostname-relay-bin’ to avoid this problem.
As an alsternative step 4 and 5 will avoid the above warning.
Issue stop slave on the new slave
Copy contents of existing slave’s relay log index file into the new slaves relay log index file overwriting existing.
Copy the master.info and relay-log.info files from the existing slave to the new slave.
Start the existing slave
8.On the new slave make sure you have unique value for server-id.
- Start new slave. The slave will use information in master.info to start replication process.