Percona的pt-table-sync:如何在多个表上运行? [英] Percona's pt-table-sync: how to run on more than one table?

查看:81
本文介绍了Percona的pt-table-sync:如何在多个表上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

In the command line, this will successfully update table1:

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

但是,如果我要更新多个表,则不确定如何编写.这也只会更新table1,而忽略其他表:

However if I want to update more than one table, I'm not sure how to write it. This only updates table1 as well and ignores the other tables:

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'...的示例,以便它成功更新列表中的所有表吗?

Anyone have an example of how to list the '-tables'... so that it successfully update all the tables in the list?

推荐答案

-tables 选项似乎与DSN表示法不兼容,出现此错误:

The --tables option seems to be incompatible with the DSN notation, you get this error:

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

You specified a database but not a table in h=localhost,D=test.
Are you trying to sync only tables in the 'test' database?
If so, use '--databases test' instead.

如该错误消息中所建议,您可以使用-数据库,然后可以成功使用-tables .

As suggested in that error message, you can use --databases and then you can use --tables successfully.

例如,我创建了表 test.foo test.bar ,每个表都填充了三行,然后从 test.bar 杜威.

For example, I created tables test.foo and test.bar, filled each with three rows, then deleted the rows from test.bar on the second server dewey.

我跑了这个

$ 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

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

It successfully re-inserted the 3 missing rows in test.bar.

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

Other tables in my test database were ignored.

这篇关于Percona的pt-table-sync:如何在多个表上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