Principle: 1.mysql Master-Slave backup, responsible for the transfer of various changes between the master and slave server is the binary log (bin-log), stored in the binary day log changes called events. Replication is done with two threads from the server. The I/O thread receives the host server's pending events and writes to the relay log (Relay log), where the SQL thread reads and executes from the log. we need to open the log there: the primary server Bin-log, from the server Bin-log,relay-log. 2. The master and slave servers must be assigned separate replication id 3 separately. From the server must have a connection to the master server and request permission to modify, you need to set up an account to give permissions. Lab environment: 1. master-slave servers are VMware-installed centos6.7. View System version command: CAT /ETC/ISSUE     2. The MySQL version of the master-slave server is mysql 5.6.34 view mysql version command: mysql -v 3. master server ip:192.168.11.121 ip: 192.168.11.120 from the server Details: 1. Settings for the primary server: # #我的mysql安装路径为:/usr/local/mysql set the Replication ID and open bin-log for the server The command is as follows: vi /usr/local/mysql/ my.cnf server_id=10 # #复制ID bin-log=/usr/local/mysql/mysql-binlog ## Open binary Log modify and restart under mysql . 2. Configuration from the server:    &Nbsp; vi /usr/local/mysql/my.cnf server_id=20 # #复制ID bin-log=/usr/local/mysql/ mysql-binlog # #打开二进制日志 relay_log=/usr/ local/mysql/mysql-relaylog # #打开中继日志 Modify and restart the mysql . 3. Set up accounts and permissions to connect to the primary server from the server. set up account: on the master server GRANT REPLICATION SLAVE On . to [email protected] ' 192.168.11.% ' IDENTIFIED BY ' password '; Command Description: Set up account ' repl ' @ ' 192.168.11.% ', password for ' password ', this account has replicatio slave Permissions 4. Determine the replication coordinates of the primary server. Command:show master status # #在mysql里执行这个命令
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M01/8D/C2/wKiom1iqVs7xeBvkAAAFdIwyZ7g394.png-wh_500x0-wm_ 3-wmp_4-s_3962486891.png "title=" show Masater.png "alt=" Wkiom1iqvs7xebvkaaafdiwyz7g394.png-wh_50 "/>
Remember the file and position values, which are used later from the server. 5. Turn on sync from the server
650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/8D/C2/wKiom1iqWxmyYLDxAAAJ-FLy4zU233.png-wh_500x0-wm_ 3-wmp_4-s_1118891528.png "title=" Start Slave.png "alt=" Wkiom1iqwxmyyldxaaaj-fly4zu233.png-wh_50 "/>
650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/8D/C3/wKiom1iqW2iAzsDVAAAJWLetW1s494.png-wh_500x0-wm_ 3-wmp_4-s_2062808365.png "title=" Start Slave2.png "alt=" Wkiom1iqw2iazsdvaaajwletw1s494.png-wh_50 "/>
This article is from the "Gome Learning" blog, so be sure to keep this source http://goome.blog.51cto.com/4045241/1899387
MySQL master-slave configuration record