2017-10-12 154 views
0

我試圖在此之後在Ubuntu 14.04上部署Nutch 2.3 + ElasticSearch 1.4 + HBase 0.94 tutorial。當我嘗試啓動爬行注入的URL做:無法啓動Nutch爬行

$NUTCH_ROOT/runtime/local/bin/nutch inject urls 

我得到:

InjectorJob: starting at 2017-10-12 19:27:48 
InjectorJob: Injecting urlDir: urls 

和程序仍然有幾個小時。

我如何知道發生了什麼?

配置文件:

Nutch的-site.xml中

<configuration> 
    <property> 
    <name>http.agent.name</name> 
    <value>mycrawlername</value> <!-- this can be changed to something more sane if you like --> 
    </property> 
    <property> 
    <name>http.robots.agents</name> 
    <value>mycrawlername</value> <!-- this is the robot name we're looking for in robots.txt files --> 
    </property> 
    <property> 
    <name>storage.data.store.class</name> 
    <value>org.apache.gora.hbase.store.HBaseStore</value> 
    </property> 
    <property> 
    <name>plugin.includes</name> 
    <!-- do **NOT** enable the parse-html plugin, if you want proper HTML parsing. Use something like parse-tika! --> 
    <value>protocol-httpclient|urlfilter-regex|parse-(text|tika|js)|index-(basic|anchor)|query-(basic|site|url)|response-(json|xml)|summary-basic|scoring-opic|urlnormalizer-(pass|regex|basic)|indexer-elastic</value> 
    </property> 
    <property> 
    <name>db.ignore.external.links</name> 
    <value>true</value> <!-- do not leave the seeded domains (optional) --> 
    </property> 
    <property> 
    <name>elastic.host</name> 
    <value>localhost</value> <!-- where is ElasticSearch listening --> 
    </property> 
</configuration> 

HBase的-site.xml中

<configuration> 
    <property> 
     <name>hbase.rootdir</name> 
     <value>/home/kike/RIWS/hbase-0.94.14/</value> 
    </property> 
    <property> 
     <name>hbase.cluster.distributed</name> 
     <value>false</value> 
    </property> 
</configuration> 

日誌文件:

HBase的主日誌

2017-10-12 19:27:49,593 INFO org.apache.zookeeper.server.NIOServerCnxnFactory: Accepted socket connection from /127.0.0.1:47778 
2017-10-12 19:27:49,596 INFO org.apache.zookeeper.server.ZooKeeperServer: Client attempting to establish new session at /127.0.0.1:47778 
2017-10-12 19:27:49,609 INFO org.apache.zookeeper.server.ZooKeeperServer: Established session 0x15f11684f3f0017 with negotiated timeout 40000 for client /127.0.0.1:47778 
2017-10-12 19:31:11,092 DEBUG org.apache.hadoop.hbase.io.hfile.LruBlockCache: Stats: total=1.99 MB, free=239.7 MB, max=241.69 MB, blocks=2, accesses=18, hits=16, hitRatio=88,88%, , cachingAccesses=18, cachingHits=16, cachingHitsRatio=88,88%, , evictions=0, evicted=0, evictedPerRun=NaN 
2017-10-12 19:31:24,623 DEBUG org.apache.hadoop.hbase.client.MetaScanner: Scanning .META. starting at row= for max=2147483647 rows using org.apache.h[email protected]1646b7c 
2017-10-12 19:31:24,630 DEBUG org.apache.hadoop.hbase.master.CatalogJanitor: Scanned 0 catalog row(s) and gc'd 0 unreferenced parent region(s) 
2017-10-12 19:32:13,832 INFO org.apache.zookeeper.server.PrepRequestProcessor: Processed session termination for sessionid: 0x15f11684f3f0017 
2017-10-12 19:32:13,849 INFO org.apache.zookeeper.server.NIOServerCnxn: Closed socket connection for client /127.0.0.1:47778 which had sessionid 0x15f11684f3f0017 
2017-10-12 19:32:14,852 INFO org.apache.zookeeper.server.NIOServerCnxnFactory: Accepted socket connection from /127.0.0.1:47817 
2017-10-12 19:32:14,853 INFO org.apache.zookeeper.server.ZooKeeperServer: Client attempting to establish new session at /127.0.0.1:47817 
2017-10-12 19:32:14,880 INFO org.apache.zookeeper.server.ZooKeeperServer: Established session 0x15f11684f3f0018 with negotiated timeout 40000 for client /127.0.0.1:47817 

Hadoop的日誌

2017-10-12 19:27:48,871 INFO crawl.InjectorJob - InjectorJob: starting at 2017-10-12 19:27:48 
2017-10-12 19:27:48,871 INFO crawl.InjectorJob - InjectorJob: Injecting urlDir: urls 

編輯:

