SolrCloud选举领袖

SolrCloud election leader

我想使用 SolrCloud (Solr4.10.3).. 我关注这个 wiki(示例 B:https://wiki.apache.org/solr/SolrCloud#Example_B:_Simple_two_shard_cluster_with_shard_replicas

SolrCloud uses leaders and an overseer as an implementation detail. This means that some nodes/replicas will play special roles. You don't need to worry if the instance you kill is a leader or the cluster overseer - if you happen to kill one of these, automatic fail over will choose new leaders or a new overseer transparently to the user and they will seamlessly takeover their respective jobs. Any Solr instance can be promoted to one of these roles.

当我停止我 运行 动物园管理员的第一个实例时,我无法找到另一个领导者。

我在同一节点(Example2 日志文件)中获得此信息:

INFO  - 2015-03-03 11:35:39.508; org.apache.solr.cloud.OverseerElectionContext; I am going to be the leader 192.168.1.38:7574_solr
INFO  - 2015-03-03 11:35:39.548; org.apache.solr.common.cloud.SolrZkClient; makePath: /overseer_elect/leader
INFO  - 2015-03-03 11:35:39.576; org.apache.solr.cloud.Overseer; Overseer (id=93413623381032961-192.168.1.38:7574_solr-n_0000000001) starting
WARN  - 2015-03-03 11:35:39.957; org.apache.zookeeper.ClientCnxn$SendThread;    
Session 0x14bdf320ecf0001 for server 0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:9983,    
unexpected error, closing socket connection and attempting reconnect
java.io.IOException: An existing connection was forcibly closed by the remote host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
at org.apache.zookeeper.ClientCnxnSocketNIO.doIO(ClientCnxnSocketNIO.java:68)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:366)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
INFO  - 2015-03-03 11:35:40.064; org.apache.solr.common.cloud.ConnectionManager; Watcher org.apache.solr.common.cloud.ConnectionManager@1537a92 name:ZooKeeperConnection Watcher:localhost:9983 got event WatchedEvent state:Disconnected type:None path:null path:null type:None
INFO  - 2015-03-03 11:35:40.064; org.apache.solr.common.cloud.ConnectionManager; zkClient has disconnected

在其他节点(Example2B)中,我在日志文件中得到了它

INFO  - 2015-03-03 11:35:39.507; org.apache.solr.cloud.ShardLeaderElectionContext; Running the leader process for shard shard1
INFO  - 2015-03-03 11:35:39.553; org.apache.solr.cloud.ShardLeaderElectionContext; Checking if I (core=collection1,coreNodeName=core_node3) should try and be the leader.
INFO  - 2015-03-03 11:35:39.574; org.apache.solr.cloud.ShardLeaderElectionContext; My last published State was Active, it's okay to be the leader.
INFO  - 2015-03-03 11:35:39.578; org.apache.solr.cloud.ShardLeaderElectionContext; I may be the new leader - try and sync
WARN  - 2015-03-03 11:35:39.956; org.apache.zookeeper.ClientCnxn$SendThread; Session 0x14bdf320ecf0002 for server 0:0:0:0:0:0:0:1/0:0:0:0:0:0:0:1:9983, unexpected error, closing socket connection and attempting reconnect
java.io.IOException: An existing connection was forcibly closed by the remote host
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:379)
at org.apache.zookeeper.ClientCnxnSocketNIO.doIO(ClientCnxnSocketNIO.java:68)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:366)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)

我们可以在同一个实例中看到,有一个选举领导程序的调用,但它失败了。我没有看到问题。

如何自动获得另一个领导者?

我的 solr 服务器是否有特殊配置?

如何强制选举另一个领导者?

谢谢!

配置动物园管理员(主机:xxx.xxx.xxx.1):

tickTime=2000
initLimit=10
syncLimit=5
clientPort=2181
server.1=127.0.0.1:2888:3888

启动 Solr1(主机:xxx.xxx.xxx.2)

java -Dbootstrap_confdir=./solr/collection1/conf 
                 -Dcollection.configName=solr1 
                 -Dsolr.allow.unsafe.resourceloading=true 
                 -DzkHost=xxx.xxx.xxx.1:2181 
                 -DnumShards=2 
                 -jar start.jar

启动 Solr2(主机:xxx.xxx.xxx.3)

java -Djetty.port=8900 -DzkHost=xxx.xxx.xxx.1:2181 -jar start.jar

关闭所有防火墙!