日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

mysql pt table sync_pt-table-sync 使用介绍

發布時間:2023/11/27 生活经验 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql pt table sync_pt-table-sync 使用介绍 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

pt-table-sync:對兩個庫不一致的數據進行同步,他能夠自動發現兩個實例間不一致的數據,然后進行sync操作,pt-table-sync無法同步表結構,和索引等對象,只能同步數據

一、表沒有主鍵

--print

./pt-table-sync --ignore-databases=mysql,sys --no-check-slave dsn=u=checkq,p=123456,h=192.168.56.108,P=3306 dsn=u=checkq,p=123456,h=192.168.56.101,P=3306 --databases=bhs --tables=pp --print

INSERT INTO bhs.pp(id, name) VALUES ('1', 'ee') /percona-toolkit src_db:bhs src_tbl:pp src_dsn:P=3306,h=192.168.56.108,p=...,u=checkq dst_db:bhs dst_tbl:pp dst_dsn:P=3306,h=192.168.56.101,p=...,u=checkq lock:0 transaction:1 changing_src:0 replicate:0 bidirectional:0 pid:3704 user:root host:managed/;

--execute

./pt-table-sync --ignore-databases=mysql,sys --no-check-slave h=192.168.56.108,u=checkq,p=123456,P=3306 h=192.168.56.101,u=checkq,p=123456,P=3306 --databases=bhs --tables=pp --execute --print

INSERT INTO bhs.pp(id, name) VALUES ('1', 'ee') /percona-toolkit src_db:bhs src_tbl:pp src_dsn:P=3306,h=192.168.56.108,p=...,u=checkq dst_db:bhs dst_tbl:pp dst_dsn:P=3306,h=192.168.56.101,p=...,u=checkq lock:0 transaction:1 changing_src:0 replicate:0 bidirectional:0 pid:3747 user:root host:managed/;

二、表有主鍵

--print

./pt-table-sync --sync-to-master --charset=utf8 --ignore-databases=mysql,sys --no-check-slave h=192.168.56.101,u=checkq,p=123456,P=3306 --databases=bhs --tables=test --print

REPLACE INTO bhs.test(id, name) VALUES ('3', 'd') /percona-toolkit src_db:bhs src_tbl:test src_dsn:A=utf8,P=3306,h=192.168.56.108,p=...,u=checkq dst_db:bhs dst_tbl:test dst_dsn:A=utf8,P=3306,h=192.168.56.101,p=...,u=checkq lock:1 transaction:1 changing_src:1 replicate:0 bidirectional:0 pid:3768 user:root host:managed/;

./pt-table-sync --execute --sync-to-master --charset=utf8 --ignore-databases=mysql,sys --no-check-slave h=192.168.56.101,u=checkq,p=123456,P=3306 --databases=bhs --tables=test --print

REPLACE INTO bhs.test(id, name) VALUES ('3', 'd') /percona-toolkit src_db:bhs src_tbl:test src_dsn:A=utf8,P=3306,h=192.168.56.108,p=...,u=checkq dst_db:bhs dst_tbl:test dst_dsn:A=utf8,P=3306,h=192.168.56.101,p=...,u=checkq lock:1 transaction:1 changing_src:1 replicate:0 bidirectional:0 pid:3775 user:root host:managed/;

總結

以上是生活随笔為你收集整理的mysql pt table sync_pt-table-sync 使用介绍的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。