MySQL Forums
Forum List  »  Newbie

Re: adding new slave to master slave replication
Posted by: Mike Thompson
Date: January 08, 2024 04:04AM

Hello,

Your approach to adding a new slave to your existing master-slave replication setup in MySQL seems mostly correct, but there are a few additional steps and considerations to ensure a smooth process. Here's a revised list of steps based on what you've described:

Ensure Binary Logging is Enabled on the Source Slave: Before starting, make sure that binary logging is enabled on the slave from which you're taking the backup. This is crucial for point-in-time recovery and for chaining the replication.

Export Databases from the Existing Slave: Use mysqldump with the --single-transaction option to ensure a consistent backup if you're using InnoDB tables. For MyISAM, consider using --lock-all-tables instead.

Copy Required Files: Copying relay-log.info and master.info is a good start. However, you should also consider copying the binary logs if they are needed for the new slave to catch up with the replication chain.

Import MySQL Dump to the New Slave Server: After importing the dump, ensure that you also set the replication coordinates (file and position) correctly. These coordinates tell the new slave where to start replicating from. You can find these in the master.info file or at the end of the mysqldump output.

Edit relay-log.info File: Be careful with manually editing this file. It's usually safer to set the replication coordinates using the CHANGE MASTER TO command in MySQL.

Edit my.cnf File: Make sure to set the server-id to a unique value for the new slave. Also, configure other replication-related parameters as per your setup's requirements.

Start MySQL on the New Slave: Before starting the replication, execute the CHANGE MASTER TO command with the correct master log file and log position. After this, you can start the slave with START SLAVE;.

Verify Replication Status: Use SHOW SLAVE STATUS\G to verify that the replication is working correctly. Look for Slave_IO_Running and Slave_SQL_Running status, both should be 'Yes'.

Monitor for Any Errors: Keep an eye on the MySQL error logs for any issues that might arise during the initial stages of replication on the new slave.

Please ensure that you test this process in a staging environment before applying it to your production servers. Also, always have a rollback plan in case something goes unexpected.

Hope this helps! Let me know if you have any further questions.

Options: ReplyQuote


Subject
Written By
Posted
Re: adding new slave to master slave replication
January 08, 2024 04:04AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.