Migrate mysql with minimal downtime
- Login to existing mysql server.
- Change the configuration
/etc/my.cnf, add the following
- To make sure your configuration is correct, run
- For the mysql process to pick up these, you need to run
sudo service mysql restart and verify with
- Take a consistent snapshot of mysql. Keep a note of these values --
- Start a new server with this volume (from snapshot).
- Restart mysql
- On cli,
CHANGE MASTER TO
MASTER_LOG_FILE='<value of master_log_file>',
MASTER_LOG_POS= <value of master_log_pos>;
show slave status will show the lag between master and slave. Make sure they're in sync.
- Point your application to slave.
- Once writes are coming to slave, and master is idle
On slave cli:
stop slave; reset slave;
- Terminate your master. New slave is now a standalone mysql server.
Subscribe to our newsletter
Get the latest posts delivered right to your inbox.
No results for your search, please try with something else.
Great! You've successfully subscribed.
Great! Next, complete checkout for full access.
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.