How to sync a particular table with same name and database name between two different independent networks where replication is not possible?

青春壹個敷衍的年華 提交于 2019-12-08 04:16:03

问题


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.



来源:https://stackoverflow.com/questions/28960435/how-to-sync-a-particular-table-with-same-name-and-database-name-between-two-diff

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!