MySQL master-slave synchronization enables semi-sync

Source: Internet
Author: User

To install the MySQL semi-sync plugin:
Primary Server Installation Plugin:
Mysql> show global variables like ' plugin_dir% ';
+---------------+--------------------------+
| variable_name | Value |
+---------------+--------------------------+
| Plugin_dir | /usr/lib64/mysql/plugin/| The exact location of the current MySQL plug-in directory
+---------------+--------------------------+

MySQL > INSTALL PLUGIN rpl_semi_sync_master SONAME ' semisync_master.so ';
Master server semi-synchronous parameters (only after plug-in installation):
Mysql> show global variables like ' rpl_semi_sync_master% ';
+-------------------------------------------+------------+
| variable_name | Value |
+-------------------------------------------+------------+
| rpl_semi_sync_master_enabled | OFF | Turn on semi-synchronous mode
| Rpl_semi_sync_master_timeout | 10000 | Half-sync Timeout time 10000 ms
| Rpl_semi_sync_master_trace_level | 32 | Trace level
| Rpl_semi_sync_master_wait_for_slave_count | 1 | Wait at least how many servers to complete synchronization from the server
| Rpl_semi_sync_master_wait_no_slave | On |
| Rpl_semi_sync_master_wait_point | After_sync | 5.7 New semi-synchronous mode (Value=after_sync is loss-less semi-synchronous, After_commit is the old half-sync)
+-------------------------------------------+------------+

Turn on the master server semi-synchronous:mysql> set global rpl_semi_sync_master_enabled=on; Install the plugin from the server:

MySQL > INSTALL PLUGIN rpl_semi_sync_slave SONAME ' semisync_slave.so ';
Semi-sync parameters from the server (only after the plug-in is installed):
Mysql> show global variables like ' rpl_semi_sync_slave% ';
+---------------------------------+-------+
| variable_name | Value |
+---------------------------------+-------+
| rpl_semi_sync_slave_enabled | OFF | Turn on semi-synchronous mode
| Rpl_semi_sync_slave_trace_level | 32 | Trace level
+---------------------------------+-------+
Open the:mysql> set global rpl_semi_sync_slave_enabled=on from the server boot half-sync;

To view specific half-sync status information:
Main:
MySQL > Show global status Like ' rpl_semi_sync% ';
+--------------------------------------------+-------+
| variable_name | Value |
+--------------------------------------------+-------+
| rpl_semi_sync_master_clients | 0 | Number of semi-synchronous copies from the server
| Rpl_semi_sync_master_net_avg_wait_time | 0 | Average Network wait time
| Rpl_semi_sync_master_net_wait_time | 0 | Network wait duration
| 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 | Primary server semi-synchronous state
| 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 |
+--------------------------------------------+-------+

Note: This requires a reboot from the server's thread, which has previously been stuck in the semi-synchronous, State (Rpl_semi_sync_master_status=on), but not from the client (rpl_semi_sync_master_clients= 0), see the status information above
mysql> STOP SLAVE [Io_thread];
mysql> START SLAVE [Io_thread];

MySQL master-slave synchronization enables semi-sync

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.