1 Star 0 Fork 39

wenjie / Dodder

forked from xwlcn / Dodder 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT
        ________      _________________
___  __ \___________  /_____  /____________
__  / / /  __ \  __  /_  __  /_  _ \_  ___/
_  /_/ // /_/ / /_/ / / /_/ / /  __/  /
/_____/ \____/\__,_/  \__,_/  \___//_/     一个支持集群部署的分布式 DHT 网络爬虫。

快速开始

环境依赖

演示地址

https://dodder.cc

announce_peer messages: announce_peer

单机运行环境:

  • CPU: Intel Xeon E3-1230 v3 - 3.3 GHz - 4 core(s)
  • RAM: 32GB - DDR3
  • Hard Drive(s): 2x 1TB (HDD SATA)
  • Bandwidth: Unmetered @ 1Gbps

更新日志

  • 2019-10-25
    • 升级目前部署在服务器上的 MongoDB,之前 3.6.8 版本频繁挂掉无错误日志
    • 使用 MongoDB 连接池
    • 去掉 indexMessages 主题消息,索引与入库使用 torrentMessages 同一个主题消息(使用不同分组),减少网络传输以及磁盘占用
    • 去除种子信息下载之前的 MongoDB 去重查询(几千个下载线程就是几千个并发查询,过于耗费资源)
  • 2019-10-20
    • 优化爬虫速度,新增阻塞线程池用于下载种子信息(降低内存使用)
    • 40万数据时(日爬取35w+新数据)
  • 2019-10-13
    • 数据存储到 MongoDB,Elasticsearch 只做索引
    • 升级各个环境依赖的版本
    • 优化数据存储服务,将 Kafka Torrent 的入库和索引消息改为手动提交模式,防止数据丢失
    • 进行两台服务器分布式部署测试,目前成功部署运行中:
      1. A 服务器部署微服务:dht-server、store-service (服务器有限,所以所有环境依赖比如 Elasticsearch 全在这台机器上)
      2. B 服务器部署微服务:dht-server、download-service、dodder-web
  • 2019-04-17
    • 初始版本

整体架构

架构图

说明:项目中的dht-serverdownload-servicestore-service都是可以集群部署的, dht-server负责爬取 DHT 网络中的 info_hash,然后写入到 Kafka 消息队列中去,download-service 负责读取 info_hash 信息到指定 ip 去下载种子文件的 metadata(集群部署时,注意设置好 kafka 主题的分区数量, 分区数量 >= 服务部署个数)。下载好的 metadata 解析出文件信息封装成 Torrent 对象写入 Kafka 的 torrentMessages主题中去,store-service负责读取 Torrent 存储到 Elasticsearch 中去。

去重:Redis 第一次去重,MongDB 与 Elasticsearch 采用 upsert 插入数据防止重复插入。

部署

前面的环境全部搭好之后,clone 整个项目到本地,如果是集群部署请修改各个服务模块里面的一些 ip 地址参数, 我这里服务器有限,只拿了一台服务器单机部署,集群部署有问题的欢迎提 issue。

注意

dht-server 需要公网 IP 才能爬取到 info_hash

MIT License Copyright (c) 2019 xwlcn Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

一个支持集群部署的分布式 DHT 网络爬虫 展开 收起
Java
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/wanrue/Dodder.git
git@gitee.com:wanrue/Dodder.git
wanrue
Dodder
Dodder
master

搜索帮助