Get the App
SLTechnology News&Howtos  ›  Database  › 

GTID for new features of mysql5.6 (can be replicated in parallel)

Shulou Source: shulou.com Published: 2022-06-01 15:08:21 09月28日 Update

GTID is the global transaction ID (global transaction identifier), and GTID is actually made up of UUID+TID. Where UUID is the unique identity of an MySQL instance. TID represents the number of transactions that have been committed on this instance, and increases monotonously as the transaction commits, so GTID can guarantee the execution of each MySQL instance transaction (the same transaction will not be repeated and transactions that have not been executed will be completed). Here is a concrete form of GTID:

1) Construction of replication environment: omitting

Mysql > show variables like'% gtid%'

There is no difference between the construction of master-slave environment and 5.5. the only thing to note is that you need to enable these three parameters to enable GTID:

[mysqld]

# GTID

Gtid_mode = on

Enforce_gtid_consistency = 1

Log_slave_updates = 1

If any parameter is not enabled, an error will be reported:

Binlog-do-db=oa_icore_db # specify the library

Uuid of each instance:

Mysql > select @ @ server_uuid

Use the master-slave change before 5.6:

Mysql > change master to master_host='127.0.0.1',master_user='rep',master_password='rep',master_log_file='mysql-bin3306.000001',master_log_pos=151,/*master_auto_position=1*/

Error report:

ERROR 1776 (HY000): Parameters MASTER_LOG_FILE, MASTER_LOG_POS, RELAY_LOG_FILE and RELAY_LOG_POS cannot be set when MASTER_AUTO_POSITION is active.

The MASTER_LOG_FILE,MASTER_LOG_POS parameter cannot be used when using the MASTER_AUTO_POSITION parameter.

Use the master-slave change after 5.6:

Mysql > change master to master_host='127.0.0.1',master_user='rep',master_password='rep',master_port=3306,master_auto_position=1

Viewing status from the database

Mysql > show slave status\ G

Tags: Transaction parameter instance master-slave environment monotonous three representative global actual actually form data database quantity time is identified by status will be reported Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Shulou Information MySQL OPPO Reno Shulou Technology