The proper way to stop a slave server is to first issue "STOP SLAVE" and then shutdown the server. Here's how you can shutdown slave on multiple MySQL hosts.
cat /lists/dbs | while read i ; do echo $i; /path/to/mysql -h $i -e "STOP SLAVE"; done
Here's another way (thanks Toby for the alternative one liner to run a command against multiple hosts):
xargs -n 1 mysql -e "STOP SLAVE" -h < /lists/dbs
Stopping the slave first will ensure that the replication thread is stopped before the server goes down.
1 comment:
Sheeri,
That is a very good question. It can be of great benefit to many people if it is in the MySQL startup and shutdown script.
Frank
Post a Comment