我要评分
获取效率
正确性
完整性
易理解

Loading Data to the Primary/Secondary Database

  1. 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.
  2. 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.

  3. Obtain the status values of the primary database.
    1. Log in to the primary database.
      1
      /usr/local/mysql/bin/mysql -uroot -p123456 -S /data/mysql/run/mysql.sock
      
    2. Obtain the status values of the primary database.
      1
      show master status;
      
      • Traditional mode: Record the status values of File and Position.

      • GTID mode: Record the status value of Executed_Gtid_Set.

  4. Obtain the status values of secondary databases.
    1. Log in to a secondary database.
      1
      /usr/local/mysql/bin/mysql -uroot -p123456 -S /data/mysql/run/mysql.sock
      
    2. Obtain the status values of the secondary database.
      1
      show 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.

  5. 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.