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

What are the advantages and disadvantages of MySQL GTID replication?

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

Share

Shulou(Shulou.com)05/31 Report--

MySQL GTID replication advantages and disadvantages are what, for this problem, this article details the corresponding analysis and solutions, hoping to help more want to solve this problem of small partners to find a simpler and easier way.

GTID(Global Transaction ID) is the number for a committed transaction and is a globally unique number.

GTID is actually composed of UUID+TID. where UUID is the unique identifier of a MySQL instance. TID represents the number of transactions committed on the instance and increases monotonically with transaction commit. Originally implemented by Google, MySQL officially added this feature in 5.6.

GTID is the unique identifier that creates the assignment when the transaction is committed, and all transactions are mapped to GTID one by one.

Advantages of GTID:

1. From the GTID, you can know on which instance the transaction was originally committed.

2. The existence of GTID facilitates the Failover of Replication

Disadvantages of GTID:

1. GTID mode instances and non-GTID mode instances cannot be replicated. The requirements are very strict. Either they are both GTID or they are not.

2. gtid_mode is read-only. To change the state, you must 1) close the instance, 2) modify the configuration file, and 3) restart the instance.

3. Update non-transaction engine tables

Updating transactional and non-transactional tables in the same transaction results in multiple GTIDs assigned to the same transaction

There are three limitations to GTID:

When force-gtid-consistency=ON, the following three types of statements are not supported

CREATE TABLE ... SELECT statements

CREATE TEMPORARY TABLE or DROP TEMPORARY TABLE statements inside transactions

Transactions or statements that update both transactional and nontransactional tables. There is an exception that nontransactional DML is allowed in the same transaction or in the same statement as transactional DML, if all nontransactional tables are temporary.

But in fact, this restriction is not necessarily so strict.

CREATE TABLE ... SELECT statements

For binlog_format=row, gtid_next='automatic', the restriction can be relaxed.

The binlog generated contains two GTIDs, one for table creation statements and one for transactions containing multiple inserts.

A transaction contains transactional and non-transactional tables

For gtid_next='automatic', the restriction can be relaxed.

The binlog generated contains two GTIDs, one for all non-transactional tables and one for all transactional tables.

For update multiple tables (including transactional and non-transactional tables), binlog_format=row is required.

The advantages and disadvantages of MySQL GTID replication are the answers to what questions are shared here. I hope the above content can be of some help to everyone. If you still have a lot of doubts, you can pay attention to the industry information channel to learn more.

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