1

我想實現這個示例「https://github.com/abajwa-hw/ambari-nifi-service」,但有一些不同:我在本地計算機上有一個Nifi實例和一個Solr版本(LucidWorks)在包含Hortonworks Sandbox的VM中。當我嘗試連接到從NiFi Solr的服務器,我不幸得到這個錯誤:如何連接到來自NiFi的遠程Solr:例如將推文流式傳輸到solr

PutSolrContentStream[id=f6327477-fb7d-4af0-ec32-afcdb184e545] Failed to send StandardFlowFileRecord[uuid=03c2b3f5-43d8-47fa-ab6e-ad41e0e22f81,claim=StandardContentClaim [resourceClaim=StandardResourceClaim[id=1487148463852-14, container=default, section=14], offset=660541, length=6857],offset=0,name=103053148756602.json,size=6857] to Solr due to org.apache.solr.client.solrj.SolrServerException: IOException occured when talking to server at: http://172.17.0.2:8983/solr/tweets_shard1_replica1; routing to connection_failure: org.apache.solr.client.solrj.SolrServerException: IOException occured when talking to server at: http://172.17.0.2:8983/solr/tweets_shard1_replica1 

我的主機在虛擬機文件是一樣的,如下:

127.0.0.1  localhost       
::1  localhost ip6-localhost 
ip6-loopback  
fe00::0 ip6-localnet        
ff00::0 ip6-mcastprefix        
ff02::1 ip6-allnodes         
ff02::2 ip6-allrouters          
172.17.0.2  sandbox.hortonworks.com 

,當我嘗試

bin/solr status

它給了我

Found 1 Solr nodes:  
Solr process 11364 running on port 8983  
{           
    "solr_home":"/opt/lucidworks-hdpsearch/solr/server/solr/", 
    "version":"5.2.1 1684708 - shalin - 2015-06-10 23:20:13",  
    "startTime":"2017-02-14T05:24:44.191Z",   
    "uptime":"0 days, 3 hours, 36 minutes, 37 seconds",  
    "memory":"101.6 MB (%20.7) of 490.7 MB",      
    "cloud":{       
    "ZooKeeper":"localhost:2181",   
    "liveNodes":"1",     
    "collections":"2"}} 

,當我嘗試

bin/solr healthcheck -c tweets -z localhost:2181 

它給

{         
    "collection":"tweets",    
    "status":"healthy",    
    "numDocs":1,      
    "numShards":1,      
    "shards":[{      
     "shard":"shard1",    
     "status":"healthy",   
     "replicas":[{     
      "name":"core_node1",  
"url":"http://172.17.0.2:8983/solr/tweets_shard1_replica1/", 
      "numDocs":1,    
      "status":"active",  
      "uptime":"0 days, 3 hours, 37 minutes, 5 seconds", 
      "memory":"27.4 MB (%5.6) of 490.7 MB", 
      "leader":true}]}]} 

我該如何解決呢?

謝謝, Shanghoosh

回答

2

Solr的處理器在NiFi使用標準SolrJ客戶端,因此在Solr的雲的情況下,它們使用的是CloudSolrClient和報錯這是用來了解節點的ZooKeeper的位置在Solr雲集羣中。

就你而言,ZooKeeper位於localhost:2181,因此CloudSolrClient連接到ZK並檢索關於碎片的信息,然後在172.17.0.2:8983處顯示碎片。

如果您從本地機器發出curl命令以查詢該內核,會發生什麼情況?

curl "http://172.17.0.2:8983/solr/tweets_shard1_replica1/query?q=*:*" 

如果curl命令無法到達該分片,那麼NiFi將不能夠。

無法連接的可能原因可能是端口8983未通過沙箱打開,或者您的本地計算機無法解析172.17.0.2。

最簡單的解決方案是在沙箱上運行NiFi以避免所有連接問題,但是您也可以嘗試更改沙盒的端口轉發配置以打開端口8983.