Chapter 15 of mysql manual (version 5.0) deals with this.
At the master server: (Assumption: Mysql is installed and running)
1. Edit /etc/my.cnf
1.1 Add the following into [mysqld] section
grant replication slave on *.* to 'slaveuser'@'192.168.1.%' identified by 'slavepass';
3. Restart service at the master
service mysqld restart
4. Find the position of the current log
flush tables with read lock;
show master status;
(Note the position of the log file. This will be used at slave)
At the slave server:
1. Add the following to /etc/my.cnf in the [mysqld] section
change master to MASTER_HOST='192.168.1.5', MASTER_USER='slaveuser', MASTER_PASSWORD='slavepass', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=90;
Noticed this issue: After reboot, the log filename changes. How to fix this issue?
At the master server: (Assumption: Mysql is installed and running)
1. Edit /etc/my.cnf
1.1 Add the following into [mysqld] section
[mysqld]2. Add a user for replication
log-bin=mysql-bin
server-id=1
grant replication slave on *.* to 'slaveuser'@'192.168.1.%' identified by 'slavepass';
3. Restart service at the master
service mysqld restart
4. Find the position of the current log
flush tables with read lock;
show master status;
(Note the position of the log file. This will be used at slave)
At the slave server:
1. Add the following to /etc/my.cnf in the [mysqld] section
[mysqld]2. Add the master information to slave server.
server-id=2
change master to MASTER_HOST='192.168.1.5', MASTER_USER='slaveuser', MASTER_PASSWORD='slavepass', MASTER_LOG_FILE='mysql-bin.000001', MASTER_LOG_POS=90;
Noticed this issue: After reboot, the log filename changes. How to fix this issue?
No comments:
Post a Comment