Get the App
SLTechnology News&Howtos  ›  Database  › 

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

Shulou Source: shulou.com Published: 2022-06-01 05:41:03 10月03日 Update

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

Tags: Synchronization backup online function yes user China Canada transmission Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS MySQL Microsoft Huawei Shulou Information