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

Master-Slave replication Construction based on GTID

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

Share

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

Pre-inspection

Server-id = 10 Masterstroke does not allow repetition

Log-bin

Gtid-mode = ON

Enforce-gtid-consistency = ON

1. Use mysqlpump to copy master data to slave, and build master-slave replication based on GTID. Lack of GTID processing method, it is not successful for the time being.

Mysqlpump-host=-user=-password=-single-transaction-default-parallelism=4-compress-output=LZ4 "dbname" > / home/dbname.sql.lz4

Lz4-d inputfile outputfile

Mysql-u-p

< /home/dbname.sql 常见错误:Message: Got a packet bigger than 'max_allowed_packet' bytes max_allowed_packet过小,调大到32M,默认4M。 CHANGE MASTER TO MASTER_HOST = 'host_name', MASTER_USER = 'user_name', MASTER_PASSWORD = 'password', MASTER_AUTO_POSITION = 1; start slave; ERROR 1776 (HY000) at line 30: Parameters MASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS cannot be set when MASTER_AUTO_POSITION is active. mysqlpump 备份文件缺少SET @@GLOBAL.GTID_PURGED='XXX:1-XXX';相关语句。 暂无解决方法。 2,使用mysqldump复制master数据到slave,搭建基于GTID的主从复制。 mysqldump --host= --user= --password= --single-transaction --routines --events "dbname" |gzip >

/ home/dbname.sql.gz

Common error: mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table.

Network write timed out, change net_write_timeout to 600, default is 60.

Gzip-cd inuptfile > outputfile

Mysql-u-p < / home/dbname.sql

CHANGE MASTER TO

MASTER_HOST = 'host_name'

MASTER_USER = 'user_name'

MASTER_PASSWORD = 'password'

MASTER_AUTO_POSITION = 1

Start slave

3. Use mysqldbcompare for data consistency verification

Compare all databases with the same name between two servers

Ignore the following databases: INFORMATION_SCHEMA, PERFORMANCE_SCHEMA, mysql, and sys.

Mysqldbcompare-server1=user:password@localhost-server2=user:password@localhost-changes-for=server1-a

Databases are consistent. The check passed.

Complete the master-slave construction.

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