简体   繁体   English

Kafka集群通过ansible重启

[英]Kafka cluster restart via ansible

What's the suggested way to restart all kafka server that are part of a cluster?重新启动作为集群一部分的所有 kafka 服务器的建议方法是什么?

The nature of the question borns because we manage it via ansible , and we have a notify on changes regarding for example server.properties, so the restart will happen concurrently.问题的本质是因为我们通过ansible管理它,并且我们有关于例如 server.properties 的更改的notify ,因此重启将同时发生。

Usually when a broker disappear there is a re-balance of the data, so I'm wondering what happens if all brokers are rebooted at the same time.通常当代理消失时,数据会重新平衡,所以我想知道如果所有代理同时重新启动会发生什么。

Restarting an application in the sensible manner is tricky topic.以合理的方式重新启动应用程序是一个棘手的话题。 To make it works you need to gather requirements:要使其工作,您需要收集要求:

  • What is better - a single restart with possibility of no restart (at most once) or guaranteed restart with possibility of multiple restart (at least once)更好的是 - 单次重启可能不会重启(最多一次)或保证重启可能多次重启(至少一次)
  • How to detect if the node is fine to restart?如何检测节点是否可以重新启动?

Depending on the first question you may want to use file flags (in /tmp) to indicate that restart is pending (and use this flag as persistent storage for app restart if playbook failed in the middle).根据第一个问题,您可能希望使用文件标志(在 /tmp 中)来指示重启正在挂起(如果 playbook 在中间失败,则使用此标志作为应用程序重启的持久存储)。

For the second question the best way is to query something outside Ansible (fe some API server, monitoring server, etc) to see if restart is permitted.对于第二个问题,最好的方法是查询 Ansible 之外的内容(例如某些 API 服务器、监控服务器等)以查看是否允许重新启动。

The most safe and slow approach is to run restart playbook with serial: 1 and multiple checks before restarting the node.最安全和最慢的方法是在重启节点之前使用serial: 1和多次检查运行重启剧本。

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

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