I am on Linux platform with MySQL 5.7. I have 3 MySQL Slaves and 1 MySQL Master and replication is working perfectly. I want to do experiments such that in my first experiment, Master only replicate data to 1 slave, in second experiment, Master replicate data to 2 slaves and in third experiment, Master replicate data to all slaves that is 3 slaves. Is there any particular option in MySQL to do so? What is the best way to go about limiting the MySQL Master slave replication to 1, 2 and 3 slaves respectively? Pointers will be very welcome.
Asked
Active
Viewed 122 times
1 Answers
0
You should be able to achieve this using the commands STOP SLAVE
and START SLAVE
.
Experiment 1 : Run STOP SLAVE
on two of the 3 slaves
Experiment 2 : Run START SLAVE
on one of the two you disabled
Experiment 3 : Run START SLAVE
on the other disabled slave
See this article for more information : https://dev.mysql.com/doc/refman/5.7/en/replication-administration-pausing.html

Mark Madej
- 1,752
- 1
- 14
- 19
-
Dear Mark Madej, Thanks a lot for your kind response. Yes, your answer helped me in my experiments. It worked. However, I have one query regrading the approach that you have mentioned. – Muhammad Karam Shehzad Mar 17 '17 at 11:13
-
For example, when the first experiment will be done then we will execute START SLAVE command on one of the slaves and will execute STOP SLAVE command on rest. As a result, only one slave will get the data from Master. Afterwards, in case of experiment 3, when START SLAVE command will be executed on remaining disabled slaves then remaining slaves will first try to pull all data of Master that was written on Master binary log in the first experiment. And then it will try to read the data of current experiment. Is not it? In this scenario, above approach wouldn't be helpful. – Muhammad Karam Shehzad Mar 17 '17 at 11:14