GreatSQL社区

搜索

reddey

关于pt-archiver使用的注意事项

reddey 已有 2696 次阅读2024-5-30 15:53 |系统分类:运维实战

关于Percona Toolkit 的安装和使用,大家可以看这个链接。

https://greatsql.cn/blog-10-1492.html

但在使用pt-archiver时,有个细节大家要注意。就是在要求实例源表要创建有索引或主键,目的表结构要与源表完全相同。

create table t1 as select * from t where 1=2

pt-archiver --source h=localhost,P=3306,u=root,D=test,t=t  --charset=utf8mb4  --ask-pass --dest t=t1 --where "id<100" --limit 1000 --commit-each       Enter password:

Enter password:

Cannot find an ascendable index in table at /usr/bin/pt-archiver line 3280, line 2.

从提示信息看,源表中没有找到可用索引。

创建索引后,果然可以进行表的归档了。

在使用过程,系统提示where子句一定要有。

最后看一下效果,看一下t1表是不是有数据生成。

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 立即注册

合作电话:010-64087828

社区邮箱:greatsql@greatdb.com

社区公众号
社区小助手
QQ群
GMT+8, 2026-6-14 09:02 , Processed in 0.018774 second(s), 9 queries , Redis On.
返回顶部