使用SolrCloud和Zookeeper

时间:2016-08-21 21:53:14

标签: solr apache-zookeeper solrcloud

我正试图用Vagrant测试SolrCloud。我让Zookeeper在一个盒子上运行,而Solr在另一个盒子上运行。这些盒子在一个专用网络上(我可以从每个网络中搜索出来)。

当我尝试通过Solr CLI创建一个集合时,它会超时,我想当它试图与Zookeeper通信时。

Zookeeper按预期运行。我使用以下命令在前台模式下启动它:

sudo bin/zkServer.sh start-foreground

我的zoo.cfg文件:

tickTime=2000
dataDir=/var/lib/zookeeper/1
clientPort=2181
server.1=localhost:2888:3888

然后我以云模式启动Solr:

 bin/solr start -c -z 172.28.128.3:2181

此时,一切似乎都很好。在Solr日志中没有出现任何错误,并且在Zookeeper的控制台中没有出现警报消息。

然后我尝试使用以下命令创建一个集合:

  bin/solr create -c mycollection -d data_driven_schema_configs

然后我开始在Solr日志中看到很多错误,并且Zookeeper中出现了大量重复的消息:

这两个Solr错误一遍又一遍:

 java.io.IOException: Xid out of order. Got Xid 1299 with err 0
 expected Xid 1298 for a packet with details: clientPath:null
 serverPath:null finished:false header:: 1298,14  replyHeader:: 0,0,-4 
 request:: org.apache.zookeeper.MultiTransactionRecord@95acc4f3
 response:: org.apache.zookeeper.MultiResponse@0

 There was a problem trying to register as the leader:org.apache.solr.common.SolrException: 
 Could not register as the leader because creating the ephemeral registration 
 node in ZooKeeper failed

这来自Zookeeper:

[NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn$Factory@251] - Accepted socket connection from /172.28.128.4:54548
2016-08-21 21:33:39,137 - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@770] - Client attempting to renew session 0x156aefeba2d0004 at /172.28.128.4:54548
2016-08-21 21:33:39,145 - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1580] - Established session 0x156aefeba2d0004 with negotiated timeout 15000 for client /172.28.128.4:54548
2016-08-21 21:33:39,147 - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@593] - Dropping packet at server of type 14
2016-08-21 21:33:39,154 - WARN  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@634] - EndOfStreamException: Unable to read additional data from client sessionid 0x156aefeba2d0004, likely client has closed socket
2016-08-21 21:33:39,155 - INFO  [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1435] - Closed socket connection for client /172.28.128.4:54548 which had sessionid 0x156aefeba2d0004
2016-08-21 21:33:40,698 - INFO

我无法理解这里发生了什么。我觉得关键在于Solr错误:

Could not register as the leader because creating the ephemeral registration node in ZooKeeper failed

但是在搜索那个错误时,我找不到任何有用的东西。任何人都可以了解这里发生的事情吗?

2 个答案:

答案 0 :(得分:0)

将solr配置文件上传到zookeeper并尝试 check here

$  sh zkcli.sh -cmd upconfig -zkhost  <host:port> -confname <name for configset> -solrhome <solrhome> -confdir <path to directory with configset>

答案 1 :(得分:0)

这里的问题是我使用的是与当前版本的Solr(6.1.0)不兼容的Zookeeper(3.3.6)版本。

Solr试图使用那个版本的Zookeeper没有的功能,所以它失败了。

升级到Zookeeper 3.4.8解决了这个问题。