--slave-to-host
同步到主机,如果被指定的话,则只能有一个SLAVE DSN,slave会自动发现它自己的master,且会将该SLAVE的数据同步与MASTER保持一致;
通过修改master程序,然后master-slave机制会自动同步至slave;
--execute
Execute queries to make the tables have identical data.
使更改生效
--lock
type: int
Lock tables: 0=none, 1=per sync cycle, 2=per table, or 3=globally.
This uses "LOCK TABLES". This can help prevent tables being changed while you’re examiningthem.
是否锁表:0不锁;
1,只锁检查的块,检查完毕解锁,为下个块加锁
2, 加锁和解锁每单个要检查的表
3, 使用命令FLUSH TABLES WITH READ LOCK进行全局读锁定;
Printqueries that will resolve differences
If you don’t trust"pt-table-sync", or just want to see what it will do, this is a goodway to be safe. These queries are validSQL and you can run them yourself if you want to sync the tables manually.
如果有print, 则输出的结果将会打印出待执行的REPLACE命令;
--[no]transaction
Use transactions instead of "LOCKTABLES".
It currently uses transactions on InnoDBtables, and table locks on all others.
--verbose
Print results of sync operations.输出表的差异数据;
--wait
How long to wait for slaves to catch up totheir master.
同步的时候,Master等待Slave赶上的时间,单位秒,
DSN
"option=value”, "option=value”,…
"—replicate
如果用replicate参数,前提是已经用checksum发现了差异;
同步slave server 至Master:
pt-table-sync --execute --verbose --print--sync-to-master --databases itdb h=10.8.135.156,u=copy2,p=jsddwcc
处理pt-table-checksum发现的所有差异数据,同步所有SLAVE:
pt-table-sync --execute --replicatepercona.checksums h=10.8.135.157,P=3306,u=copy2,p=jsddwcc
处理pt-table-checksum发现的所有差异数据,功能同上,只处理指定的slave
pt-table-sync --execute --replicatepercona.checksums --sync-to-master h=10.8.135.156,u=copy2,p=jsddwcc
pt-table-sync --execute --sync-to-master --charset=utf8dsn=u=root,p=root,h=172.172.178.76,P=3306 –print
pt-table-sync --execute --sync-to-master --lock1 --verbose --print --charset=utf8 --databases itdbu=copy2,p=jsddwcc,h=10.8.135.156,P=3306