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

"no slaves were found" Is Displayed During Data Consistency Verification Between MySQL Primary and Secondary Databases

Symptom

"no slaves were found" is displayed during verification of data consistency between MySQL primary and secondary databases.

Key Process and Cause Analysis

The show slave hosts command executed on the primary database fails to obtain the IP address of the secondary database. You need to add the IP address of the secondary database to the report-host item in the configuration file of the secondary database.

Conclusion and Solution

  1. Log in to the primary database and query the secondary database information. In the command output, the Host column is empty.
    show slave hosts;

  2. Ensure that the data in the primary and secondary databases is consistent.
  3. Shut down the secondary and primary databases in sequence.
  4. Add report_host=IP_address to the my.cnf configuration files of the primary and secondary databases. Enter the actual IP addresses of the primary and secondary databases.
    vim /etc/my.cnf
  5. Press i to enter the insert mode and add report_host=IP_address to the file.

  6. Press Esc, type :wq!, and press Enter to save the file and exit.
  7. Start the primary and secondary databases in sequence. Ensure that the primary/secondary relationship is set up.
  8. Log in to the primary database and query the secondary database information. The value of Host is the IP address of the secondary database.
    show slave hosts;