Querying the Replication Mode
Query the replication mode (traditional or GTID) of MySQL primary-secondary replication. The two replication modes have no performance difference, and GTID is recommended. The replication mode of the primary database must be the same as that of secondary databases.
- Log in to the primary database.
1/usr/local/mysql/bin/mysql -uroot -p123456 -S /data/mysql/run/mysql.sock
- Query the replication mode of the primary database.
- Query the value of gtid_mode.
If the value is ON, the GTID mode is used. Otherwise, the traditional mode is used.
show variables like '%gtid_mode%';
- Query threads.
If the value of Command in the I/O thread is Binlog Dump GTID, GTID-based replication is used. Otherwise, traditional replication is used.
show processlist;

- Query the value of gtid_mode.
- Log in to a secondary database.
1/usr/local/mysql/bin/mysql -uroot -p123456 -S /data/mysql/run/mysql.sock
- Query the replication mode of the secondary database.
- Query the value of gtid_mode.
show variables like '%gtid_mode%';
If the value is ON, GTID-based replication is used. Otherwise, traditional replication is used.
- Query the status of the secondary database.
show slave status\G;
If Executed_Gtid_Set in the command output has the same value as that of the same parameter in the command output of show master status; on the primary database, GTID-based replication is used. Otherwise, traditional replication is used.
- Query the value of gtid_mode.
Parent topic: Querying Primary-Secondary Replication