mysql5.6 semi replication semi-synchronous replication configuration

Source: Internet
Author: User

--## #半同步配置
--1, plug-in location
Mysql> Show variables like ' Plugin_dir '
;
+---------------+------------------------------+
| variable_name | Value |
+---------------+------------------------------+
| Plugin_dir | /usr/local/mysql/lib/plugin/|
+---------------+------------------------------+


[Email protected] data]$ ll/usr/local/mysql/lib/plugin/semisync_*
-rwxr-xr-x 1 root root 415020 Jul 5 19:50/usr/local/mysql/lib/plugin/semisync_master.so
-rwxr-xr-x 1 root root 248711 Jul 5 19:50/usr/local/mysql/lib/plugin/semisync_slave.so

--2, Master Loading plugin
INSTALL PLUGIN rpl_semi_sync_master SONAME ' semisync_master.so ';

Show plugins; #--verifying that the load is normal

--3, master turn on the half-sync function
Vi/etc/mysql/my.cnf
rpl_semi_sync_master_enabled = 1;
Rpl_semi_sync_master_timeout = 3000; #超出3秒改为异步复制


--4, restart MySQL

--5, slave loading plugin
INSTALL PLUGIN rpl_semi_sync_slave SONAME ' semisync_slave.so ';

Show plugins; #--verifying that the load is normal

--6, slave turn on the semi-synchronous function
Vi/etc/mysql/my.cnf
rpl_semi_sync_slave_enabled = 1;

--7, restart MySQL


--## #监控半同步复制 monitor sync mode/monitor sync status
--master
mysql> show status like '%rpl_semi_sync% ';
+--------------------------------------------+-------+
| variable_name | Value |
+--------------------------------------------+-------+
| rpl_semi_sync_master_clients | 1 |
| Rpl_semi_sync_master_net_avg_wait_time | 476 |
| Rpl_semi_sync_master_net_wait_time | 476 |
| Rpl_semi_sync_master_net_waits | 1 |
| 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 | 610 |
| Rpl_semi_sync_master_tx_wait_time | 610 |
| Rpl_semi_sync_master_tx_waits | 1 |
| Rpl_semi_sync_master_wait_pos_backtraverse | 0 |
| rpl_semi_sync_master_wait_sessions | 0 |
| Rpl_semi_sync_master_yes_tx | 1 |
+--------------------------------------------+-------+


Rpl_semi_sync_master_status = on #--master turn on the half-sync function

rpl_semi_sync_master_clients = 1 #--How many clients turn on the half-sync function


--slave
Mysql> Show status like '%rpl_semi_sync% ';
+----------------------------+-------+
| variable_name | Value |
+----------------------------+-------+
| Rpl_semi_sync_slave_status | On |
+----------------------------+-------+

--analog timeout after the semi-synchronous state
--slave
Stop slave Io_thread;

Mysql> Show status like '%rpl_semi_sync% ';
+----------------------------+-------+
| variable_name | Value |
+----------------------------+-------+
| Rpl_semi_sync_slave_status | OFF |
+----------------------------+-------+


--master more than Rpl_semi_sync_master_timeout this value, master no longer waits for the slave to accept the acknowledgment, but instead automatically commits and becomes asynchronous replication
Mysql> Show variables like '%rpl_semi_sync_master_timeout% ';
+------------------------------+-------+
| variable_name | Value |
+------------------------------+-------+
| Rpl_semi_sync_master_timeout | 3000 |
+------------------------------+-------+

mysql5.6 semi replication semi-synchronous replication configuration

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.