MySQL master-slave replication + dual master replication

Source: Internet
Author: User

We may encounter this problem when we use the MySQL server database, and if one of the MySQL databases goes down, we want to fix it in the shortest possible time and use the database as quickly as we can, but what if we encounter some failures that cannot be quickly repaired?

We can imagine that if this is another database that is identical to this database, the problem is not the same, how can be realized in real-time, and automatic backup or replication?


MySQL master-slave replication:


1. After the host has installed the MySQL service, first modify the My.cnf file, add two lines, where the server ID ensures that the unique

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/F3/wKioL1YKhFWAqbXxAAApw-qbj6w731.jpg "style=" float: none; "title=" 1.png "alt=" Wkiol1ykhfwaqbxxaaapw-qbj6w731.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/F6/wKiom1YKhErCLHTnAABSj1Ghfoc664.jpg "style=" float: none; "title=" 2.png "alt=" Wkiom1ykherclhtnaabsj1ghfoc664.jpg "/>


2. Standby Machine Modification MY.CNF

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/F3/wKioL1YKhFXAnalnAABO2B2qXgg319.jpg "style=" float: none; "title=" 3.png "alt=" Wkiol1ykhfxanalnaabo2b2qxgg319.jpg "/>


3. Two MySQL restart service

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/F6/wKiom1YKhEvxmWzEAABSF8j0N1c602.jpg "style=" float: none; "title=" 4.png "alt=" Wkiom1ykhevxmwzeaabsf8j0n1c602.jpg "/>


4. New replication user cluster in the host database

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/F3/wKioL1YKhFXR33rkAABpj_ZAqMw188.jpg "style=" float: none; "title=" 5.png "alt=" Wkiol1ykhfxr33rkaabpj_zaqmw188.jpg "/>

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/73/F3/wKioL1YKhPexjaZ4AAC-xQWMpbc594.jpg "style=" float: none; "title=" 6.png "alt=" Wkiol1ykhpexjaz4aac-xqwmpbc594.jpg "/>


5. Enter the user name, password, IP, etc. in the standby machine

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/F6/wKiom1YKhOzRD1i0AACahBwidVY748.jpg "style=" float: none; "title=" 7.png "alt=" Wkiom1ykhozrd1i0aacahbwidvy748.jpg "/>


6. Start slave mode

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/73/F3/wKioL1YKhPfzBZqoAABUNdf9R1I761.jpg "style=" float: none; "title=" 8.png "alt=" Wkiol1ykhpfzbzqoaabundf9r1i761.jpg "/>


7. Create a new library in the host

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/F6/wKiom1YKhO2RtzHRAAA4YZdzpbk385.jpg "style=" float: none; "title=" 9.png "alt=" Wkiom1ykho2rtzhraaa4yzdzpbk385.jpg "/>


8. See if this library is available in the standby machine

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/73/F3/wKioL1YKhPfCcjf9AAB_fRrQ2sw154.jpg "style=" float: none; "title=" 10.png "alt=" Wkiol1ykhpfccjf9aab_frrq2sw154.jpg "/>



MySQL dual-master replication, and other operations as the primary and standby replication, only after the standby machine to fill out the host's IP user password, the standby machine in the new replication users, and then fill in the host.


MySQL master-slave replication + dual master replication

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.