In order to setup replication, we may configure the master host details in slave DB 'my.ini' file. Example of configuration is as below:
master-host=10.0.0.112However, after replication started, if you change the master host information in my.ini, it will not take effect after you restart the slave, not even you restart your MySQL.
master-port=3306
master-user=repl_user
master-password=password123
master-connect-retry=60
report-host=slaveHostName
This is because once MySQL replication started, it will generate a file 'master.info' in MySQL data folder. If this file was found when starting replication slave, replication will start based on 'master.info' and ignore the replication options configure in 'my.ini'.
So besides changing the 'my.ini', you should also issue a CHANGE MASTER TO command.
The steps are:
i) stop slave;
ii) CHANGE MASTER TO ...
iii) start slave.;
No comments:
Post a Comment