簡體   English   中英

Apache nutch以通過REST索引到solr

[英]apache nutch to index to solr via REST

Apache Nut的新手-編寫客戶端以通過REST使用它。 在所有步驟(INJECT,FETCH ...)中都成功-在最后一步-嘗試索引到solr時-無法傳遞參數。 請求(我在某些網站上對其進行了格式化)

{
  "args": {
    "batch": "1463743197862",
    "crawlId": "sample-crawl-01",
    "solr.server.url": "http:\/\/x.x.x.x:8081\/solr\/"
  },
  "confId": "default",
  "type": "INDEX",
  "crawlId": "sample-crawl-01"
}

Nutch日志:

java.lang.Exception: java.lang.RuntimeException: Missing SOLR URL. Should be set via -D solr.server.url
SOLRIndexWriter
        solr.server.url : URL of the SOLR instance (mandatory)
        solr.commit.size : buffer size when sending to SOLR (default 1000)
        solr.mapping.file : name of the mapping file for fields (default solrindex-mapping.xml)
        solr.auth : use authentication (default false)
        solr.auth.username : username for authentication
        solr.auth.password : password for authentication
        at org.apache.hadoop.mapred.LocalJobRunner$Job.runTasks(LocalJobRunner.java:462)
        at org.apache.hadoop.mapred.LocalJobRunner$Job.run(LocalJobRunner.java:522)

實施了嗎? 傳遞給solr插件的參數?

您需要使用/config/create/端點創建/更新配置,並帶有POST請求和類似於以下內容的有效負載:

{
    "configId":"solr-config",
    "force":"true",
    "params":{"solr.server.url":"http://127.0.0.1:8983/solr/"}
}

在這種情況下,我將創建一個新配置並指定solr.server.url參數。 您可以驗證是否正在處理對/config/solr-config的GET請求( solr-config是先前指定的configId ),輸出應包含所有默認參數,請參見https://gist.github.com/jorgelbg/689b1d66d116fa55a1ee14d7193d71b4用於示例/默認輸出。 如果返回的JSON一切正常,您應該看到solr.server.url選項,具有所需的值https://gist.github.com/jorgelbg/689b1d66d116fa55a1ee14d7193d71b4#file-nutch-solr-config-json-L464

在剛剛擊中/job/create端點以創建新的INDEX Job之后,有效負載應為:

{
    "type":"INDEX",
    "confId":"solr-config",
    "crawlId":"crawl01",
    "args": {}
}

這個想法是,需要你通過configId您用創建solr.server.url與一起指定crawlId等ARGS。 這應該返回類似以下內容:

{
  "id": "crawl01-solr-config-INDEX-1252914231",
  "type": "INDEX",
  "confId": "solr-config",
  "args": {},
  "result": null,
  "state": "RUNNING",
  "msg": "OK",
  "crawlId": "crawl01"
}

最重要的是,您需要使用設置的solr.server.url創建一個新配置,而不是通過JSON有效負載中的args鍵來指定它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM