How to sync a particular table with same name and

2019-06-03 07:19发布

问题:

pt-table-sync and pt-table-checksum still require the target and destination DBs to be in the same network. Is there an alternative, apart from import/export, replication, and pt-table-sync?

MySQL Version is 5.5 and above.

回答1:

As root:

mysqldump db table | mysql -h1.2.3.4 -uuser -password db

If permission is denied, this should work in the remote database:

GRANT ALL ON *.* TO 'user'@'server1' IDENTIFIED BY 'password';

Automate using crontab or simply use a specialized tool like pt-table-sync --execute h=host1,D=db,t=tbl h=host2

If you can't reach part of your own network, check your subnet masks.