我創建了一個Apache Nutch Indexer Plugin,使用Manticore Search Java API向Manticore Search推送資料。
構建是成功的,而且索引之前的所有抓取步驟都是成功的(注入、生成、獲取、決議、更新b)。
當我運行索引命令bin/nutch index /root/nutch_source/crawl/crawldb/ -linkdb /root/nutch_source/crawl/linkdb/ -dir /root/nutch_source/crawl/segments/ -filter -normalize -deleteGone時失敗了,logs/hadoop.log包括以下堆疊跟蹤。
我在一個Docker容器中運行Nutch。
鏡像中的Nutch版本是1.19
2021-09-07 10: 15:46,040 WARN util. NativeCodeLoader - 無法加載native-hadoop庫for您的平臺......在適用的地方使用內置的java類。
2021-09-07 10。 16:23,666 WARN util. NativeCodeLoader - 無法加載native-hadoop庫for您的平臺......在適當的地方使用內置java類。
2021-09-07 10。 17:36,020 WARN util. NativeCodeLoader - 無法加載native-hadoop庫for您的平臺......在適當的地方使用內置java類。
2021-09-07 10:17:36,378 INFO segment。 SegmentChecker - Segment dir已完成:file:/root/nutch_source/crawl/segments/20210906001900.。
2021-09-07 10:17:36,383 INFO segment. SegmentChecker - segment dir已完成:file:/root/nutch_source/crawl/segments/20210906001655.。
2021-09-07 10:17:36,387 INFO segment. SegmentChecker - segment dir已完成:file:/root/nutch_source/crawl/segments/20210906002358.。
2021-09-07 10: 17:36,391 INFO indexer. IndexingJob - 索引器:開始于2021-09-07 10:17:36
2021-09-07 10: 17:36,401 INFO indexer. IndexingJob - 索引器:洗掉消失的檔案。true
2021-09-07 10: 17:36,402 INFO indexer. IndexingJob - 索引器。URL過濾。true true
2021-09-07 10: 17:36,402 INFO indexer. IndexingJob - 索引器。URL正常化。true
2021-09-07 10: 17:36,403 INFO indexer. IndexerMapReduce - IndexerMapReduce: crawldb: /root/nutch_source/crawl/crawldb
2021-09-07 10: 17:36,407 INFO indexer. IndexerMapReduce - IndexerMapReduces: adding segment: file:/root/nutch_source/crawl/segments/20210906001900。
2021-09-07 10: 17:36,408 INFO indexer. IndexerMapReduce - IndexerMapReduces: adding segment: file:/root/nutch_source/crawl/segments/20210906001655。
2021-09-07 10: 17:36,410 INFO indexer. IndexerMapReduce - IndexerMapReduces: adding segment: file:/root/nutch_source/crawl/segments/20210906002358。
2021-09-07 10: 17:36,411 INFO indexer. IndexerMapReduce - IndexerMapReduce: linkdb: /root/nutch_source/crawl/linkdb
2021-09-07 10: 17:36,528 WARN impl. MetricsConfig - 無法定位配置: tried hadoop-metrics2-jobtracker.properties,hadoop-metrics2.properties
2021-09-07 10: 17:37,708 INFO mapreduce. Job - 跟蹤作業的URL:http:/localhost:8080/。
2021-09-07 10。 17:37,711 INFO mapreduce. 作業 - 正在運行的作業:job_local250243852_0001
2021-09-07 10: 17:38,724 INFO mapreduce. Job - Job_local250243852_0001在uber模式下運行。false false
2021-09-07 10: 17:38,725 INFO mapreduce. 作業 - map 0% reduce 0%。
2021-09-07 10: 17:39,731 INFO mapreduce. 作業 - map 100% reduce 0%。
2021-09-07 10: 17:47,677 WARN impl. MetricsSystemImpl - JobTracker度量系統已被初始化!
2021-09-07 10: 17:47,992 INFO indexer. IndexWriters - Index writer org.apache.nutch.indexwriter.manticore.ManticoreIndexWriter確定。
2021-09-07 10。 17:48,013 WARN mapred. LocalJobRunner - job_local250243852_0001
java.lang.Exception: java.lang.NoClassDefFoundError: com/manticoresearch/client/ApiException
at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:492)
at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:559)
原因是: java.lang.NoClassDefFoundError: com/manticoresearch/client/ApiException
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3137)
at java.base/java.lang.Class.getConstructor0(Class.java:3342)
at java.base/java.lang.Class.getConstructor(Class.java:2151)
at org.apache.nutch.plugin.Extension.getExtensionInstance(Extension.java:170)
at org.apache.nutch.indexer.IndexWriters.<init>(IndexWriters.java:97)
at org.apache.nutch.indexer.IndexWriters.lambda$get$0(IndexWriters.java:60)
at java.base/java.util.Map.computeIfAbsent(Map.java:1003)
at org.apache.nutch.indexer.IndexWriters.get(IndexWriters.java:60)
at org.apache.nutch.indexer.IndexerOutputFormat.getRecordWriter(IndexerOutputFormat.java:41)
at org.apache.hadoop.mapred.ReduceTask$NewTrackingRecordWriter.<init>(ReduceTask.java:542)
at org.apache.hadoop.mapred.ReduceTask.runNewReducer(ReduceTask.java:615)
at org.apache.hadoop.mapred.ReduceTask.run(ReduceTask.java:390)
at org.apache.hadoop.mapred.LocalJobRunner$Job$ReduceTaskRunnable.run(LocalJobRunner.java:347)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
原因是:java.lang.ClassNotFoundException:com.manticoresearch.client.ApiException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at org.apache.nutch.plugin.PluginClassLoader.loadClassFromSystem(PluginClassLoader.java:105)
at org.apache.nutch.plugin.PluginClassLoader.loadClassFromParent(PluginClassLoader.java:93)
at org.apache.nutch.plugin.PluginClassLoader.loadClass(PluginClassLoader.java:73)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 19 more
2021-09-07 10: 17:48,742 INFO mapreduce. 作業 - 作業job_local250243852_0001失敗,狀態為FAILED,原因是。導致的。
2021-09-07 10: 17:48,773 INFO mapreduce. 作業 - 計數器。30
檔案系統計數器
FILE: 閱讀的位元組數=157397439
檔案。寫入的位元組數=332518016[/span]。
檔案。讀取操作的數量=0。
檔案。大型讀取操作的數量=0。
檔案。寫運算元=0 檔案:寫運算元=0
Map-Reduce框架
地圖輸入記錄=51223[/span]。
地圖輸出記錄=51223[/span
地圖輸出位元組數=24049558。
地圖輸出物化位元組=24158915。
輸入分割位元組=2010
合并輸入記錄=0。
合并輸出記錄=0
減少輸入組=0
輸入分割位元組=2010
合并輸入記錄=0
合并輸出記錄=0
減少輸入組=0
減少洗牌位元組數=24158915
減少輸入記錄=0
減少輸出記錄=0
溢位記錄=51223
Shuffled Maps =14
失敗的洗牌=0
合并的地圖輸出=14
GC時間elapsed (ms)=125
提交的總堆使用量 (位元組)=5221908480。
洗牌錯誤
BAD_ID=0
CONNECTION=0
IO_ERROR=0
WRONG_LENGTH=0
WRONG_MAP=0
WRONG_REDUCE=0
檔案輸入格式計數器
Bytes Read=11426452[/span]。
檔案輸出格式計數器
寫入的位元組數=02021-09-07 10: 17:48,774 ERROR indexer. IndexingJob - 索引作業沒有成功,作業狀態:FAILED,原因。導致索引作業不成功,作業狀態:失敗,原因:不成功。
2021-09-07 10: 17:48,776 ERROR indexer. IndexingJob - Indexer: java.lang.RuntimeException: 索引作業沒有成功,作業狀態:FAILED,原因。不適用
at org.apache.nutch.indexer.IndexingJob.index(IndexingJob.java:152)
at org.apache.nutch.indexer.IndexingJob.run(IndexingJob.java:293)
at org.apache.hadoop.util.ToolRunner.run(ToolRunner.java:76)
at org.apache.nutch.indexer.IndexingJob.main(IndexingJob.java:302)
uj5u.com熱心網友回復:
我可以通過將ManticoreSearch的所有依賴庫添加到插件檔案夾內的插件清單plugin.xml檔案來解決這個問題。
我找到了runtime/local/plugins/<plugin-name>/檔案夾中列出的所有依賴的JAR庫,并取其名稱,將其包含在plugin.xml的<runtime>標簽下。
在重建解決方案后,索引器作業了!
。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/318966.html
標籤:
