pt-table-sync 配合pt-table-checksum 修复主从不一致

pt-table-sync 配合pt-table-checksum 修复主从不一致。

先执行下面这条语句,打印出要执行的命令,确认无误后再将  --print  改为  --execute 执行。注意:登录信息指定为从库的信息

pt-table-sync --sync-to-master --print  --databases=test h=192.168.0.117,u=root,p='115433',P=19102

下面这条命令会直接执行

pt-table-sync --sync-to-master --execute --databases=test h=192.168.0.117,u=root,p='115433',P=19102

--replicate= :指定通过pt-table-checksum得到的表.
--databases= : 指定执行同步的数据库,多个用逗号隔开。
--tables= :指定执行同步的表,多个用逗号隔开。
--sync-to-master :指定一个DSN,即从的IP,他会通过show processlist或show slave status 去自动的找主。
h=127.0.0.1 :服务器地址,命令里有2个ip,第一次出现的是Master的地址,第2次是Slave的地址。
u=root :帐号。
p=123456 :密码。
--print :打印,但不执行命令。
--execute :执行命令。

猜你喜欢

转载自www.cnblogs.com/cmgg/p/11585718.html