在Eclipse中运行Nutch2.3
參考http://wiki.apache.org/nutch/RunNutchInEclipse
一、環(huán)境準備
1、下載nutch2.3源代碼
svn co https://svn.apache.org/repos/asf/nutch/branches/2.x
2、選擇使用的數(shù)據(jù)庫類型,以hbase為例
在conf/nutch-site.xml中增加以下屬性:
3、在ivy/ivy.xml中增加與hbase相關(guān)的依賴項,此項本已存在,但被注釋掉,將注釋去掉即可
4、在nutch.xml中增加以下3個屬性
5、執(zhí)行ant eclipse
二、導入project
1、導入project
三、運行程序
1、Run as ----> Run configuration,選擇project與主類
2、填寫參數(shù)
/Users/liaoliuqing/Downloads/seed.txt
-Dhadoop.log.dir=logs -Dhadoop.log.file=hadoop.log
3、點擊run,輸出結(jié)果如下:
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中的數(shù)據(jù)
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
總結(jié)
以上是生活随笔為你收集整理的在Eclipse中运行Nutch2.3的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Nutch关于robot.txt的处理
- 下一篇: Gora官方范例