SolrCloud选举领导人

时间:2015-03-03 10:31:08

标签: solr solrcloud

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

  

SolrCloud使用领导者和监督者作为实施细节。   这意味着某些节点/副本将扮演特殊角色。你没有   如果您杀死的实例是领导者或群集,则需要担心   监督 - 如果您碰巧杀死其中一个,自动故障转移   将为用户透明地选择新的领导者或新的监督者   他们将无缝地接管各自的工作。任何Solr   实例可以升级为其中一个角色。

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

我在同一节点(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

在其他节点(例子2B)中,我在日志文件

中得到它
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服务器中是否有特殊配置?

如何强迫另一位领导人当选?

THX!

1 个答案:

答案 0 :(得分:0)

config zookeeper(host: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

关闭所有防火墙!