简体   繁体   English

kafka集群的Zookeeper故障转移

[英]zookeeper failover for kafka cluster

I am wondering is there any way to make the zookeeper failover for kafka cluster. 我想知道是否有任何方法可以使kafka集群的zookeeper故障转移。 For example: i want to setup 2 zookeeper instances for my kafka cluster. 例如:我想为我的kafka集群设置2个zookeeper实例。 In case of one zookeeper fails, Kafka servers still able to read metadata of topics from second zookeeper. 万一一个动物园管理员失败,Kafka服务器仍然能够从第二个动物园管理员读取主题的元数据。

any advice is highle appricicated. 任何建议都是值得的。

Zookeeper works as a so-called quorum – a cluster of nodes that forms a consensus based on simple majority votes. Zookeeper的工作原理就是所谓的仲裁-由简单的多数表决形成共识的节点簇。

For production, you should use 3 or 5 Zookeeper instances in a quorum. 对于生产,您应在仲裁中使用3或5个Zookeeper实例。 If you're using 3, your cluster can survive losing one server (because the remaining two form a simple majority). 如果您使用的是3,则群集可以在丢失一台服务器的情况下幸免(因为其余两台服务器占多数)。 With 5, you can lose two servers because 3 is a majority of 5. 使用5,您可能会丢失两台服务器,因为3是5的多数。

2 is a bad idea because your cluster won't work if 1 node goes down. 2是个坏主意,因为如果1个节点出现故障,您的群集将无法工作。

Please check this question 请检查这个问题

$KAFKA_HOME/config/server.properties

Here you can set multiple zookeeper 在这里您可以设置多个Zookeeper

zookeeper.connect=<server1>:2181,<server2>:2181,<server2>:2181

Maintain 2n+1(quorum ) rule in case of zookeeper 保持2n + 1(法定人数)规则,以防饲养员

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM