Semi-synchronous replication in MySQL master-slave replication

Source: Internet
Author: User

Experiment MySQL with the plug-in provided by Google, complete the semi-synchronous replication model;


The physical machine is still the Win7 system, the virtual machine is centos7;

Master node: 192.168.255.2

From node: 192.168.255.3


Configure the primary from the replication model first:

On the master node:

]# vim/etc/my.cnf

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/82/8B/wKiom1dYXaCh22GXAABMCtVpzw0430.png "title=" 1.png " alt= "Wkiom1dyxach22gxaabmctvpzw0430.png"/>


From node:

]# vim/etc/my.cnf

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/82/89/wKioL1dYXurC-WVYAABEkkoeAts254.png "title=" 2.png " alt= "Wkiol1dyxurc-wvyaabekkoeats254.png"/>


Start the two-node MYSLQ service:

]# systemctl Start Mariadb.service


On the master node:

Configure the account with replication privileges:

> GRANT REPLICATION slave,replication CLIENT on * * to ' repluser ' @ ' 192.168.255.% ' identified by ' replpass ';

> FLUSH privileges;


Note: If you want to create an account with copy permission from the server, you must first enable the master and slave settings before executing this command:


To view the location of the binary log transaction:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M00/82/89/wKioL1dYZtGAHkpoAAAgzfd8Jx4057.png "title=" 3.png " Width= "height=" 164 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" width:700px;height:164px; "alt=" Wkiol1dyztgahkpoaaagzfd8jx4057.png "/>


On the slave node:

To set the sync location:

> Change MASTER to master_host= ' 192.168.255.2 ', master_user= ' repluser ', master_password= ' Replpass ', Master_log_ File= ' master-bin.000003 ', master_log_pos=499;


Master-Slave replication configuration is complete;


Install the appropriate plugins on the master and slave nodes separately:


On the master node:

> INSTALL PLUGIN rpl_semi_sync_master SONAME ' semisync_master.so ';

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/82/8B/wKiom1dYZqqQdBK7AAEUE7v-DPA000.png "title=" 4.png " Width= "723" height= "663" border= "0" hspace= "0" vspace= "0" style= "width:723px;height:663px;" alt= " Wkiom1dyzqqqdbk7aaeue7v-dpa000.png "/>


Enable the master node for semi-sync:

> SET GLOBAL rpl_semi_sync_master_enabled=1;



From node:

Install the From node plugin:

> INSTALL PLUGIN rpl_semi_sync_slave SONAME ' semisync_slave.so ';

650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/82/89/wKioL1dYaLWymN4LAAESCvrUUTo303.png "title=" 5.png " Width= "727" height= "679" border= "0" hspace= "0" vspace= "0" style= "WIDTH:727PX;HEIGHT:679PX;" alt= " Wkiol1dyalwymn4laaescvruuto303.png "/>


Enable for semi-synchronous slave nodes

> SET GLOBAL rpl_semi_sync_slave_enabled=on;


To initiate synchronization from a node:

> START SLAVE;

Ensure that the thread from the node starts normally:

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/82/8B/wKiom1dYaUrByKGJAACcKqXI840626.png "title=" 6.png " alt= "Wkiom1dyaurbykgjaacckqxi840626.png"/>


At this point, the MySQL master-slave copy of the semi-synchronous configuration is complete, can demonstrate validation;


On the master node:

After creating a new library and viewing the relevant parameter values:

650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M01/82/8B/wKiom1dYcIzh-mrYAACKhB0IFqE078.png "title=" 7.png " alt= "Wkiom1dycizh-mryaackhb0ifqe078.png"/>

Where Rpl_semi_sync_master_clients: For the current master node, how many semi-synchronous nodes, a value of 1 indicates that there is a semi-synchronous node;


View from node:

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/82/89/wKioL1dYdFeQ-ABiAABt0Oac6ek822.png "title=" 8.png " alt= "Wkiol1dydfeq-abiaabt0oac6ek822.png"/>

The above demo is the configuration process for semi-synchronous replication.


Semi-synchronous replication in MySQL master-slave 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.