当前位置: 首页 > 工具软件 > rtorrent > 使用案例 >

linux bt速度快,linux bt速度之王—— rtorrent

乐正心思
2023-12-01

1. Rtorrent的特点

•BT下载 - 高速占内存少而且功能强大,绝不是mldonkey比得上的,mldonkey下电驴还可以考虑,bt的话还是闪一边去吧

速度比拼, 2M/512kbps ADSL

enhanced ctorrent: 80 KB/s             mldonkey: 40 KB/s          rtorrent: 233 KB/s

o支持协议加密,防止ISP封BT

o支持peer交换,客户端之间交换peer,让每个客户可以连上更多的客户

o支持多Tracker协议, UDP Tracker

o支持选择文件下载,以及调整下载优先级

o支持通过DHT网络实现无种下载

o支持快速恢复(Fast Resume),下载中断后无需重新hash,节约时间

o支持nTorrent(windows)远程控制

2.Rtorrent DHT版本的安装

这个是在oleg optware上运行的,所以必须要先安装oleg optware才能进行后续工作,执行

ipkg update(如果无法运行,则使用/opt/bin/ipkg update,下同)

ipkg install rtorrent

【历史】由于nslu2 optware的官方的svn已经更新,从记录上看,源中的libtorrent和rtorrent已经提供了DHT,所以无需再下载附件中的文件(已删除)。不过以后如果rtorrent有新的功能,也会提前放出来给大家尝鲜,感谢大家的支持

-----------------------------optware 官方更新记录-------------------------------------------

r7590 | oleo | 2008-01-16 14:54:55 +0800 (Wed, 16 Jan 2008) | 1 line

rtorrent: 0.7.9->r1027 with DHT - startup script by al37919

3. Rtorrent DHT版的配置

配置文件应该在/opt/etc下可以找到一个名叫rtorrent.conf的文件,可以在这个文件的基础上做修改,下面是一个例子,#号后面的是注释,不用管他,蓝色标出的是比较重要的配置

##################################     配置文件开始    ####################################

# This is an example resource file for rTorrent. Copy to

# ~/.rtorrent.rc and enable/modify the options as needed. Remember to

# uncomment the options you wish to enable.

# 每个torrent文件允许连接的最大以及最小的peer的数目

min_peers = 40

max_peers = 250

# Same as above but for seeding completed torrents (-1 = same as downloading)

#min_peers_seed = 10

#max_peers_seed = 50

# Maximum number of simultanious uploads per torrent.

max_uploads = 15

# 全局上传和下载速率,单位是KB. "0" 代表无限制

download_rate = 75

upload_rate = 28

# 默认下载目录,下载好的文件会放到这里

directory = /opt/downloads

# Default session directory. Make sure you don't run multiple instance

# of rtorrent using the same session directory. Perhaps using a

# relative path?

session = /opt/downloads/.session

# 下面是一个非常有用的功能:监视目录

#放在/opt/torrent目录底下的torrent文件会自动开始下载

#配置好监视目录以后,只要通过samba或scp往这个目录传种子,就会自动开始下载

