Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MySQL5.6 semi-synchronous replication to ensure database consistency

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Semi-synchronous replication requires the use of plug-ins, and both master and slave nodes need to install plug-ins. After the plug-in is installed, configure the system variable to enable and turn off semi-synchronous replication.

1. Semi-synchronous implementation premise

Database version 5.5 or above

Have_dynamic_loading system variable is YES.

Replication is already working properly.

two。 Install the plug-in

Master node INSTALL PLUGIN rpl_semi_sync_master SONAME 'semisync_master.so'; slave node INSTALL PLUGIN rpl_semi_sync_slave SONAME' semisync_slave.so'

3. Check to see if the installation is successful

Show plugins; shows that the installation is successful | rpl_semi_sync_master | ACTIVE | REPLICATION | semisync_master.so | GPL | | rpl_semi_sync_slave | ACTIVE | REPLICATION | semisync_slave.so | GPL | mysql > show variables like'% semi%' +-+-+ | Variable_name | Value | +-- -+-+ | rpl_semi_sync_master_enabled | OFF | | rpl_semi_sync_master_timeout | 10000 | | rpl_semi_sync_master_trace_level | 32 | rpl_semi_sync_master_wait_no_slave | ON | | rpl_semi_sync_slave_enabled | OFF | | rpl_semi_sync_slave_trace_level | | 32 | +-+-+ 6 rows in set (0.00 sec) |

4. Enable semi-synchronization

The master node enables semi-synchronization, and the timeout is 10s.

SET GLOBAL rpl_semi_sync_master_enabled = 1 * set GLOBAL rpl_semi_sync_master_timeout = 10000; enable semi-synchronization from the slave node, restart the replication thread effective SET GLOBAL rpl_semi_sync_slave_enabled = 1 * * stop SLAVE IO_THREAD;START SLAVE IO_THREAD

5. Confirm that semi-synchronization is effective

Show global status like 'rpl%'

6. Persistence parameter

On the master: [mysqld] rpl_semi_sync_master_enabled=1rpl_semi_sync_master_timeout=1000 # 1 secondOn each slave: [mysqld] rpl_semi_sync_slave_enabled=1

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report