How to ensure a kafka cluster is fully up?

前端 未结 2 1148
遇见更好的自我
遇见更好的自我 2021-01-26 00:28

We have five node cluster running in production with 3 zookeepers - all are VMs. We have to restart the cluster often for some hardware patching.

We have written an ans

相关标签:
2条回答
  • 2021-01-26 01:25

    From the Java API, you can use AdminClient#describeCluster, which can return you the list of nodes in the cluster currently known to the Controller.


    Also, do not do broker rolling restarts like that. You should first identify which is the Contoller, then shut that down last.

    0 讨论(0)
  • 2021-01-26 01:32

    Once all brokers have been started we can use following cmds, to check whether they have formed a cluster or not.

    • From kafka-1 run the following command against the rest of the brokers, i.e. i = 2, 3, 4 and 5:

      • nc -vz kafka-i 9092 [It should return connection succeeded]
    • tail the server.log in each broker node. It should give the info about the cluster.

    • From Kafka bin directory, You can periodically run ./zookeeper-shell.sh zk_host:zk_port and execute ls /brokers/ids. It should gives you five entries, e.g. [0, 1, 2, 3, 4] if all 5 brokers have registered to the zookeeper.

    One dirty (less involved) hack might be to create a test topic with 5 partitions, and wait until each broker gets 1 partition to itself.

    0 讨论(0)
提交回复
热议问题