This is just a brief summary for the whole steps, more details please refer to : http://dev.mysql.com/doc/refman/5.5/en/replication.html
Steps:
1. master and slave server must have the same database structure and same data;(dump data from master to slave).
2. for master server:set server-id=1 and open binary log(log-bin=mysql-bin.log)
for slave server : set server-id=2.
3. start master server, use "show master status\G" to show binary log file name and position;
4. start slave server, use below command to set slave server's related master server info.
mysql> CHANGE MASTER TO
-> MASTER_HOST='master_host_name',
-> MASTER_USER='replication_user_name',
-> MASTER_PASSWORD='replication_password',
-> MASTER_LOG_FILE='recorded_log_file_name',
-> MASTER_LOG_POS=recorded_log_position;
5. check the log of master and slave server, if no errors, then means all ready, then execute start slave in slave server.
Reference command : "show processlist\G" , "show master status\G", "show slave status\G" , "start slave" , "stop slave" , "reset slave" , "show variables like
*** "
Leave a Reply