stormcrawler的原型拓扑不获取大纲链接

lhcgjxsq  于 2021-06-24  发布在  Storm
关注(0)|答案(1)|浏览(305)

根据我的理解,基本示例应该能够爬网和获取页面。
我照着这个例子做了http://stormcrawler.net/getting-started/ 但是爬虫程序似乎只获取了几页,然后就什么也不做了。
我想爬http://books.toscrape.com/ 并运行了爬网,但在日志中看到只有第一个页面被提取,其他一些页面被发现但没有提取:

8010 [Thread-34-parse-executor[5 5]] INFO  c.d.s.b.JSoupParserBolt - Parsing : starting http://books.toscrape.com/
8214 [Thread-34-parse-executor[5 5]] INFO  c.d.s.b.JSoupParserBolt - Parsed http://books.toscrape.com/ in 182 msec
content 1435 chars
url     http://books.toscrape.com/
domain  toscrape.com
description
title   All products | Books to Scrape - Sandbox
http://books.toscrape.com/catalogue/category/books/new-adult_20/index.html      DISCOVERED      Thu Apr 05 13:46:01 CEST 2018
        url.path: http://books.toscrape.com/
        depth: 1

http://books.toscrape.com/catalogue/the-dirty-little-secrets-of-getting-your-dream-job_994/index.html   DISCOVERED      Thu Apr 05 13:46:01 CEST 2018
        url.path: http://books.toscrape.com/
        depth: 1

http://books.toscrape.com/catalogue/category/books/thriller_37/index.html       DISCOVERED      Thu Apr 05 13:46:01 CEST 2018
        url.path: http://books.toscrape.com/
        depth: 1

http://books.toscrape.com/catalogue/category/books/academic_40/index.html       DISCOVERED      Thu Apr 05 13:46:01 CEST 2018
        url.path: http://books.toscrape.com/
        depth: 1

http://books.toscrape.com/catalogue/category/books/classics_6/index.html        DISCOVERED      Thu Apr 05 13:46:01 CEST 2018
        url.path: http://books.toscrape.com/
        depth: 1

http://books.toscrape.com/catalogue/category/books/paranormal_24/index.html     DISCOVERED      Thu Apr 05 13:46:01 CEST 2018
        url.path: http://books.toscrape.com/
        depth: 1

....

17131 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928770        172.18.25.22:1024      6:partitioner URLPartitioner           {}
17164 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928770        172.18.25.22:1024      8:spout       queue_size               0
17403 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928770        172.18.25.22:1024      5:parse       JSoupParserBolt          {tuple_success=1, outlink_kept=73}
17693 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928770        172.18.25.22:1024      3:fetcher     num_queues               0
17693 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928770        172.18.25.22:1024      3:fetcher     fetcher_average_perdoc   {time_in_queues=265.0, bytes_fetched=51294.0, fetch_time=52.0}
17693 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928770        172.18.25.22:1024      3:fetcher     fetcher_counter          {robots.fetched=1, bytes_fetched=51294, fetched=1}
17693 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928770        172.18.25.22:1024      3:fetcher     activethreads            0
17693 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928770        172.18.25.22:1024      3:fetcher     fetcher_average_persec   {bytes_fetched_perSec=5295.137813564571, fetched_perSec=0.10323113451016827}
17693 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928770        172.18.25.22:1024      3:fetcher     in_queues                0
27127 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928780        172.18.25.22:1024      6:partitioner URLPartitioner           {}
27168 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928780        172.18.25.22:1024      8:spout       queue_size               0
27405 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928780        172.18.25.22:1024      5:parse       JSoupParserBolt          {tuple_success=0, outlink_kept=0}
27695 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928780        172.18.25.22:1024      3:fetcher     num_queues               0
27695 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928780        172.18.25.22:1024      3:fetcher     fetcher_average_perdoc   {}
27695 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928780        172.18.25.22:1024      3:fetcher     fetcher_counter          {robots.fetched=0, bytes_fetched=0, fetched=0}
27695 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928780        172.18.25.22:1024      3:fetcher     activethreads            0
27696 [Thread-39] INFO  o.a.s.m.LoggingMetricsConsumer - 1522928780        172.18.25.22:1024      3:fetcher     fetcher_average_persec   {bytes_fetched_perSec=0.0, fetched_perSec=0.0}

未更改任何配置文件。包括crawler-conf.yaml。还有国旗 parser.emitOutlinks 应为true,因为这是crawler-default.yaml的默认值
在另一个项目中,我还关注了youtube关于elasticsearch的教程。在这里我还有一个问题,那就是根本没有页面被提取和索引。
爬虫程序不获取任何页面的错误在哪里?

zqdjd7g9

zqdjd7g91#

这个人工制品生成的拓扑仅仅是一个例子,它使用stdoutstatusupdater,它只是将发现的url转储到控制台。如果您是在本地模式下运行,或者只有一个worker,那么可以使用memorystatusupdater,因为它会将发现的URL添加到memoryspout,然后依次处理这些URL。
请注意,当您终止拓扑或拓扑崩溃时,这不会持久化关于url的信息。同样,这只是为了调试和作为stormcrawler的初始步骤。
如果您想持久化url,可以使用任何持久化后端(solr/elasticsearch,sql)。请随意将您与es的问题描述为一个单独的问题。

相关问题