How to list all the available brokers in a Kafka cluster? - Big Data In Real World

How to list all the available brokers in a Kafka cluster?

How does Broadcast Nested Loop Join work in Spark?
January 8, 2021
How to merge multiple output files from MapReduce or Spark jobs to one?
January 13, 2021
How does Broadcast Nested Loop Join work in Spark?
January 8, 2021
How to merge multiple output files from MapReduce or Spark jobs to one?
January 13, 2021

There are 2 ways to get the list of available brokers in a Kafka cluster. Both with the help of scripts from zookeeper.

Zookeeper manages the leader election and other coordination things for a Kafka cluster. So Zookeeper has a list of all the Kafka brokers in the cluster.

Using zookeeper-shell.sh

zookeeper-shell.sh <zookeeper-host>:2181 ls /brokers/ids

You would see something like below

WATCHER::  WatchedEvent state:SyncConnected type:None path:null [0, 1, 2]

This means that you have 3 alive brokers – 0, 1 and 2

Using zkCli.sh 

Use zkCli.sh to login to Zookeeper client

zkCli.sh -server <zookeeper-host>:2181

Below will list all the available brokers in Kafka cluster

ls /brokers/ids

 

Big Data In Real World
Big Data In Real World
We are a group of Big Data engineers who are passionate about Big Data and related Big Data technologies. We have designed, developed, deployed and maintained Big Data applications ranging from batch to real time streaming big data platforms. We have seen a wide range of real world big data problems, implemented some innovative and complex (or simple, depending on how you look at it) solutions.

Comments are closed.

How to list all the available brokers in a Kafka cluster?
This website uses cookies to improve your experience. By using this website you agree to our Data Protection Policy.

Hadoop In Real World is now Big Data In Real World!

X