欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

129. pt-archiver 归档表报错

程序员文章站 2022-04-17 18:25:04
...

1.项目背景:
对id小于10000的表进行归档
2.pt-archiver 归档表时报错信息如下:
[[email protected] ~]# /usr/bin/pt-archiver --source h=10.0.0.51,D=test,t=t100w,u=cheng,p=123 --dest h=10.0.0.51,D=test,t=test1,u=cheng,p=123 --where 'id<10000' --no-check-charset --no-delete --limit=1000 --commit-each --progress 1000 --statistics
错误信息: Cannot find an ascendable index in table at /usr/bin/pt-archiver line 3233.

3.解决方案:
创建索引

[root@db01 ~]# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 15
Server version: 5.7.26 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> mysql> alter^C
mysql> alter table t100w add index idx(id);
Query OK, 0 rows affected (1.39 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> exit
Bye
[root@db01 ~]# pt-archiver --source h=10.0.0.51,D=test,t=t100w,u=cheng,p=123 --dest h=10.0.0.51,D=test,t=test1,u=cheng,p=123 --where 'id<10000' --no-check-charset --no-delete --limit=1000 --commit-each --progress 1000 --statistics
*******************************************************************
 Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
 is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
 possibly with SSL_ca_file|SSL_ca_path for verification.
 If you really don't want to verify the certificate and keep the
 connection open to Man-In-The-Middle attacks please set
 SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
*******************************************************************
  at /usr/bin/pt-archiver line 4908.
*******************************************************************
 Using the default of SSL_verify_mode of SSL_VERIFY_NONE for client
 is deprecated! Please set SSL_verify_mode to SSL_VERIFY_PEER
 possibly with SSL_ca_file|SSL_ca_path for verification.
 If you really don't want to verify the certificate and keep the
 connection open to Man-In-The-Middle attacks please set
 SSL_verify_mode explicitly to SSL_VERIFY_NONE in your application.
*******************************************************************
  at /usr/bin/pt-archiver line 4908.

# A software update is available:
TIME                ELAPSED   COUNT
2020-01-08T16:06:52       0       0
2020-01-08T16:06:52       0    1000
2020-01-08T16:06:52       0    2000
2020-01-08T16:06:53       0    3000
2020-01-08T16:06:53       0    4000
2020-01-08T16:06:53       0    5000
2020-01-08T16:06:53       0    6000
2020-01-08T16:06:53       1    7000
2020-01-08T16:06:53       1    8000
2020-01-08T16:06:53       1    9000
2020-01-08T16:06:54       1    9999
Started at 2020-01-08T16:06:52, ended at 2020-01-08T16:06:54
Source: D=test,h=10.0.0.51,p=...,t=t100w,u=cheng
Dest:   D=test,h=10.0.0.51,p=...,t=test1,u=cheng
SELECT 9999
INSERT 9999
DELETE 0
Action         Count       Time        Pct
inserting       9999     1.0891      73.31
select            11     0.0242       1.63
commit            22     0.0090       0.60
other              0     0.3632      24.45

4.清理数据:
[[email protected] ~]# pt-archiver --source h=10.0.0.51,D=test,t=t100w,u=cheng,p=123 --where 'id<10000' --purge --limit=1 --no-check-charset

相关标签: DBA