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

Establishing semi-synchronous replication Slave Library on-line by mysql

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

Share

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

Establishing semi-synchronous replication Slave Library on-line by mysql

Create users for synchronization in the main and standby libraries:

Grant replication slave on *. * to repl@'%' identified by 'xxx'

(1) back up the main database:

Mysqldump-uroot-pxxx-routines-single_transaction-master-data=2-databases testdb1 testdb2 > backup.sql

Transfer to the slave library:

Scp backup.sql 192.168.2.22:/root/

(2) from the library:

Restore backup:

Mysql-uroot-pxxx

< backup.sql 查看备份是的查看binlog和pos值 head -25 backup.sql (3)设置同步点: change master to master_host="host1",master_user="repl",master_password="xxx",master_log_file="mysql-bin.000012",master_log_pos=97896903; start slave; (4)设置mysql半同步复制 主库: mysql>

Install plugin rpl_semi_sync_master soname 'semisync_master.so'

Mysql > set global rpl_semi_sync_master_enabled=1

Mysql > set global rpl_semi_sync_master_timeout=1000

Mysql > install plugin rpl_semi_sync_slave soname 'semisync_slave.so'

Mysql > set global rpl_semi_sync_slave_enabled=1

Mysql > show global status like 'rpl%'

In order for mysql to load this feature automatically when it is restarted, add the following in / etc/my.cnf:

Rpl_semi_sync_master_enabled=1

Rpl_semi_sync_master_timeout=1000

Rpl_semi_sync_slave_enabled=1

Prepare the library:

Mysql > install plugin rpl_semi_sync_master soname 'semisync_master.so'

Mysql > set global rpl_semi_sync_master_enabled=1

Mysql > set global rpl_semi_sync_master_timeout=1000

Mysql > install plugin rpl_semi_sync_slave soname 'semisync_slave.so'

Mysql > set global rpl_semi_sync_slave_enabled=1

Add in / etc/my.cnf:

Rpl_semi_sync_master_enabled=1

Rpl_semi_sync_master_timeout=1000

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