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

Mysql5.6 is based on GTID master-slave replication settings

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

1. Binlog must be enabled for both master and slave libraries.

two。 The master library and slave library server-id are not the same

3. Establish a master-slave secondary user

Grant replication slave on. To 'rep'@'192.168.200.%' identified by' oldboy'

[mysqld]

Server-id=1

Log-bin=mysql.bin

Binlog_format=row

Gtid_mode=ON

Enforce_gtid_consistency

Log_slave_updates

Relay_log_purge=OFF

Note: the above settings must exist.

Change master to master_host='192.168.200.77'

Master_port=3306

Master_user='rep'

Master_password='oldboy123'

Master_auto_position=1

Start slave

Show slave status\ G

Reset slave all; clears all slave information

Error prompt: prompt warning,A partial dump from a server that has GTIDs on export

[root@bastion-IDC ~] # mysqldump-uroot-p xqsj_db > xqsj_db20160811.sql

Warning: A partial dump from a server that has GTIDs will by default include the GTIDs of all transactions, even those that

Changed suppressed parts of the database. If you don't want to restore GTIDs, pass-- set-gtid-purged=OFF. To make a complete

Dump, pass-all-databases-triggers-routines-events.

After GTID is 5.6, global transaction ID (GTID) is added to strengthen the database's primary and standby consistency, fault recovery, and fault tolerance.

Official: A global transaction identifier (GTID) is a unique identifier created and associated with each transaction committed on the server of origin (master).

So it may be because it is unique in one database, but it is possible to repeat when importing other libraries. So there's a reminder.

You can set it by adding two parameters-- set-gtid-purged=off or-gtid-mode=OFF.

There is a good chance that GTID can be reproduced in the import library instead of the original.

[root@master] # mysqldump-uroot-poldboy-- set-gtid-purged=off-A-B-F > all.sql # so ok!

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