- 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.