我是新手到Solr和駱駝,這就是我要完成的:Solr的增量導入計劃使用Apache駱駝 - 調用數據導入處理程序的增量導入
我使用數據導入處理程序索引數據成Solr的。當我從solr管理員運行時,所有(全部/ Delta導入)工作正常。我想寫一個調度程序,它將定期運行並從我的web應用程序觸發增量導入。我正在嘗試爲此使用Apache Camel。
我的意圖是讓Camel Quartz調度程序每5分鐘創建一個事件,並將該事件重定向到solr路由,然後調用Solr Delta Import處理程序。
from("quartz2://SolrUpdateHandlerInvokerTimer?trigger.repeatCount=-1&trigger.repeatInterval=300000")
.to("direct:insert");
from("direct:insert")
.to("solr://localhost:8080/solr/hylighter/dataimport?command=delta-import")
.to("direct:commit");
from("direct:commit")
.setHeader(SolrConstants.OPERATION,constant(SolrConstants.OPERATION_COMMIT))
.to("solr://localhost:8080/solr/hylighter");
但是,這不起作用,並失敗,出現以下例外。
例外:
Caused by:
org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: solr://localhost:8080/solr/hylighter/dataimport?command=delta-import due to: Failed to resolve endpoint: solr://localhost:8080/solr/hylighter/dataimport?command=delta-import due to: There are 1 parameters that couldn't be set on the endpoint. Check the uri if the parameters are spelt correctly and that they are properties of the endpoint. Unknown parameters=[{command=delta-import}]
如果我刪除?command=delta-import
代碼沒有拋出任何異常,運行,但是當我檢查我的核心/ conf文件夾裏面dataimport.properties其不更新,既不是我的索引。
有人可以幫助我確定我錯在哪裏嗎?
編輯:
路由更改:
from("quartz2://SolrUpdateHandlerInvokerTimer?trigger.repeatCount=-1&trigger.repeatInterval=3000")
.process(new LoggingProcessor())
.to("direct:insert");
from("direct:insert")
.process(new SolrLoggingProcessor())
.to("solr://localhost:8080/solr/hylighter/dataimport")
.process(new SolrLoggingProcessor())
.to("direct:commit");
from("direct:commit")
.setHeader(SolrConstants.OPERATION,constant(SolrConstants.OPERATION_COMMIT))
.process(new CommitLoggingProcessor())
.to("solr://localhost:8080/solr/hylighter")
.process(new CommitLoggingProcessor());
跟蹤:
QUARTZ ROUTE:ID-蜂58722-1390286766821-0-2
從Solr的更新路由ID -Bee-58722-1390286766821-0-2
QUARTZ ROUTE:ID-Bee-58722-1390286766821-0-4
F ROM Solr的更新路線ID-蜂58722-1390286766821-0-4
QUARTZ ROUTE:ID-蜂58722-1390286766821-0-6
從Solr的更新路由ID-蜂58722-1390286766821-0-6
QUARTZ ROUTE:ID-蜂58722-1390286766821-0-8
從Solr的更新路線ID-蜂58722-1390286766821-0-8
我在路線的終點和前一個端點之後添加一個處理器在路由中,我看到一旦它遇到調用solr數據導入的路由,它就不會返回並在路由中前進。
您正在使用您的諦到RDBMS的索引內容是什麼?如果是這樣,你是否在data-config.xml中指定了'deltaImportQuery'屬性?你可能會發布你的數據配置? – cheffe
是的我使用DIH來索引MySQL數據庫中的數據。我也使用了deltaImportQuery。當我試圖從Solr管理門戶運行它時,Delta導入工作正常。我的問題是我正在嘗試創建一個調度程序來定期運行Delta導入,使用不正常的駱駝。 – Balaji
好的,然後通過例外:(1)你的solr_home中有一個名爲'hylighter'的文件夾,(2)該文件夾中的'hylighter'是solrconfig.xml?如果是這樣(3),那麼XML是一個名爲'/ dataimport'的'requestHandler',它被正確配置? (4)那裏的data-config.xml是可以的。 – cheffe