zhegexiaohuozi / SeimiCrawler

一个简单、敏捷、分布式的支持SpringBoot的Java爬虫框架;An agile, distributed crawler framework.
http://seimicrawler.org
Apache License 2.0
1.98k stars 679 forks source link

试了一下DefaultRedisQueueEG #2

Closed laugha closed 8 years ago

laugha commented 8 years ago

例子运行完后,控制台输出20:56:50 INFO c.w.crawlers.DefaultRedisQueueEG - url:http://www.cnblogs.com/yzg1/p/5010789.html [Backbone学习笔记一Backbone中的MVC,。。。。 说明爬取例子执行完毕,过了大概不到1分钟后,redis服务端报了下列错误,有大量的客户端发起链接请求, 4364] 01 Dec 20:57:19 - Accepted 127.0.0.1:3160 4364] 01 Dec 20:57:19 - DB 0: 2 keys (0 volatile) in 4 slots HT. 4364] 01 Dec 20:57:19 - 560 clients connected (0 slaves), 5069156 bytes in us, 后停止redis服务,控制台输出下列错误 20:57:21 WARN c.w.seimi.def.DefaultRedisQueue - java.net.SocketException: Connection reset 20:57:21 INFO c.w.seimi.def.DefaultRedisQueue - create redisPool host=127.0.0.1,port=6379 说明在爬虫执行完毕后,系统自动发出了大量链接请求,造成redis崩溃了,请问是我的配置问题还是系统例子的问题

zhegexiaohuozi commented 8 years ago

你启动了你本地的redis服务么?端口是6379么?这个例子是要依赖redis服务的。例子都是测试过没问题的。另外不建议在issue中讨论使用中的问题,后续我会建立一个专门的邮件讨论组用来讨论。issue 一般是用来报bug或是改进意见以及merge Request。前期可以直接发我邮件。

laugha commented 8 years ago

好,那还是直接邮件吧,我肯定起了redis的

zhegexiaohuozi commented 8 years ago

由于最初采用延时初始化导致在多线程同时获取redis pool会重复初始化同时占用无效链接,我更新了一版,提前初始化号redis pool来解决这个问题。我测试用的redis可能给他的配置较大,所以在我测试时没出现这个问题,就被隐藏掉了,多谢你的反馈!

laugha commented 8 years ago

继续学习。。加油啊

laugha commented 8 years ago

是我学习:)

zhegexiaohuozi commented 8 years ago

设计上就是这样的,seimi系统启动时会初始化所有能扫描到的crawler,并随时准备提供抓取服务。seimi的分布式抓取正是基于这一特性。

在 2015年12月2日,21:04,laugha notifications@github.com 写道:

为什么每次都init所有的crawler呢,我只运行了 s.startWithHttpd(8000,"basic");但实际上所有的crawler都被init了, Crawler[DefRedis] init complete.21:02:46 INFO c.w.seimi.struct.CrawlerModel - Crawler[baidu] init complete.21:02:46 INFO c.w.seimi.struct.CrawlerModel - Crawler[storedb] init complete.21:02:46 INFO c.w.seimi.struct.CrawlerModel - Crawler[useproxy] init complete.21:02:46 INFO c.w.seimi.struct.CrawlerModel - Crawler[delay] init complete.21:02:46 INFO c.w.seimi.struct.CrawlerModel - Crawler[intercept] init complete.21:02:46 INFO c.w.seimi.struct.CrawlerModel - Crawler[BeanResolver] init complete.21:02:46 INFO c.w.seimi.struct.CrawlerModel - Crawler[basic] init complete. — Reply to this email directly or view it on GitHub.