./gt-checksum -S type=mysql,user=dba_test,passwd=123,host=172.2.1.4,port=3306,charset=utf8mb4 -D type=mysql,user=dba_test,passwd=123,host=172.1.0.10,port=3306,charset=utf8mb4 -t ues.*
-- gt-checksum init configuration files --
-- gt-checksum init log files --
-- gt-checksum init check parameter --
-- gt-checksum init check table name --
-- gt-checksum init check table column --
-- gt-checksum init check table index column --
-- gt-checksum init source and dest transaction snapshoot conn pool --
-- gt-checksum init cehck table query plan and check data --
** gt-checksum Overview of results **
Check time: 0.22s (Seconds)
Schema Table IndexCol checkMod Rows Differences Datafix
补充:源端是云上MySQL, 目标端是云下MySQL
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
看打印的信息,表名都没有获取到
在命令行里设置 --ll=debug
看看更多输出日志内容是怎样的
./gt-checksum -S type=mysql,user=dba_test,passwd=123,host=172.2.1.4,port=3306,charset=utf8mb4 -D type=mysql,user=dba_test,passwd=123,host=172.1.0.10,port=3306,charset=utf8mb4 --ll=debug -t ues.*
-- gt-checksum init configuration files --
-- gt-checksum init log files --
-- gt-checksum init check parameter --
-- gt-checksum init check table name --
-- gt-checksum init check table column --
-- gt-checksum init check table index column --
-- gt-checksum init source and dest transaction snapshoot conn pool --
-- gt-checksum init cehck table query plan and check data --
** gt-checksum Overview of results **
Check time: 0.26s (Seconds)
Schema Table IndexCol checkMod Rows Differences Datafix
分析日志中,有一段获取字段索引的SQL,table_schema和table_name不应该传入大写,大写的查询结果是空。应该传入小写。小写是有结果集的。
[2023/04/17 01:52:05] [debug] my_query_table_date.go:24 (24) [Q_Index_Statistics] Generate a sql statement to query the index statistics of table UES.UES_ENCRYPT_VERSION under the MySQL database.sql messige is {select isc.COLUMN_NAME as columnName,isc.COLUMN_TYPE as columnType,isc.COLUMN_KEY as columnKey,isc.EXTRA as autoIncrement,iss.NON_UNIQUE as nonUnique,iss.INDEX_NAME as indexName,iss.SEQ_IN_INDEX IndexSeq,isc.ORDINAL_POSITION columnSeq from information_schema.columns isc inner join (select NON_UNIQUE,INDEX_NAME,SEQ_IN_INDEX,COLUMN_NAME from information_schema.STATISTICS where table_schema='UES' and table_name='UES_ENCRYPT_VERSION') as iss on isc.column_name =iss.column_name where isc.table_schema='UES' and isc.table_name='UES_ENCRYPT_VERSION';}
[2023/04/17 01:52:05] [debug] my_query_table_date.go:34 (24) [Q_Index_Statistics] The index statistics query of table UES.UES_ENCRYPT_VERSION under the MySQL database is completed. index statistics is {[]}
[2023/04/17 01:52:05] [debug] schema_tab_struct.go:575 (23) Table UES.UES_ENCRYPT_VERSION index list information query completed. index list message is {map[]}
[2023/04/17 01:52:05] [warn] schema_tab_struct.go:580 (23) The current table UES.UES_ENCRYPT_VERSION has no index.
(root@localhost) [(none)] 02:16: > select isc.COLUMN_NAME as columnName,
-> isc.COLUMN_TYPE as columnType,
-> isc.COLUMN_KEY as columnKey,
-> isc.EXTRA as autoIncrement,
-> iss.NON_UNIQUE as nonUnique,
-> iss.INDEX_NAME as indexName,
-> iss.SEQ_IN_INDEX IndexSeq,
-> isc.ORDINAL_POSITION columnSeq
-> from information_schema.columns isc inner join
-> (select NON_UNIQUE,INDEX_NAME,SEQ_IN_INDEX,COLUMN_NAME
-> from information_schema.STATISTICS
-> where table_schema='UES'
-> and table_name='UES_ENCRYPT_VERSION')
-> as iss
-> on isc.column_name =iss.column_name
-> where isc.table_schema='UES'
-> and isc.table_name='UES_ENCRYPT_VERSION';
Empty set (0.00 sec)
(root@localhost) [(none)] 02:20: > select isc.COLUMN_NAME as columnName,
-> isc.COLUMN_TYPE as columnType,
-> isc.COLUMN_KEY as columnKey,
-> isc.EXTRA as autoIncrement,
-> iss.NON_UNIQUE as nonUnique,
-> iss.INDEX_NAME as indexName,
-> iss.SEQ_IN_INDEX IndexSeq,
-> isc.ORDINAL_POSITION columnSeq
-> from information_schema.columns isc inner join
-> (select NON_UNIQUE,INDEX_NAME,SEQ_IN_INDEX,COLUMN_NAME
-> from information_schema.STATISTICS
-> where table_schema='ues'
-> and table_name='ues_encrypt_version')
-> as iss
-> on isc.column_name =iss.column_name
-> where isc.table_schema='ues'
-> and isc.table_name='ues_encrypt_version';
+-------------+-------------+-----------+---------------+-----------+----------------+----------+-----------+
| columnName | columnType | columnKey | autoIncrement | nonUnique | indexName | IndexSeq | columnSeq |
+-------------+-------------+-----------+---------------+-----------+----------------+----------+-----------+
| id | bigint(20) | PRI | | 0 | PRIMARY | 1 | 1 |
| key_version | varchar(64) | UNI | | 0 | uk_key_version | 1 | 2 |
+-------------+-------------+-----------+---------------+-----------+----------------+----------+-----------+
2 rows in set (0.00 sec)
查看一下数据库是否开启了区分大小写参数,如果开启了,需要指定一下gt-checksum的区分大小写参数,否则默认会转换成大写
嗯,用配置文件的方式指定参数大写运行成功。但是用命令行方式,lowerCaseTableNames=yes 这个参数放在前面或者放在后面都不能成功执行
缺少-吧,示例: go run .\greatdbCheck.go -S type=mysql,user=pcms,passwd=xxx,host=172.17.140.xxx,port=3307 -D type=mysql,user
=pcms,passwd=xxx,host=172.17.140.xxx,port=3307 -t scott.bmsql_item1 -nit yes -lowerCaseTableNames=yes
登录 后才可以发表评论