MySQL database semi-synchronous replication

Source: Internet
Author: User

Semi-synchronous replication, where there is a synchronous replication between a node or a part from a node to the primary node, and the other slave nodes are still replicated asynchronously

Semi-synchronous replication is Google's contribution to the MySQL plug-in, the default in MySQL does not have this plug-in, so to achieve master-slave version of the synchronization needs to install this plugin

RPM-QL mariadb-server| grep semi# Find the plugin to install and end with so
SHOW PLUGINS; #查看当前支持的插件, you can see MyISAM and InnoDB are also plug-in types here

Here's how to configure master-slave replication:


1, create the traditional master-slave replication function of MySQL, please refer to the ' MySQL database master-slave copy ' article (http://panpangao.blog.51cto.com/10624093/1981418)

2. Install the semi-synchronous replication plug-in on the master node

install plugin rpl_semi_sync_master soname  ' Semisync_master ';  //formats are fixed and cannot be arbitrarily modified show  GLOBAL VARIABLES LIKE  ' rpl_semi% ';     //view the semi-synchronous replication feature of the master node, which is not yet open set  global rpl_semi_sync_master_enabled=on;  //Open show global status like  '%rpl% ';             //view status, the key is to view  RPL_SEMI_SYNC_ The number of master_clients is not configured at this time from the node so it is 0+--------------------------------------------+-------------+| variable_name                                | Value        |+--------------------------------------------+-------------+| rpl_semi_sync_master_ Clients               | 0            | |  Rpl_semi_sync_master_net_avg_wait_time     | 0            | |  Rpl_semi_sync_master_net_wait_time         | 0            | |  Rpl_semi_sync_master_net_waits              | 0           | |  Rpl_semi_sync_master_no_times               | 0           | |  Rpl_semi_sync_master_no_tx                  | 0           | |  rpl_semi_sync_master_status                | on           | |  Rpl_semi_sync_master_timefunc_failures     | 0            | |  Rpl_semi_sync_master_tx_avg_wait_time      | 0            | |  rpl_semi_sync_master_tx_wait_time          | 0            | |  Rpl_semi_sync_master_tx_waits               | 0           | |  Rpl_semi_sync_master_wait_pos_backtraverse | 0            | |  rpl_semi_sync_master_wait_sessions         | 0            | |  Rpl_semi_sync_master_yes_tx                 | 0           | |  Rpl_status                                  |  auth_master |+--------------------------------------------+-------------+15 rows in  set  (0.00 SEC)


3. Installing the semi-synchronous copy plug-in from the node

INSTALL PLUGIN rpl_semi_sync_slave SONAME ' Semisync_slave '; SET GLOBAL Rpl_semi_sync_slave_enabled=on;    SHOW GLOBAL VARIABLES like ' rpl_semisync% ';           SHOW GLOBAL VARIABLES like '%rpl% ';   At this point from the function is to open the show GLOBAL STATUS like '%rpl% '; However, the status is off because the IO thread from the node at this time does not restart the stop SLAVE io_thread;  START SLAVE Io_thread; Restart the IO thread from

4. Testing

At this point, the number of clients on the master node will become 1, because a slave node has been added;

Create database, table on master node, synchronize to slave node

SHOW GLOBAL STATUS like '%rpl% '; At this point the information displayed will change, the main node waiting time, the average waiting time, wait times and other information, can be seen from the literal meaning


This is the end of the experiment.

This article from "A_pan" blog, declined reprint!

MySQL database semi-synchronous replication

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.