[英]How to force a leader on SolrCloud?
I have a 5-node SolrCloud (Solr 7.0) with an external 3-node Zookeeper ensemble.我有一个带有外部 3 节点 Zookeeper 集成的 5 节点 SolrCloud (Solr 7.0)。 There is one collection called "production" that is sharded to 5 shards with a replication factor of 5. See the screenshot below:
有一个名为“production”的集合被分片为 5 个分片,复制因子为 5。请参见下面的屏幕截图:
shard5 was struggling to elect a new leader for a long time and other cores were complaining with the following error: shard5 很长一段时间都在努力选举新的领导者,其他核心抱怨以下错误:
azsolr1 solr: 2018-08-28 19:32:43.575 ERROR (qtp1124317168-9304) [c:production s:shard2 r:core_node9 x:production_shard2_replica_n4] oashRequestHandlerBase org.apache.solr.common.SolrException: No registered leader was found after waiting for 4000ms , collection: production slice: shard5
azsolr1 solr:2018-08-28 19:32:43.575 错误(qtp1124317168-9304)[c:production s:shard2 r:core_node9 x:production_shard2_replica_n4]等待 4000 毫秒,集合:生产切片:shard5
After restarting all nodes one by one (I even restarted the zookeeper nodes), I had no luck in electing the only active replica (azsolr1) as the leader.一一重启所有节点后(我什至重启了zookeeper节点),我没有运气选择唯一的活动副本(azsolr1)作为领导者。 I then unloaded the 4 replicas with the 'down' state using the CoreAdmin API UNLOAD command which caused the replicas to disappear completely.
然后我使用CoreAdmin API UNLOAD命令卸载了 4 个处于“关闭”状态的副本,这导致副本完全消失。
With that setup, trying to force the leader of the shard using the Collection API FORCELEADER does nothing.使用该设置,尝试使用Collection API FORCELEADER强制分片的领导者什么也不做。 I also tried this before unloading the cores.
在卸载内核之前,我也试过这个。
Here is the current status:这是目前的状态:
Why can't Solr just elect the only active replica for shard 5 as the leader?为什么 Solr 不能只选举分片 5 的唯一活动副本作为领导者? Isn't this obvious, especially after forcing the leader on the shard?
这不是很明显,尤其是在强制领导者进入分片之后?
Assuming the leader was elected successfully somehow, do I recreate the replicas that I deleted using the Collection API ADDREPLICA ?假设以某种方式成功选举了领导者,我是否使用Collection API ADDREPLICA重新创建我删除的副本? In this case, should I reuse the same
instanceDir
and dataDir
of the deleted replicas?在这种情况下,我应该重用已删除副本的相同
instanceDir
和dataDir
吗? Or I just let it replicate from scratch?或者我只是让它从头开始复制?
I had the same problem.我有同样的问题。
one collection with 3 replicas (solr1 --> was a leader before, solr2, solr3).一个包含 3 个副本的集合(solr1 --> 之前是领导者,solr2,solr3)。 one of the shards has no leader!
其中一个碎片没有领导者! and I did these steps :
我做了这些步骤:
1 - stop solr2 and solr3 1 - 停止solr2和solr3
2- call FORCE LEADER API ( http://xx.xx.xxx.xx:8983/solr/admin/collections?action=FORCELEADER&collection=your_collection_name&shard=shard1
) 2- 调用 FORCE LEADER API (
http://xx.xx.xxx.xx:8983/solr/admin/collections?action=FORCELEADER&collection=your_collection_name&shard=shard1
)
3 - after a few minutes solr1 elected as a leader 3 - after a few minutes solr1 elected as a leader
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.