過一段時間後,Hadoop的日誌顯示:

2017-10-12 20:34:59,333 ERROR crawl.InjectorJob - InjectorJob: org.apache.gora.util.GoraException: java.lang.RuntimeException: org.apache.hadoop.hbase.MasterNotRunningException: Retried 14 times 
    at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:167) 
    at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:135) 
    at org.apache.nutch.storage.StorageUtils.createWebStore(StorageUtils.java:78) 
    at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:218) 
    at org.apache.nutch.crawl.InjectorJob.inject(InjectorJob.java:252) 
    at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:275) 
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) 
    at org.apache.nutch.crawl.InjectorJob.main(InjectorJob.java:284) 
Caused by: java.lang.RuntimeException: org.apache.hadoop.hbase.MasterNotRunningException: Retried 14 times 
    at org.apache.gora.hbase.store.HBaseStore.initialize(HBaseStore.java:133) 
    at org.apache.gora.store.DataStoreFactory.initializeDataStore(DataStoreFactory.java:102) 
    at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:161) 
    ... 7 more 
Caused by: org.apache.hadoop.hbase.MasterNotRunningException: Retried 14 times 
    at org.apache.hadoop.hbase.client.HBaseAdmin.<init>(HBaseAdmin.java:139) 
    at org.apache.gora.hbase.store.HBaseStore.initialize(HBaseStore.java:115) 
    ... 9 more 

但如果我鍵入JPS我可以看到HMASTER運行:

31672 Jps 
20553 HMaster 
19739 Elasticsearch 
+0

多少網址你有種子文件? –

+0

只有一個@JorgeLuis(https://www.fic.udc.es/) – Kroka

+0

從異常看起來像是沒有正確連接到HBase服務器'org.apache.hadoop.hbase.MasterNotRunningException:重試14次' –

回答

0

你的錯誤日誌顯示:(hbase.MasterNotRunningException)

org.apache.hadoop.hbase.MasterNotRunningException: Retried 14 times 
    at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:167) 
    at org.apache.gora.store.DataStoreFactory.createDataStore(DataStoreFactory.java:135) 
    at org.apache.nutch.storage.StorageUtils.createWebStore(StorageUtils.java:78) 
    at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:218) 
    at org.apache.nutch.crawl.InjectorJob.inject(InjectorJob.java:252) 
    at org.apache.nutch.crawl.InjectorJob.run(InjectorJob.java:275) 
    at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:70) 
    at org.apache.nutch.crawl.InjectorJob.main(InjectorJob.java:284) 

我們需要設置HBase的

open ~/Desktop/Nutch/hbase/conf/hbase-site.xml,並添加以下2個節點。我們需要告知hbase安裝的rootdir,並指定zookeeper的數據目錄。

open ~/Desktop/Nutch/hbase/conf/hbase-site.xml 

<configuration> 
     <property> 
      <name>hbase.rootdir</name> 
      <value>file:///Users/sntiwari/Desktop/Nutch/hbase</value> 
     </property> 
     <property> 
      <name>hbase.zookeeper.property.dataDir</name> 
      <value>/Users/sntiwari/Desktop/Nutch/zookeeper</value> 
     </property> 
    </configuration> 

接下來,我們需要告訴gora使用Hbase爲它的默認數據存儲。

open ~/Desktop/Nutch/nutch/conf/gora.properties 
# open ~/Desktop/Nutch/nutch/runtime/local/conf/gora.properties 

# Add this line under `HBaseStore properties` (to keep things organised) 
gora.datastore.default=org.apache.gora.hbase.store.HBaseStore 

我們需要添加/取消對gora-hbase依賴於我們的ivy.xml(可能是線118)。

open ~/Desktop/Nutch/nutch/ivy/ivy.xml 

# Find and Uncomment this line (aprrox 118) 
<dependency org="org.apache.gora" name="gora-hbase" rev="0.5" conf="*->default" /> 

**測試你的HBase的**

# Start it up! 
~/Desktop/Nutch/hbase/bin/start-hbase.sh 

# Stop it (Can take a while, be patient) 
~/Desktop/Nutch/hbase/bin/stop-hbase.sh 

# Access the shell 
~/Desktop/Nutch/hbase/bin/hbase shell 

# list    = list all tables 
# disable 'webpage' = disable the table (before dropping) 
# drop 'webpage'  = drop the table (webpage is created & used by nutch) 
# exit    = exit from hbase 

# For the next part, we need to start hbase 
~/Desktop/Nutch/hbase/bin/start-hbase.sh 

按照一些測試步驟也:

  1. 首先檢查版本兼容性。

  2. 確保JAVA_HOME和NUTCH_JAVA_HOME環境變量設置

  3. 編譯Nutch的[你需要Apache的Nutch使用編譯螞蟻(ant runtime