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

How to set semi-synchronous replication in mysql

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

Share

Shulou(Shulou.com)05/31 Report--

How to set up semi-synchronous replication in mysql? I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

Install and open semi-synchronous plug-ins on the master and slave

Mysql > install plugin rpl_semi_sync_master soname 'semisync_master.so'

Query OK, 0 rows affected (0.02 sec)

Mysql > set global rpl_semi_sync_master_enabled=on

Check whether the installation is successful on the master and slave

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_for_slave_count | 1 | |

| | rpl_semi_sync_master_wait_no_slave | ON |

| | rpl_semi_sync_master_wait_point | AFTER_SYNC |

+-+ +

6 rows in set (0.00 sec)

Interpretation of related parameters

Setting rpl_semi_sync_master_enabled # # to on means that the semi-synchronization feature is enabled

Rpl_semi_sync_master_timeout # # unit is millisecond, which means that if the master library waits for a reply message from the slave library for more than this value, it automatically switches to asynchronous replication mode.

Rpl_semi_sync_master_wait_for_slave_count # # it controls how many successful responses the master database receives from the write transactions of the slave library before returning them to the client successfully

The default value of rpl_semi_sync_master_wait_point # # is AFTER_SYNC, which means that the master library writes each transaction to binlog and passes it to the slave library, refreshes it to the relay log, and the master library begins to wait for feedback from the slave library. After receiving the reply from the slave library, the master library commits the transaction and returns the "commit ok" result to the client.

Restart the io thread of the slave library for the setting to take effect

Stop slave io_thread

Start slave io_thread

After reading the above, have you mastered how to set up semi-synchronous replication in mysql? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

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

Wechat

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

12
Report