How to list all available Kafka brokers in a cluster?

后端 未结 9 1145
甜味超标
甜味超标 2020-12-22 23:50

I am writing a shell script to monitor kafka brokers.

I have gone through some links and found that if ZooKeeper contains a list of brokers, and if, in this list, th

相关标签:
9条回答
  • 2020-12-23 00:19

    Using Confluent's REST Proxy API v3:

    curl -X GET -H "Accept: application/vnd.api+json" localhost:8082/v3/clusters
    

    where localhost:8082 is Kafka Proxy address.

    0 讨论(0)
  • 2020-12-23 00:20

    This command will give you the list of the active brokers between brackets:

    ./bin/zookeeper-shell.sh localhost:2181 ls /brokers/ids
    
    0 讨论(0)
  • 2020-12-23 00:21

    To use zookeeper commands with shell script try

    zookeeper/bin/zkCli.sh -server localhost:2181 <<< "ls /brokers/ids" | tail -n 1. The last line usually has the response details

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