Querying the Deployment Mode
Query the deployment mode (asynchronous replication or semisynchronous replication) of MySQL primary-secondary replication. The deployment mode of the primary database must be the same as that of secondary databases.
- Ensure that the primary database is in normal state.
- Log in to the primary database.
1/usr/local/mysql/bin/mysql -uroot -p123456 -S /data/mysql/run/mysql.sock
- Query the status of the primary database.
show master status;
If values are displayed in the File and Position columns, the primary database is running properly.
- Query the host information of secondary databases.
show slave hosts;
The primary database has the host information of two secondary databases, and the Host and Port values of the secondary databases are correct.
- Log in to the primary database.
- Query the deployment mode of the primary database.
Query the value of the semisynchronous replication parameter. If the value is ON, semisynchronous replication is deployed. If the value is OFF or empty, asynchronous replication is deployed.
show variables like '%rpl_semi_sync_master_enabled%';
- Ensure that secondary databases are in normal state.
- Log in to a secondary database.
1/usr/local/mysql/bin/mysql -uroot -p123456 -S /data/mysql/run/mysql.sock
- Query the status of the secondary database.
show slave status\G;
If the values of the following two parameters are Yes, the secondary database is normal.
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
- Log in to a secondary database.
- Query the deployment mode of the secondary database.
Query the value of the semisynchronous replication parameter. If the value is ON, semisynchronous replication is deployed. If the value is OFF or empty, asynchronous replication is deployed.
show variables like '%rpl_semi_sync_slave_enabled%';