pv是一款Liunx下的限流工具,可以使用该工具查看任务进度,传输速率,使用时间以及预估完成时间,还能限制传输速率
# 我的MySQL数据库中有张表t,数据量如下
wing@3306>select count(*) from t;
+----------+
| count(*) |
+----------+
| 25165824 |
+----------+
1 row in set (10.94 sec)
[root@wing wing]# du -h t.*
12K t.frm
741M t.ibd
# 此时我不使用pv工具完成该表的备份,在无任何输出的界面上等待一段时间
[root@wing ~]# mysqldump -uroot -P3306 -h127.0.0.1 wing t > dump.sql
[root@wing ~]#
# 此时我使用pv工具完成该表的备份,我们可以看到文件已经传输的大小,使用时间,传输速率,已经进度条(感觉进度条不是特别准确的样子)
[root@wing ~]# mysqldump -uroot -P3306 -h127.0.0.1 wing t | pv > dump.sql
429MiB 0:00:32 [13.1MiB/s] [ <=> ]
Usage: pv [OPTION] [FILE]…Concatenate FILE(s), or standard input, to standard output,with monitoring.
show progress bar显示进度条(目测不是很准的样子==)(默认)
show elapsed time显示任务已经进行的时长(默认)
show estimated time of arrival (completion)显示剩余多长时间完成(默认,但好像并不能显示)
show data transfer rate counter显示当前传输速率(默认)
show data transfer average rate counter显示平均传输速率
show number of bytes transferred
set output format to FORMAT
output percentages, not visual information显示进度百分比
do not output any transfer information at all不输出任何信息
display nothing until first byte transferred
set estimated data size to SIZE bytes
count lines instead of bytes
update every SEC seconds
assume terminal is WIDTH characters wide
assume terminal is HEIGHT rows high
prefix visual information with NAME
output even if standard error is not a terminal
use cursor positioning escape sequences
limit transfer to RATE bytes per second限制每秒的传输速率,RATE可为n,nK,nM,nG
use a buffer size of BYTES
skip read errors in input
stop after –size bytes have been transferred
update settings of process PID
save process ID in FILE
show this help and exit
show version information and exit
Please report any bugs to Andrew Wood andrew.wood@ivarch.com .