转载:https://tyoung.me/2016/09/use_dsn_method_to_connect_and_check_replicas_when_using_pt-table-checksum/
问题
在使用pt-table-checksum配置主从校验的时候,本地和生产环境都可以正常校验,而在测试环境校验的时候,却输出以下警告信息:
Cannot connect to h=192.168.0.18,p=...,u=pt_table_check
Diffs cannot be detected because no slaves were found. Please read the --recursion-method documentation for information.
pt-table-checksum无法连接从库。
由于没有发现从库,数据校验时无法实时检测从库与主库的数据是否一致(DIFFS列始终为0),需要通过--recursion-method选项指定其他的方式来搜索、连接从库(此处--recursion-method使用的是默认值processlist,hosts)。
原因
执行的详细命令及输出如下:
shell> ./bin/pt-table-checksum --socket=/var/lib/mysql/mysql.sock --user=pt_table_check --password='checksum123' --tables=road_to_dba.test1 --replicate=percona_schema.checksums --no-