mysql-Database Master-slave backup

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.