Percona 的 pt-table-sync:如何在多个表上运行?

2024-03-13

在命令行中,这将成功更新 table1:

pt-table-sync --execute h=host1,D=db1,t=table1 h=host2,D=db2

但是,如果我想更新多个表,我不知道如何编写它。这也只更新 table1 并忽略其他表:

pt-table-sync --execute h=host1,D=db1,t=table1,table2,table3 h=host2,D=db2

这给了我一个错误:

pt-table-sync --execute h=host1,D=db1 --tables table1,table2,table3 h=host2,D=db2

任何人都有如何列出“-tables”的示例...以便成功更新列表中的所有表?


The --tables选项似乎与 DSN 表示法不兼容,您会收到此错误:

您在 h=localhost,D=test 中指定了数据库,但未指定表。
您是否尝试仅同步“测试”数据库中的表?
如果是这样,请改用“--databases test”。

正如该错误消息中所建议的,您可以使用--databases然后你可以使用--tables成功地。

例如,我创建了表test.foo and test.bar,每行填充三行,然后从中删除行test.bar在第二台服务器杜威上。

我跑了这个:

$ pt-table-sync h=huey h=dewey --databases test --tables foo,bar --execute --verbose

# Syncing h=dewey
# DELETE REPLACE INSERT UPDATE ALGORITHM START    END      EXIT DATABASE.TABLE
#      0       0      3      0 Chunk     15:26:15 15:26:15 2    test.bar
#      0       0      0      0 Chunk     15:26:15 15:26:15 0    test.foo

它成功地重新插入了 3 个缺失的行test.bar.

我的其他表test数据库被忽略。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Percona 的 pt-table-sync:如何在多个表上运行? 的相关文章

随机推荐