Step by Step MySQL Replication
Here’s a quick checklist on how to setup replication.
http://docs.hp.com/en/5991-7432/ar01s05.html gives more information.
First on the master server’s my.cnf or my.ini file comment out these lines:
#skip-networking
#bind-address = 127.0.0.1
Then in the [mysqld] section add:
log-bin=mysql-bin
server-id=1
Then restart MySQL with
/etc/init.d/mysql restart
Now create a user on the master that the slave can use to connect:
GRANT REPLICATION SLAVE ON *.* TO ‘slave_user’@'%’ IDENTIFIED BY ‘<SOME PASSWORD>’;
GRANT REPLICATION CLIENT ON *.* TO ‘slave_user’@'%’;
Then get the master status with:
FLUSH PRIVILEGES;
USE exampledb;
FLUSH TABLES WITH READ LOCK;
SHOW MASTER STATUS;
Make a note of log file name and position – you’ll need it later. Then backup the master database and restore to the slave or copy it using SQLYog.
Then add to the slave’s my.cnf or my.ini file:
server-id=2
and restart the slave MySQL server then execute:
STOP SLAVE;
CHANGE MASTER TO
MASTER_HOST=’<MASTER IP ADDRESS>’,
MASTER_USER=’slave_user’,
MASTER_PASSWORD=’XXXXX’,
MASTER_LOG_FILE=’mysql-bin.000001′,
MASTER_LOG_POS=98;
START SLAVE;
Sorry if this is short on detail but this is just my experience on how to get replication working, the detail can be Googled elsewhere
Leave a Reply
You must be logged in to post a comment.