溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

nutch+hadoop如何配置

發(fā)布時(shí)間:2021-12-06 11:11:04 來(lái)源:億速云 閱讀:163 作者:小新 欄目:開(kāi)發(fā)技術(shù)

這篇文章給大家分享的是有關(guān)nutch+hadoop如何配置的內(nèi)容。小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。

nutch+hadoop配置使用

配置nutch+hadoop

1,下載nutch。如果不需要特別開(kāi)發(fā)hadoop,則不需要下載hadoop。因?yàn)閚utch里面帶了hadoopcore包以及相關(guān)配置

2,建立目錄(根據(jù)自己喜好)
/nutch
/search(nutchinstallationgoeshere)nutch安裝到這里,也就是解壓到這里
/filesystemhadoop的文件系統(tǒng)存放點(diǎn)
/local/crawl后放置索引用來(lái)search用的
/home(nutchuser'shomedirectory)如果你用系統(tǒng)用戶,這個(gè)基本沒(méi)用
/tomcat啟動(dòng)nutch.war用來(lái)search索引的app

3,conf/hadoop-env.sh一定要配置JAVA_HOME,否則系統(tǒng)起不來(lái)

4,配置master和slave的ssh,否則每次都要輸入passwd
ssh-keygen-trsa
然后回車(chē)即可
cpid_rsa.pubauthorized_keys
(copy到其它的slave上)scp/nutch/home/.ssh/authorized_keysnutch@devcluster02:/nutch/home/.ssh/authorized_keys

5,將bin和conf下所有的.sh、nuch、hadoop文件dos2unix
dos2unix/nutch/search/bin/*.sh/nutch/search/bin/hadoop

配置hadoop-size.xml

6,記住要把master文件從nutch/hadoopcopy到這個(gè)nutch中,應(yīng)該是bug。也就是說(shuō)啟動(dòng)需要這個(gè)文件,文件內(nèi)容為默認(rèn)的localhost即可(如果是分布式,可能需要配置)

7,nutch+hadoop配置過(guò)程中需要格式化namenode
bin/hadoopnamenode-format

8,啟動(dòng):bin/start-all.sh

9,配置crawl(以配置一個(gè)網(wǎng)址lucene.apache.org為例)

cd/nutch/search  mkdirurls  viurls/urllist.txthttp://lucene.apache.org  cd/nutch/search  bin/hadoopdfs-puturlsurls  cd/nutch/search  viconf/crawl-urlfilter.txt  changethelinethatreads:+^http://([a-z0-9]*\.)*MY.DOMAIN.NAME/  toread:+^http://([a-z0-9]*\.)*apache.org/

10,啟動(dòng)crawl
bin/nutchcrawlurls-dircrawled-depth4

11,查詢
bin/hadoopdfs-copyToLocalcrawled/media/do/nutch/local/(crawled)將index的東西copy到以上配置的local中,因?yàn)閟earch不能用dfs中搜索(從文檔看是這樣)

12,啟動(dòng)nutch.war,測(cè)試
vinutch-site.xmlnutch.war中classes下
starttomcat

注意點(diǎn):
1,masters文件nutch原來(lái)沒(méi)有,需要copy到conf下
2,crawl的log4j配置默認(rèn)有問(wèn)題,需要增加:
hadoop.log.dir=.
hadoop.log.file=hadoop.log
3,nutch2.0一定要配置nutch-site.xml。重新配置http.agent。default.xml里面已經(jīng)存在。


nutch+hadoop配置使用時(shí)的問(wèn)題:
1,運(yùn)行hadoop程序時(shí),中途我把它終止了,然后再向hdfs加文件或刪除文件時(shí),出現(xiàn)Namenodeisinsafemode錯(cuò)誤:
rmr:org.apache.hadoop.dfs.SafeModeException:Cannotdelete/user/hadoop/input.Namenodeisinsafemode
解決的命令:
bin/hadoopdfsadmin-safemodeleave#關(guān)閉safemode
索引命令:
bin/nutchindexplainindex/paodingindexesplainindex/crawldbplainindex/linkdbplainindex/

segments/20090528132511plainindex/segments/20090528132525plainindex/segments/20090528132602
eg:
index:
bin/nutchindexcrawled/indexes_newcrawled/crawldbcrawled/linkdbcrawled/segments/20100313132517
merge:
bin/nutchmergecrawled/index_newcrawled/indexes_new
去重dedup:
bin/nutchdedupcrawled/index_new。

感謝各位的閱讀!關(guān)于“nutch+hadoop如何配置”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI