Linux下多线程下载工具MWget和Axel使用介绍

时间:2021-05-24

linux运维在操作linux过程中,用得最多的linux下载工具想必一定是wget,没有看到哪一台服务器没装过wget的,或许有人使用ftp下载,也有人使用多线程的axel以及ProZilla,毫无疑问这两个工具都非常的出色,但是对于习惯使用wget的人来说显得不适应,于是老外便开发了多线程版本的wget工具mwget,m表示multi多线程的意思.
mwget
官方地址:http://sourceforge.net/projects/kmphpfm/?source=dlp

复制代码代码如下:
# cd /usr/local/src/
# wget http://jaist.dl.sourceforge.net/project/kmphpfm/mwget/0.1/mwget_0.1.0.orig.tar.bz2
# tar -xjvf mwget_0.1.0.orig.tar.bz2
# cd mwget_0.1.0.orig
# ./configure
# make
# make install
configure过程中如果出现如下错误,请安装大于等于0.35版本的intltool

复制代码代码如下:
checking for intltool >= 0.35.0... ./configure: line 6824: intltool-update: command not found
found
configure: error: Your intltool is too old. You need intltool 0.35.0 or later.
# yum install intltool
wget vs mwget速度测试
以下使用下载2.4.5版本的mongodb来取样.
mwget速度测试

复制代码代码如下:
# mwget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.5.tgz
Begin to download: mongodb-linux-x86_64-2.4.5.tgz
FileSize: 90M
36% [====> =====> ===> ====> ] [ 33M] [2.0M/s] [ETA:00:28]
mwget速度截图如下:

wget速度测试

复制代码代码如下:
# wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.5.tgz
--2013-08-16 10:55:23-- http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.5.tgz
Resolving fastdl.mongodb.org... 54.230.114.206, 54.230.113.36, 54.230.114.144, ...
Connecting to fastdl.mongodb.org|54.230.114.206|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 94827295 (90M) [application/x-tar]
Saving to: “mongodb-linux-x86_64-2.4.5.tgz.1”

6% [==> ] 6,470,547 210K/s eta 6m 26s
wget速度截图如下

mwget用法:

复制代码代码如下:
# mwget -h
GNU MWget 0.1.0 ,a non-interactive and multiline network retriever of all POSTIX Systems.
Usage: mwget [Options]... [URL]...
Options:
-b, --debug Show the debug message
-c, --count=num Set the retry count to [num], no limit when "0", the default is "99"
-d, --directory=dir Set the local direcotry to [dir], the default is "."
-f, --file=file Rename the file to [file]
-h, --help A brief summary of all the options
-i, --interval=num Set the ftp retry interval to [num] seconds, the default is "5"
-n, --number=num Use [num] connections instead of the default (4)
-r, --referer=URL Include `Referer: [URL]' header in HTTP request.
-t, --timeout=num Set the connection timeout to [num] seconds, the default is "30"
-v, --version Show the version of the mwget and exit
-x, --proxy=URL Set the proxy [URL]

Mail bug reports and suggestions to <sa@kmlinux.tk><xiao_suo@hotmail.com>
On website bug reports and suggestions to <http://mwget.sourceforge.net/> <http:///wp-content/uploads/2014/04/<a href="http:///monitor/zabbix/" title="zabbix"target="_blank">zabbix</a>-adduser-01.jpg
Initializing download: http:///wp-content/uploads/2014/04/zabbix-adduser-01.jpg
File size: 73009 bytes
Opening output file zabbix-adduser-01.jpg
Starting download</p><p>root@ttlsa # axel http:///wp-content/uploads/2014/04/zabbix-adduser-01.jpg
Initializing download: http:///wp-content/uploads/2014/04/zabbix-adduser-01.jpg
File size: 73009 bytes
Opening output file zabbix-adduser-01.jpg
Starting download

[ 0%] .......... .......... .......... .......... .......... [ 598.0KB/s]
[ 70%] .......... .......... .
Connection 0 finished

Downloaded 71.3 kilobytes in 0 seconds. (710.02 KB/s)
简单进度条
默认情况下,整个屏幕都是进度条,加上-a参数,进度条类似wget。

复制代码代码如下:
root@ttlsa # axel -a http://mirrors.btte.net/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1.iso
Initializing download: http://mirrors.btte.net/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1.iso
File size: 4467982336 bytes
Opening output file CentOS-6.5-x86_64-bin-DVD1.iso
Starting download</p><p>[ 1%] [0 1 2 3 ] [ 3.2MB/s] [21:47]
下载限速
ttlsa的网站带宽有限制,我要保证下载的同时又不影响用户的访问,例如限制为1MB/s的下载速度,如下可以看到速度基本保证在1MB以内。

复制代码代码如下:
root@ttlsa # axel -s 1024000 http://mirrors.btte.net/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1.iso
Initializing download: http://mirrors.btte.net/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1.iso
File size: 4467982336 bytes
Opening output file CentOS-6.5-x86_64-bin-DVD1.iso
State file found: 30522952 bytes downloaded, 4437459384 to go.
Starting download

,,,,,,,... .......... .......... .......... .......... [ 394.8KB/s]
[ 0%] .......... .......... .......... .......... .......... [ 689.2KB/s]
[ 0%] .......... .......... .......... .......... .......... [ 879.5KB/s]
[ 0%] .......... .......... .......... .......... .......... [ 974.5KB/s]
[ 0%] .......... .......... .......... .......... .......... [1086.4KB/s]
[ 0%] .......... .......... .......... .......... .......... [ 967.5KB/s]
[ 0%] .......... .......... .......... .......... .......... [ 943.8KB/s]
[ 0%] .......... .......... .......... .......... .......... [1021.0KB/s]
[ 0%] .......... .......... .......... .......... .......... [1066.1KB/s]
最后
完成,方法很简单,功能很简单。运维生存时间的服务器以及安装了axel,你的安装了吗?

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章