博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
在Eclipse中运行Nutch2.3 分类: H3_NUTCH ...
阅读量:4471 次
发布时间:2019-06-08

本文共 2894 字,大约阅读时间需要 9 分钟。

参考http://wiki.apache.org/nutch/RunNutchInEclipse

一、环境准备

1、下载nutch2.3源代码

wget http://mirror.bit.edu.cn/apache/nutch/2.3/apache-nutch-2.3-src.tar.gz
或者下载正在开发中的最新版本
svn co https://svn.apache.org/repos/asf/nutch/branches/2.x

2、选择使用的数据库类型,以hbase为例
在conf/nutch-site.xml中增加以下属性:

storage.data.store.class
org.apache.gora.hbase.store.HBaseStore
Default class for storing data

3、在ivy/ivy.xml中增加与hbase相关的依赖项,此项本已存在,但被注释掉,将注释去掉即可

注意,rev=0.5对应hbase0.94,rev=0.3对应hbase0.90.4 

4、在nutch.xml中增加以下3个属性

http.agent.name
My Nutch Spider
http.robots.agents
none
plugin.folders
/Users/liaoliuqing/0_Search/1_Nutch/1_Official/apache-nutch-2.3/build/plugins
其中plugin.folders的值为$NUTCH_HOME/build/plugins

5、执行ant eclipse

二、导入project

1、导入project

2、在build path中,将apche-nutch-2.3/conf放到最上面,即点击top按键

三、运行程序

1、Run as ----> Run configuration,选择project与主类

2、填写参数

/Users/liaoliuqing/Downloads/seed.txt

-Dhadoop.log.dir=logs -Dhadoop.log.file=hadoop.log

3、点击run,输出结果如下:

InjectorJob: starting at 2015-01-28 16:27:43

InjectorJob: Injecting urlDir: /Users/liaoliuqing/Downloads/seed.txt
InjectorJob: Using class org.apache.gora.hbase.store.HBaseStore as the Gora storage class.
InjectorJob: total number of urls rejected by filters: 0
InjectorJob: total number of urls injected after normalization and filtering: 1
Injector: finished at 2015-01-28 16:27:47, elapsed: 00:00:04

注意,在运行程序前,本机需要先启动hbase。

4、查看hbase中的数据

hbase(main):003:0> scan 'webpage'ROW                                         COLUMN+CELL                                                                                                                  com.163.www:http/                          column=f:fi, timestamp=1422433667377, value=\x00'\x8D\x00                                                                    com.163.www:http/                          column=f:ts, timestamp=1422433667377, value=\x00\x00\x01K/\xA7:\x14                                                          com.163.www:http/                          column=mk:_injmrk_, timestamp=1422433667377, value=y                                                                         com.163.www:http/                          column=mk:dist, timestamp=1422433667377, value=0                                                                             com.163.www:http/                          column=mtdt:_csh_, timestamp=1422433667377, value=?\x80\x00\x00                                                              com.163.www:http/                          column=s:s, timestamp=1422433667377, value=?\x80\x00\x00                                                                    1 row(s) in 0.2970 seconds

版权声明:本文为博主原创文章,未经博主允许不得转载。

转载于:https://www.cnblogs.com/lujinhong2/p/4637238.html

你可能感兴趣的文章
谷歌搜索语法
查看>>
static 静态变量
查看>>
5.24
查看>>
从Github下拉取Laravel项目的完整步骤
查看>>
潜龙博客地址
查看>>
[VJ][DP]Monkey and Banana
查看>>
javascript基础篇--function类型(上)
查看>>
学习进度条05
查看>>
MySQL配置文件详解
查看>>
小vimer的心得+求primer一个实例问题解答
查看>>
HDU 1010 Temper of the bone(深搜+剪枝)
查看>>
如何使用BAT文件批量运行SQL语句,并保存执行结果
查看>>
JS中==和===的区别
查看>>
python—命名规范
查看>>
.Net常用正则判断方法
查看>>
我的第一个python web开发框架(39)——后台接口权限访问控制处理
查看>>
Redis MSET的极限在哪里
查看>>
iOS基础知识----SQLite数据库操作
查看>>
Linux命令之chown
查看>>
Linux命令之telnet
查看>>