Database Replication (Optional)
185
# mysql -u root
mysql> show master status;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000001 | 412 | | |
+------------------+----------+--------------+------------------+
8. Note the file and the position that are returned by your instance.
9. Exit from this session.
10. Complete the master setup. Returning to your first session on the master, release the locks and
exit MySQL.
mysql> unlock tables;
11. Install and configure the slave. On the slave server, run the following commands.
# yum install mysql-server
# chkconfig mysqld on
12. Edit my.cnf and add the following lines in the [mysqld] section below datadir.
server_id=2
innodb_rollback_on_timeout=1
innodb_lock_wait_timeout=600
13. Restart MySQL.
# service mysqld restart
14. Instruct the slave to connect to and replicate from the master. Replace the IP address, password,
log file, and position with the values you have used in the previous steps.
mysql> change master to
-> master_host='172.16.1.217',
-> master_user='cloud-repl',
-> master_password='password',
-> master_log_file='mysql-bin.000001',
-> master_log_pos=412;
15. Then start replication on the slave.
mysql> start slave;
16. Optionally, open port 3306 on the slave as was done on the master earlier.
This is not required for replication to work. But if you choose not to do this, you will need to do it
when failover to the replica occurs.