The recent reboot requirements at Amazon AWS have brought up the topic of automated restarts of MySQL database servers. I’d like to offer a safe solution for scripting the procedure. Let’s pretend that we’ve already confirmed there’s no production traffic. Here are the basic commands:
Stopping MySQL Server
Stop replication
mysqladmin -u root -p stop-slave
Make sure all in-memory stuff is saved to disk.
mysqladmin -u root -p flush-tables
Bring down the mysqld server
mysqladmin -u root -p shutdown
Starting MySQL Server
If mysqld isn’t started automatically when your host is booted, your distribution may have it’s own start script. However, you could always do the generic start:
nohup mysqld_safe &
Next, restart replication
mysqladmin -u root -p stop-slave
Tweet




Discussion
No comments for “Scripting MySQL replicated slave restarts”