nutch2.1分布式抓取
生活随笔
收集整理的這篇文章主要介紹了
nutch2.1分布式抓取
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在上一篇的基礎上。
1準備環境:hadoop集群、java、mysql數據庫,代碼可以在eclipse中運行,可以單機模式下插入數據到mysql數據庫。 2修改配置文件nutch-site.xml: <property> <name>plugin.folders</name> <value>./plugins</value> <description>Directories where nutch plugins are located.? Each element may be a relative or absolute path.? If absolute, it is used as is.? If relative, it is searched for on the classpath.</description> </property> 在eclipse中選中buil.xml,run as ant,運行runtime,運行成功會產生文件夾runtime。 3 把runtime文件夾上傳到hadoop集群中的master服務器(沒有驗證其他服務器是不是可以),我上傳之后的位置是:/home/hadoop/nutch/runtime,設置環境變量: 在/etc/profile中:export NUTCH_HOME=/home/hadoop/nutch/runtime/local? source /etc/profile使得修改起作用。 4應該是把url種子文件上傳到hadoop。我的種子文件始終沒有成功,這一步略過。 5在/home/hadoop/nutch/runtime/deploy目錄下運行: ./bin/nutch crawl ?-dir crawl -depth 2 -threads 4 -topN 50
一點心得:nutch2之后不需要把配置文件(conf)分發到集群中的每臺機器,但是修改配置文件以后需要重新用ant打包,配置才能生效。
總結
以上是生活随笔為你收集整理的nutch2.1分布式抓取的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【LeetCode】题解合集(JavaS
- 下一篇: 微信页面弹出窗口,底部不随窗口滑动而滚动