schedule = watch_directory,5,5,load_start=/opt/torrent/*.torrent

#schedule = untied_directory,5,5,stop_untied=

# Close torrents when diskspace is low.

#schedule = low_diskspace,5,60,close_low_diskspace=100M

# Stop torrents when reaching upload ratio in percent,

# when also reaching total upload in bytes, or when

# reaching final upload ratio in percent.

# example: stop at ratio 2.0 with at least 200 MB uploaded, or else ratio 20.0

#schedule = ratio,60,60,stop_on_ratio=200,200M,2000

# The ip address reported to the tracker.

#ip = 127.0.0.1

#ip = rakshasa.no

# The ip address the listening socket and outgoing connections is

# bound to.

#bind = 127.0.0.1

#bind = rakshasa.no

# Port range to use for listening.

#port_range = 6890-6999

# Start opening ports at a random position within the port range.

#port_random = no

# Check hash for finished torrents. Might be usefull until the bug is

# fixed that causes lack of diskspace not to be properly reported.

#check_hash = no

# 是否使用UDP trackers,建议选yes

use_udp_trackers = yes

# Alternative calls to bind and ip that should handle dynamic ip's.

#schedule = ip_tick,0,1800,ip=rakshasa

#schedule = bind_tick,0,1800,bind=rakshasa

# 是否允许协议加密,建议改成allow_incoming,enable_retry,prefer_plaintext的组合体,具体原因就不解释了

# allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext

#

# The example value allows incoming encrypted connections, starts unencrypted

# outgoing connections but retries with encryption if they fail, preferring

# plaintext to RC4 encryption after the encrypted handshake

#

encryption = allow_incoming,enable_retry,prefer_plaintext

#

# Do not modify the following parameters unless you know what you're doing.

#

# Hash read-ahead controls how many MB to request the kernel to read

# ahead. If the value is too low the disk may not be fully utilized,

# while if too high the kernel might not be able to keep the read

# pages in memory thus end up trashing.

#hash_read_ahead = 10

# Interval between attempts to check the hash, in milliseconds.

#hash_interval = 100

# Number of attempts to check the hash while using the mincore status,

# before forcing. Overworked systems might need lower values to get a

# decent hash checking rate.

#hash_max_tries = 10

# Max number of files to keep open simultaniously.

#max_open_files = 128

# Number of sockets to simultaneously keep open.

#max_open_sockets = # Example of scheduling commands: Switch between two ip's every 5

# seconds.

#schedule = "ip_tick1,5,10,ip=torretta"

#schedule = "ip_tick2,10,10,ip=lampedusa"

# Remove a scheduled event.

#schedule_remove = "ip_tick1"

#选择utf-8可以在samba中看到中文

encoding_list = UTF-8

#rtorrent创建的文件夹(或文件)的权限,默认是0644,建议改成0000(感谢xuanwuhu),使所有用户都能访问。

#也只有这样在samba中才可以直接打开、拷贝、删除rtorrent创建的文件

umask = 0000

#下面两个选项打开dht的功能,照做即可,另外如果想让 rtorrent 在启动的时候就使用 DHT,可以把dht=auto改为dht=on

dht = auto

dht_port = 6778

#允许peer交换,当然允许了,多多益善啊

peer_exchange = yes

#最后这个参数和web配置以及远程管理有关,稍后再介绍

scgi_port = :5000

##################################     配置文件结束   ####################################

这个配置文件默认放在用户的HOME目录中,因此建议执行以下操作

mkdir /opt/root

export HOME=/opt/root

将以上配置文件更名为.rtorrent.rc,放在/opt/root目录底下

最后在telnet中敲入rtorrent(也可能要输入/opt/bin/rtorrent),就能启动rtorrent,此时往监视目录中放一个torrent文件,就会开始下载,此时注意页面下方是否出现

(14:31:09) Starting DHT server on port 6778.的字样,如果有说明DHT配置成功了

为了达到更好的下载效果,需要在7231-4P或WL500gP的上一级路由上做端口映射(如果是7231-4P或WL500gP直接拨号的话,就不需要了),另外,如果在7231-4P或WL500gP上下载,必须要把iptables的INPUT链的对应的端口打开,可以在ddwrt的启动脚本中加入

iptables -I INPUT 1 -p tcp --dport 1024:10000 -j ACCEPT

iptables -I INPUT 1 -p udp --dport 1024:10000 -j ACCEPT

4. Rtorrent 的使用和管理

rtorrent我个人认为有三种使用方法,1. screen + 监视目录 2.ntorrent远程GUI管理 3.web管理,我个人认为第一种方法是最方便的而且耗资源最少的方法

方法1.screen + 监视目录

这种方法通过监视目录的方式添加种子,然后使用screen进行管理,screen的最最简单用法见本帖第2页56楼

rtorrent的使用方法见下面两篇帖

繁体中文http://discuz.orz101.com/viewthr ... &extra=page%3D1

英文

方法2.ntorrent远程GUI管理

第一步,先对rtorrent配置文件做一些修改,注释掉scgi_port = :5000这一行(前面加#),加入下面这行

scgi_local = /opt/var/run/rpc.socket

第二步,安装lighttpd

ipkg install lighttpd

第三步,修改lighttpd配置文件,使用编辑器编辑/opt/etc/lighttpd/lighttpd.conf

首先在server.modules中加入一行

server.modules              = (

#                               "mod_rewrite",

#                               "mod_redirect",

#                               "mod_alias",

"mod_access",

#                               "mod_cml",

#                               "mod_trigger_b4_dl",

#                               "mod_auth",

#                               "mod_status",

#                               "mod_setenv",

#                               "mod_fastcgi",

#                               "mod_proxy",

#                               "mod_simple_vhost",

#                               "mod_evhost",

#                               "mod_userdir",

#                               "mod_cgi",

#                               "mod_compress",

#                               "mod_ssi",

#                               "mod_usertrack",

#                               "mod_expire",

#                               "mod_secdownload",

#                               "mod_rrdtool",

"mod_accesslog",                                         "mod_scgi")

然后在lighttpd.conf的最后加上

scgi.server = (

"/RPC2" =>

( "127.0.0.1" =>

(

"socket" => "/opt/var/run/rpc.socket",

"check-local" => "disable",

"disable-time" => 0, # don't disable scgi if connection fails

)

)

)

保存退出。

第四步,重启rtorrent和lighttpd

/opt/etc/init.d/S80lighttpd stop

/opt/etc/init.d/S80lighttpd start

killall rtorrent

rtorrent

第五步,在windows上安装ntorrent

进入,点右侧下载nTorrent-bin-20071220.tar.bz2(需要安装java运行库)

双击nTorrent.jar启动ntorrent,在登录窗口选择

protocol : http

host : 你的7231-4P,WL500g或者MSS的IP

port : 8081 (可以在/opt/etc/lighttpd/lighttpd.conf中修改成其他的,默认是这个)

mountpoint : /RPC2

最底下用户名和密码不填,点save然后点connect,如果能连上就可以使用ntorrent远程控制了

方法3.web管理

待续

[本帖最后由 hlidea 于 2008-1-21 09:08 编辑]

 类似资料: