使用pv命令限制SQL文本导入速度

使用pv命令限制SQL文本导入速度

1.直接导入

[root@mdb01 tmp]# cat test.sql |mysql3306 test02

mysql: [Warning] Using a password on the command line interface can be insecure.

导入期间会消耗比较大的CPU

2.pv限速

[root@mdb01 tmp]# pv -L100K test.sql | mysql3306 test02      

mysql: [Warning] Using a password on the command line interface can be insecure.

700kiB 0:00:07 [ 100kiB/s] [>                                     ]  1% ETA 0:06:20

pv限速之后,消耗资源明显减少,-L参数限制在100K,其中:

700kiB :已完成数据大小

0:00:07:执行时间

[ 100kiB/s] :平均速率

[>                                     ]  1%:工作进度

ETA 0:06:20:预估时间


请使用浏览器的分享功能分享到微信等