Primary server (192.168.1.111) configuration:
1. To set up authorized users from the server 2, modify the master server Profile MY.COF, open the Bin-log log, and set the Server-id value (each server-id is not the same) 3, set the read lock on the primary server is valid, ensure that there is no database operation, in order to obtain a one-time snapshot 4. View the current binary log name and offset on the primary server 5, the current primary database server has stopped the update operation, to generate a backup of the primary database, Backup has two methods:(1), CP all data(2), mysqldump Backup Data method 6. After the primary database has been backed up, the primary database can resume the write operation 7, the primary database to restore the consistent backup from the database, put the above test2.sql to the corresponding directory can be from server Configuration (192.168.1.112):1. Modify the configuration file from the server vim/etc/my.cnf
2. Restart Mysqld service 3. See the corresponding list of master and slave replication processes in two ways:(1), Processlist (2), status Slave_io_running This process is responsible for reading the Bin-log log from the server from the primary server and writing it to the trunk log from the serverSlave_sql_running This process is responsible for reading and executing the Binlog log in the trunk log configuration Complete Test success!!
MySQL Master-slave replication