pt-archiver 数据归档bug
生活随笔
收集整理的這篇文章主要介紹了
pt-archiver 数据归档bug
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
2019獨角獸企業重金招聘Python工程師標準>>>
前言:今天在進行線上數據庫數據歸檔的時候發現個問題,ID最大的那一列數據沒有歸檔到其他實例,下面是現場及解決辦法
?
現場:
root@localhost:mysql.sock 10:18:07 [tom]>select count(*) from test; +----------+ | count(*) | +----------+ | 88787 | +----------+ 1 row in set (0.09 sec)[root@redis02 ~]# pt-archiver --source h=10.0.0.6,u=root,p=123456,D=tom,t=test,A=utf8 --dest h=10.0.0.7,P=3306,D=tom,t=test --where "1=1" --share-lock --statistics --progress 5000 --limit 5000 --txn-size 5000 TIME ELAPSED COUNT 2017-07-25T10:36:54 0 0 2017-07-25T10:37:07 13 5000 2017-07-25T10:37:21 26 10000 2017-07-25T10:37:36 42 15000 2017-07-25T10:37:50 55 20000 2017-07-25T10:38:02 67 25000 2017-07-25T10:38:14 80 30000 2017-07-25T10:38:26 92 35000 2017-07-25T10:38:39 105 40000 2017-07-25T10:38:52 117 45000 2017-07-25T10:39:03 129 50000 2017-07-25T10:39:15 141 55000 2017-07-25T10:39:27 152 60000 2017-07-25T10:39:38 164 65000 2017-07-25T10:39:51 177 70000 2017-07-25T10:40:04 189 75000 2017-07-25T10:40:16 202 80000 2017-07-25T10:40:29 214 85000 2017-07-25T10:40:38 224 88786 Started at 2017-07-25T10:36:54, ended at 2017-07-25T10:40:38 Source: A=utf8,D=tom,h=10.0.0.6,p=...,t=test,u=root Dest: A=utf8,D=tom,P=3306,h=10.0.0.7,p=...,t=test,u=root SELECT 88786 INSERT 88786 DELETE 88786 Action Count Time Pct deleting 88786 122.6957 54.70 inserting 88786 66.5441 29.67 select 19 2.0529 0.92 commit 36 0.4159 0.19 other 0 32.5878 14.53root@localhost:mysql.sock 10:40:51 [tom]>select * from test; +-------+------------+------+---------------------+ | id | name | age | createtime | +-------+------------+------+---------------------+ | 88787 | hello88787 | 83 | 2017-07-19 17:24:21 | +-------+------------+------+---------------------+ 1 row in set (0.00 sec)what?居然有一條還在,看下pt-archiver相關代碼
6257 $first_sql .= " AND ($col < " . $q->quote_val($val) . ")";把這個修改一下,讓它小于等于就ok了
6257 $first_sql .= " AND ($col <= " . $q->quote_val($val) . ")";然后重新執行
[root@redis02 ~]# pt-archiver --source h=10.0.0.7,u=root,p=123456,D=tom,t=test,A=utf8 --dest h=10.0.0.6,P=3306,D=tom,t=test --where "1=1" --statistics --progress 10000 --limit 10000 --txn-size 5000 --no-delete TIME ELAPSED COUNT 2017-07-25T10:58:48 0 0 2017-07-25T10:59:00 12 10000 2017-07-25T10:59:10 22 20000 2017-07-25T10:59:19 30 30000 2017-07-25T10:59:32 44 40000 2017-07-25T10:59:46 58 50000 2017-07-25T11:00:00 72 60000 2017-07-25T11:00:12 84 70000 2017-07-25T11:00:24 96 80000 2017-07-25T11:00:36 108 88786 Started at 2017-07-25T10:58:48, ended at 2017-07-25T11:00:36 Source: A=utf8,D=tom,h=10.0.0.7,p=...,t=test,u=root Dest: A=utf8,D=tom,P=3306,h=10.0.0.6,p=...,t=test,u=root SELECT 88786 INSERT 88786 DELETE 0 Action Count Time Pct inserting 88786 88.3225 81.45 select 10 0.4881 0.45 commit 36 0.2246 0.21 other 0 19.4023 17.89ok ?,至此問題完美解決
為了方便大家交流,本人開通了微信公眾號,和QQ群291519319。喜歡技術的一起來交流吧
轉載于:https://my.oschina.net/u/3023401/blog/1486759
總結
以上是生活随笔為你收集整理的pt-archiver 数据归档bug的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: nginx虚拟目录实现两个后台使用
- 下一篇: 中间件(1)分布式缓存