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

Mysql master-slave replication configuration (GTID-based replication link)

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

Share

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

In addition to log point-based replication, there is a GTID-based replication method after the mysql5.6 version:

GTID is the global transaction id.

GTID ensures that each transaction committed on the master can generate a unique id value in the replication cluster.

The following configuration needs to be added to the master-slave database configuration file at the same time:

Gtid_mode: on

Enforce-gtid-consistency: force gtid consistency (used to secure transactions after gtid startup)

If you want to use gtid replication in the log-slave-updates:mysql5.6 version, be sure to start it, but it may not be enabled in the mysql5.7 version.

Gtid is unique in the entire replication cluster, and mysql can use gtid to determine which ones have not been synchronized to the slave, so use master_auto_position=1 instead of master_log_file and master_log_pos (the biggest difference between gtid replication link and log point replication)

(the original log point replication can be made using create table... Select to create the table. Gtid can only create the table first, and then insert it into the new table using insert into. So make sure that gtid replication is not done as above, otherwise it will cause an exception)

Specific configuration reference log point replication

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