Environment:
Master: 172.16.115.161
From: 172.16.115.163
1. Install MySQL and mysql-server on master and slave machines
Yum install-y MySQL Mysql-server
2. The master-slave configuration file opens the binary file; The server ID is used to differentiate between different hosts in a set of servers, typically with IP addresses the last
Vim/etc/my.cnf
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/8D/65/wKioL1ia9MjCWBALAAAfD1sJ6UM416.png "title=" 2.png "alt=" Wkiol1ia9mjcwbalaaafd1sj6um416.png "/>
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/8D/65/wKioL1ia9PrBxY11AAAe-w0vN3A002.png "title=" 21. PNG "alt=" Wkiol1ia9prbxy11aaae-w0vn3a002.png "/>
3. Start the master-slave server and grant replication slave permissions from the primary
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/8D/67/wKiom1ia9NqzS-8uAAAeOKFtVuk703.png "title=" 3.png "alt=" Wkiom1ia9nqzs-8uaaaeokftvuk703.png "/>
4. View the binaries of the master server and no longer operate the master MySQL
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8D/65/wKioL1ia9OvANdJNAAAY3b8kbIk002.png "title=" 4.png "alt=" Wkiol1ia9ovandjnaaay3b8kbik002.png "/>
5. Re-enter the primary server information manually from the server to see if this information is saved to the Master.info file under the database
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/8D/67/wKiom1ia9RTxTlsUAAAZRU1bUYY762.png "style=" float : none; "title=" 5.png "alt=" Wkiom1ia9rtxtlsuaaazru1buyy762.png "/>
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/8D/65/wKioL1ia9RSScVVnAAAePnMGq2A093.png "style=" float : none; "title=" 51.png "alt=" Wkiol1ia9rsscvvnaaaepnmgq2a093.png "/>
6. Open the slave function from the top and view the slave status, both the IO process and the SQL process are turned on; \g formatted output
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/8D/67/wKiom1ia9S6iydzfAAAI995uLvI277.png "title=" 6.png "alt=" Wkiom1ia9s6iydzfaaai995ulvi277.png "/>
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8D/65/wKioL1ia9VbR-5bmAAA2z4lE94M736.png "title=" 61. PNG "alt=" Wkiol1ia9vbr-5bmaaa2z4le94m736.png "/>
7. Create a database on the primary server, created from the top sync (can only be synchronized to the slave, cannot be reversed)
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/8D/65/wKioL1ia9T2zrthhAAAb4fYtzsk997.png "style=" float : none; "title=" 7.png "alt=" Wkiol1ia9t2zrthhaaab4fytzsk997.png "/>
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/8D/68/wKiom1ia9T7iQlebAAAQIyoCcoI725.png "style=" float : none; "title=" 71.png "alt=" Wkiom1ia9t7iqlebaaaqiyoccoi725.png "/>
mysql-Database Master-slave backup