java 多线程wget_mwget 多线程版本wget下载工具

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

1

2

3

4

5

6

7

# 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

1

2

3

4

checkingforintltool>=0.35.0..../configure:line6824:intltool-update:commandnotfound

found

configure:error:Yourintltoolistooold. Youneedintltool0.35.0orlater.

# yum install intltool

wgetvs mwget速度测试

以下使用下载2.4.5版本的mongodb来取样.

2.1 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]

1

2

3

4

# mwget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.5.tgz

Begintodownload:mongodb-linux-x86_64-2.4.5.tgz

FileSize: 90M

36%[====>        =====>       ===>         ====>         ][33M][2.0M/s][ETA:00:28]

mwget速度截图如下:

5d3b6cdaae332091b2edbfa8967be0d6.png

mwget多线程下载速度

2.2 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

1

2

3

4

5

6

7

8

9

# wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.5.tgz

--2013-08-1610:55:23-- http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.4.5.tgz

Resolvingfastdl.mongodb.org...54.230.114.206,54.230.113.36,54.230.114.144,...

Connectingtofastdl.mongodb.org|54.230.114.206|:80...connected.

HTTPrequestsent,awaitingresponse...200OK

Length:94827295(90M)[application/x-tar]

Savingto:“mongodb-linux-x86_64-2.4.5.tgz.1”

6%[==>                                               ]6,470,547   210K/s eta6m26s

wget速度截图如下

3fc679d274331eed18b5f494a0f1d801.png

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

On website bug reports and suggestions to

We Welcome your BUG REPORT!

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

# mwget -h

GNUMWget0.1.0,anon-interactiveandmultilinenetworkretrieverofallPOSTIXSystems.

Usage: mwget [Options]...[URL]...

Options:

-b, --debug         Showthedebugmessage

-c, --count=num     Settheretrycountto[num],nolimitwhen"0",thedefaultis"99"

-d, --directory=dir Setthelocaldirecotryto[dir],thedefaultis"."

-f, --file=file     Renamethefileto[file]

-h, --help          Abriefsummaryofalltheoptions

-i, --interval=num  Settheftpretryintervalto[num]seconds,thedefaultis"5"

-n, --number=num    Use[num]connectionsinsteadofthedefault(4)

-r, --referer=URL   Include`Referer:[URL]'headerinHTTPrequest.

-t, --timeout=num   Settheconnectiontimeoutto[num]seconds,thedefaultis"30"

-v, --version       Showtheversionofthemwgetandexit

-x, --proxy=URL     Settheproxy[URL]

Mailbugreportsandsuggestionsto

Onwebsitebugreportsandsuggestionsto

WeWelcomeyourBUGREPORT!

总结

mwget虽然功能偏少,并且无法完全替代单线程版本的wget,但是对于我们基本只是用wget简单下载运维人员来说,mwget绝对是个完好的选择.

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值