Reputation: 11
We have MySQL server and its replication running on another machine. Both Master and slave is running on MySQL 5.6, and now the plan is to update the IP of both master and slave machines. We have planned to use the below query in replication.
STOP SLAVE ;
CHANGE MASTER TO MASTER_HOST = '1.2.3.4', MASTER_LOG_FILE = 'abc.123', MASTER_LOG_POS = '1234';
START SLAVE;
Can someone confirm whether the above method is actually correct and has enough information required incase of master host ip update for replication.
Thanks in advance.
Upvotes: 0
Views: 1026
Reputation: 562408
That looks like a reasonable approach, but there are a lot of details about your environment that I cannot know, so I don't know if the steps you show are all you will need to do.
Before changing the replication configuration, I would run the mysql client on the replica machine, to connect to the master using the new IP address.
Example:
$ mysql -h 1.2.3.4 -u <repluser> -p'<replpassword>'
Use the repluser and replpassword you use for the replica to connect to the master.
That will test that the replica machine can connect (i.e. there is a working network route, no firewalls blocking, the user & password are correct, etc.).
Then in the mysql client shell, verify that the repluser has the REPLICATION SLAVE privilege, and verify that the master's binary log coordinate is what you expect.
mysql> show grants;
mysql> show master;
Upvotes: 0