
nutch
defungo
这个作者很懒,什么都没留下…
展开
-
Nutch相关框架安装使用最佳指南
转:http://user.qzone.qq.com/281032878/blog/1342675154#!app=2&via=QZ.HashRefresh&pos=1362131478Chinese installing and using instruction - The best guidance in installing and using...原创 2013-04-17 07:16:05 · 168 阅读 · 0 评论 -
nutch源码阅读(9)-Fetch
Fetcher这个模块在Nutch中有单独一个包在实现,在org.apache.nutch.fetcher,其中有Fetcher.java, FetcherOutput 和FetcherOutputFormat来组成,看上去很简单,但其中使用到了多线程,多线程的生产者与消费者模型,MapReduce的多路径输出等方法。下面我们来看一下Fetcher的注释,从中我们可以得到很多有用的信息。首先,这...原创 2013-06-25 16:52:49 · 133 阅读 · 0 评论 -
nutch源码阅读(8)-Generator
接着看下最后一个Job.........................................................//判断是否更新 if (getConf().getBoolean(GENERATE_UPDATE_CRAWLDB, false)) { // update the db from tempDir // 产生临时目...原创 2013-06-25 07:12:41 · 134 阅读 · 0 评论 -
nutch源码阅读(7)-Generator
继续向下看,第二个Job............................................................ // read the subdirectories generated in the temp // output and turn them into segments List<Path> g...原创 2013-06-25 07:01:11 · 142 阅读 · 0 评论 -
nutch源码阅读(6)-Generator
for (i = 0; i < depth; i++) { // generate new segment //根据传入参数depth来决定循环次数,生成segment Path[] segs = generator.generate(crawlDb, segments, -1, topN, System ...原创 2013-06-25 06:40:40 · 106 阅读 · 0 评论 -
nutch源码阅读(5)-Injector总结
nutch的inject 有二个job 第一个job 如下图 map :InjectMapper 功能如下 1 url是否有tab分割的k-v 对如果有记录下来, 2 如果配置了过滤使用 URLNormalizers和 URLFilters 对url 进行格式化和过滤, 3 如果过滤的url 不为空则创建CrawlDatum对象,状态 STATUS_INJECTED,设置fetche...原创 2013-05-30 09:10:46 · 130 阅读 · 0 评论 -
nutch源码阅读(4)-Injector的第二个MapReduce
JobConf mergeJob = CrawlDb.createJob(getConf(), crawlDb); //可以看到上一个MP的输出tempDir,就是这个MP的输入 FileInputFormat.addInputPath(mergeJob, tempDir); mergeJob.setReducerClass(InjectReducer.cl...原创 2013-05-28 09:48:51 · 133 阅读 · 0 评论 -
nutch源码阅读(3)-Injector的Mapper
上篇看到Injector的初始化,这次继续阅读,看看Mapperpublic void map(WritableComparable key, Text value, OutputCollector<Text, CrawlDatum> output, Reporter reporter) throws IOExceptio...原创 2013-05-28 09:24:37 · 107 阅读 · 0 评论 -
nutch源码阅读(2)-Injector的初始化
从上篇的Crawl可以看到,抓取过程是按一个一个阶段,逐步进行。所以先看Injector( org.apache.nutch.crawl.Injector) // initialize crawlDb injector.inject(crawlDb, rootUrlDir);,从代码可以很明显看出,nu...2013-05-27 17:28:32 · 229 阅读 · 0 评论 -
nutch源码阅读(1)-Crawl
org.apache.nutch.crawl.Crawl实现的是一个完成的抓取过程,所以由它开始。 /* Perform complete crawling and indexing (to Solr) given a set of root urls and the -solr parameter respectively. More inf...原创 2013-05-27 15:45:17 · 121 阅读 · 0 评论 -
Failed to set permissions of path问题
错误信息:Exception in thread "main" java.io.IOException:Failed to set permissions of path:\tmp\hadoop-yth\mapred\staging\yth-2036315919\.staging to 0700 官方BUG参考:https://issues.apache.org/jira/bro...原创 2013-05-10 16:42:39 · 475 阅读 · 0 评论 -
nutch eclipse 缺少的jar
nekohtml http://nekohtml.sourceforge.net/ dk.brics.automaton http://www.brics.dk/automaton/ rome http://mirrors.ibiblio.org/pub/mirrors/maven2/rome/rome/0.9/rome-0.9.jar tagsoup-1.1.3 http://www.findj...原创 2013-05-09 16:13:58 · 120 阅读 · 0 评论 -
nutch杂记
1. 如何绕过目标站点的robots.txt限制 多数站点都是只允许百度、google等搜索引擎抓取的,所以会在robots.txt里限制其他爬虫。 nutch自然是会遵循robots协议的,但是我们可以通过修改nutch源码来绕过限制。 相关代码位于(nutch版本1.5.1,其他版本未测试): org.apache.nutch.fetcher.Fetcher的run方法. 找到以下几行代码...原创 2013-04-24 07:24:16 · 99 阅读 · 0 评论 -
nutch源码阅读(10)-Fetch
private static class QueueFeeder extends Thread { private RecordReader<Text, CrawlDatum> reader; private FetchItemQueues queues; //生产者和消费者的共享序列,分层,一层对应一个host private int...原创 2013-06-26 09:44:47 · 168 阅读 · 0 评论