Kafka: How to Check Number of Brokers Present

Here is the command on how to check the number of brokers present in a Kafka Cluster.

The hear of Kafka cluster is a broker. In simple terms, you can say it as a process. That receives messages from publishers and gives permission to access messages by consumers.

You will learn in this post how find number of brokers present

Broker Id

The default broker id is -1. When you create a new broker, it adds to -1. Then, it gives a new broker id. The broker ids will be generated from reserved.broker.max.id + 1.

According to Wiki:

Kafka runs on a cluster of one or more servers (called brokers), and the partitions of all topics are distributed across the cluster nodes. Additionally, partitions are replicated to multiple brokers. This architecture allows Kafka to deliver massive streams of messages in a fault-tolerant fashion and has allowed it to replace some of the conventional messaging systems like Java Message Service (JMS), Advanced Message Queuing Protocol (AMQP), etc. Since the release, Kafka offers transactional writes, which provide an exactly-once stream.

Overview of Kafka

Two types of broker ids.

  1. User-generated
  2. Zookeeper generated broker id.

How to get Broker Ids

Here is the command:

linux$ ./zookeeper-shell.sh zookeeper-IPaddress:2181 | "ls /brokers/ids"

Just use the above command to get the number of brokers present in your host (Kafka Cluster).

Keep Reading


Popular Posts

7 AWS Interview Questions asked in Infosys, TCS

Hyperledger Fabric: 20 Real Interview Questions

How to Fix Python Syntax Errors Quickly

Python 'getsizeof' Command the Real Purpose

How to Check Log File in Kafka

5 HBase Vs. RDBMS Top Functional Differences

Python Dictionary Vs List With Examples

Blue Prism complete tutorials download now

Linux Relative Vs. Absolute Path Top Differences

How to Use the ps Command in Linux