Giter Site home page Giter Site logo

distributed_crawler's Introduction

  "分布式爬虫"软件设计文档

赛题简介

爬虫系统,是对海量的分散的互联网数据进行采集的系统,是搜索引擎系统的基础。应大数据的需求,分布式爬虫系统是解决传统爬虫出现的无法对网页数据信息的归类和组织的问题。
分布式爬虫,对同一个网站的同类数据,进行结构化。同时,能利用分布式的软件设计方法,实现爬虫的高效采集。

软件需求分析

1.分布式爬虫 --- 通过分布式调度,提高整体效率,同时保证高可用性,具有一定的容错性、具有自动恢复,备份的功能。
2.自动结构化 --- 对于具有相同模板的URL集合,能够自动提取数据。对于包含正文的网页,能够提取正文。
3.监控系统 --- 图形化的用户界面,方便用户操作,并且对程序运行中的各项数据进行实时监控和展示。
4.反爬策略 --- 针对不同网站的反爬虫机制,制订爬虫策略。

总体架构

arch

客户端:采用Java Swing开发,提供方便易用的图形界面。采用JSON的格式与服务端通信。
服务端:通过操纵ZooKeeper集群控制爬虫集群,从爬虫集群中的MongoDB获取爬取的数据,在MySQL中保存集群状态等信息。
ZooKeeper集群:实现Leader Election,对爬虫节点进行监测与控制。
爬虫集群:每个爬虫节点与ZooKeeper集群通信,每开始一个任务则Fork一个任务进程执行相应的爬取任务。
通过WatchDog控制和回收崩溃后的僵尸进程。

URL分发策略-- "发牌" 算法

每个全站爬取任务会先对站点上的分类进行爬取,再根据爬虫节点数进行任务分发。 形象地称为"发牌"算法。 就像玩扑克牌时,会有一位玩家负责发牌,在牌发完之后,所有玩家再拿起手中牌开始游戏。

当一个爬取任务发布后,参与的爬虫节点会先进行一次Leader选举。 然后Leader则开始对主站爬取,按照分类将URL均分给参与的爬虫节点(包括自己)。 此时非Leader的爬虫节点会等待。 分发完毕,所有节点开始爬取。

反爬策略

(1) 禁止使用Cookie,让网站无法识别我们的会话信息。
(2) 使用IP池,通过多个代理服务器的IP进行爬取。
(3) 使用用户代理,通过多个User-Agent进行爬取。

distributed_crawler's People

Contributors

kangyijie5473 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.