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 configure semi-synchronous replication in mysql

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

Share

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

This article introduces how to configure semi-synchronous replication in mysql. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

1. Prepare the master and backup library configuration files and create replication users

Master server_id = 1 standby server_id = 2, restart the database

GRANT REPLICATION SLAVE ON *. * TO repl@'192.168.137.%' IDENTIFIED BY 'repl123'

two。 Back up the main library

Mysqldump-uroot-p123456-- socket=/usr/local/mysql/mysql.sock-- single-transaction-A-- master-data=1 > all.sql

3. Restore to slave library

Source all.sql

4. Establish a replication relationship and start replication

View binlog location

CHANGE MASTER TO MASTER_LOG_FILE='binlog.000006', MASTER_LOG_POS=1169

Establish a replication relationship:

CHANGE MASTER TO MASTER_HOST='192.168.137.5'

MASTER_USER = 'repl'

MASTER_PASSWORD = 'repl123'

MASTER_PORT=3306

MASTER_LOG_FILE='binlog.000006'

MASTER_LOG_POS=1169

Start replication:

Start slave

Show slave status\ G

5. Install semi-synchronous plug-in in master-slave library

Show plugins

Main library

Install plugin rpl_semi_sync_master SONAME 'semisync_master.so'

Slave library

Install plugin rpl_semi_sync_slave SONAME 'semisync_slave.so'

6. Set master-slave library parameters

Main library:

Set global rpl_semi_sync_master_enabled = 1

Set global rpl_semi_sync_master_timeout = 10000

From the library:

Set global rpl_semi_sync_slave_enabled = 1

7. Restart replication

Stop slave

Start slave

Show global status like'% semi%'

On how to configure semi-synchronous replication in mysql to share here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.

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

  • SpringBoot (12): integrated Druid

    First, add dependencies

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

    12
    Report