Precondition:
hadoop 2.7.1 hbase 0.98.13 solr 5.2.1 / Apache Solr 4.8.1
gora 0.6.1
gora编译和Nutch编译部署
1. Gora下载
最新版本号呢gora是0.6.1,下载或者直接通过git获取 git clone
2. 改动gora pom.xml
下面可能是Nutch2.3能终于执行的关键。没有1.0.1.1-hadoop2:)
1.2.1 2.7.1 1.2.1 2.7.1 0.98.13-hadoop2 0.98.13-hadoop2
3. 编译gora
mvn clean install -DskipTests mvn install -DskipTests
4. 改动$NUTCH_HOME/conf/nutch-site.xml
storage.data.store.class org.apache.gora.hbase.store.HBaseStore Default class for storing data http.agent.name My Nutch Spider plugin.includes protocol-httpclient|urlfilter-regex|parse-(html|tika)|index-(basic|anchor)|indexer-solr|scoring-opic|urlnormalizer-(pass|regex|basic)
5. 改动$NUTCH_HOME/ivy/ivy.xml
全部"org.apache.gora"涉及到的rev改动为0.6。比如:
=>
删除"org.apache.hadoop"。加入:
6.改动$NUTCH_HOME/ivy/ivysettings.xml
7. $NUTCH_HOME/conf/gora.properties 加入
gora.datastore.default=org.apache.gora.hbase.store.HBaseStore
8. 依据须要改动 $NUTCH_HOME/conf/regex-urlfilter.txt $NUTCH_HOME/conf/nutch-default.xml能够不用改
9. 编译。要非常长时间
ant runtime
10. 将gora以下的hadoop*.jar复制到runtime/local/lib/
cp /disk/gora/gora-core/lib/hadoop* /disk2/nutch/nutch-2.3/runtime/local/lib/
11. 建立搜索url
mkdir urls echo >> urls/seek.txt
12. 測试执行
cd runtime/local/
bin/nutch inject urls/seek.txt
solr5.2.1 部署执行
1. 下载解压
2. example/example-DIH 包括了完整的solr home配置,复制到server/solr
cp -rf /disk2/solr/solr-5.2.1/example/example-DIH/solr/* /disk2/solr/solr-5.2.1/server/solr/
3. 解决Nutch执行中可能遇到的
cd /disk2/solr/solr-5.2.1/server/solr
cp /disk2/solr/solr-5.2.1/example/exampledocs/monitor.xml .
curl --data-binary @monitor.xml -H 'Content-type:application/xml'
3. 为nutch crawl执行。还要改动/disk2/solr/solr-5.2.1/server/solr/solr/conf/schema.xml。加上:
4. bin/solr start
5.
6. bin/crawl urls/seek.txt TestCrawl 2
FAQ
以下是过程中遇到的让人愤慨的。。。
1. 错误: 找不到或无法载入主类 org.apache.nutch.crawl.InjectorJob:没有ant runtime
2. Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/hadoop/hbase/HBaseConfiguration
nutch2.3 须要使用hbase 0.98.13 的几个hbase-comm*.jar / hbase-client*.jar / hbase-protocol*.jar。千万不要用hbase1.0.1.1的。 cd /disk2/hbase/hbase-0.98.13-hadoop2/lib cp hbase-common* /disk2/nutch/nutch-2.3/runtime/local/lib/
cp hbase-client-0.98.13-hadoop2.jar /disk2/nutch/nutch-2.3/runtime/local/lib/ cp hbase-protocol* /disk2/nutch/nutch-2.3/runtime/local/lib/
3. Exception in thread "main" java.lang.NoSuchFieldError: HBASE_CLIENT_PREFETCH_LIMIT原因同上。hbase 和 nutch不匹配
4. 2015-07-21 13:53:53,238 WARN util.NativeCodeLoader - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
就让他native好了 mkdir -p /disk2/nutch/nutch-2.3/runtime/local/lib/native/Linux-amd64-64/ cd /disk2/hadoop/hadoop-2.7.1/lib/native/ cp * /disk2/nutch/nutch-2.3/runtime/local/lib/native/Linux-amd64-64/ cp * /disk2/nutch/nutch-2.3/runtime/local/lib/native/