Twitter 如何从NiFi连接到远程Solr:例如,将推特流到Solr
我试图实现这个示例“”,但有一些不同:我在本地机器中有一个Nifi实例,在包含Hortonworks沙盒的VM中有一个Solr版本(LucidWorks)。当我尝试从NiFi连接到Solr服务器时,不幸地遇到以下错误:Twitter 如何从NiFi连接到远程Solr:例如,将推特流到Solr,twitter,streaming,hortonworks-data-platform,solrcloud,apache-nifi,Twitter,Streaming,Hortonworks Data Platform,Solrcloud,Apache Nifi,我试图实现这个示例“”,但有一些不同:我在本地机器中有一个Nifi实例,在包含Hortonworks沙盒的VM中有一个Solr版本(LucidWorks)。当我尝试从NiFi连接到Solr服务器时,不幸地遇到以下错误: PutSolrContentStream[id=f6327477-fb7d-4af0-ec32-afcdb184e545] Failed to send StandardFlowFileRecord[uuid=03c2b3f5-43d8-47fa-ab6e-ad41e0e22f8
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
我在VM中的主机文件如下所示:
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 healthcheck -c tweets -z localhost:2181
bin/solr状态
它给了我
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}]}]}
我怎样才能解决它
谢谢,
ShanghooshNiFi中的Solr处理器使用标准SolrJ客户端,因此在Solr Cloud的情况下,他们使用CloudSolrClient并获得ZooKeeper的位置,ZooKeeper用于了解Solr Cloud集群中的节点 在您的例子中,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