Loading Data to the Primary/Secondary Database
- Import data to the primary database in batches. For example, use the BenchmarkSQL tool to import TPC-C data to the primary database in batches. For details, see BenchmarkSQL Test Guide.
- Ensure that replication is complete on secondary databases.
1 2
/usr/local/mysql/bin/mysql -uroot -p123456 -S /data/mysql/run/mysql.sock show slave status\G;
If the value of Slave_SQL_Running_State is Slave has read all relay log; waiting for more updates, replication is complete on secondary databases.
- Obtain the status values of the primary database.
- Log in to the primary database.
1/usr/local/mysql/bin/mysql -uroot -p123456 -S /data/mysql/run/mysql.sock
- Obtain the status values of the primary database.
1show master status;
- Traditional mode: Record the status values of File and Position.

- GTID mode: Record the status value of Executed_Gtid_Set.

- Traditional mode: Record the status values of File and Position.
- Log in to the primary database.
- Obtain the status values of secondary databases.
- Log in to a secondary database.
1/usr/local/mysql/bin/mysql -uroot -p123456 -S /data/mysql/run/mysql.sock
- Obtain the status values of the secondary database.
1show slave status\G;
- Traditional mode: Record the status values of Master_Log_File, Read_Master_Log_Pos, and Exec_Master_Log_Pos.

- GTID mode: Record the status values of Retrieved_Gtid_Set and Executed_Gtid_Set.

- Traditional mode: Record the status values of Master_Log_File, Read_Master_Log_Pos, and Exec_Master_Log_Pos.
- Log in to a secondary database.
- Compare the obtained status values of the primary database and secondary databases. If the status values are consistent, the relay logs in secondary databases have been replayed.
- Traditional mode: The status value of Master_Log_File in the secondary database is the same as that of File in the primary database. The status values of Read_Master_Log_Pos and Exec_Master_Log_Pos in the secondary database are the same as that of Position in the primary database.
- GTID mode: The status values of Retrieved_Gtid_Set and Executed_Gtid_Set in the secondary database are the same as that of Executed_Gtid_Set in the primary database.
Parent topic: Verifying Primary/Secondary Data Consistency