...
The kafka-broker.sh command can be is modeled after the kafka-topic.sh and can have has the following options:
--zookeeper <zookeeper,port> : zookeeper URL
...
The command will essentially provide the following pieces of information:
Cluster Overview Broker Information
- Controller Broker Id (and version/epoch information)
- Broker Count
- Total Topic Count
- Total Partition Count
Broker Information
- Hostname
- Rack
- Endpoints
- Topic count (i.e. how many topics are hosted by the broker)
- All partition count (i.e. how many partition replicas are hosted by the broker)
- Leader partition count (i.e. how many leader partitions are hosted by the broker)
- Insync partition count (i.e, how many follower partitions are insync)
- Broker Id
- Rack Id
- Hostname
- Endpoints (protocol, port)
- JMX port
- Topic count
- All partition count
- Leader partition count
- Under-replicated partition count Topic partitions (Name, *partition-(i.e. how many partitions are not insync)
- An asterisk would indicate that the broker is the leader for that partition.
With commandline options, topic names and partition numbers can be enumerated.
Command Options
The command kafka-brokers.sh requires zookeeper information and additional accepts other options as show below:
Code Block | ||
---|---|---|
| ||
$ ./kafka-brokers.sh
Missing required argument "[zookeeper]"
Option Description
------ -----------
--broker <Integer: broker-id> Filter for a broker. Option can be
used multiple times for multiple
broker-ids
--details if specified, shows detailed listing
of topics and partitions
--host <hostname> Filter for a hostname. Option can be
used multiple times for multiple
hostnames
--partition-details if specified, shows partitions in each
topic
--rack <rack> Filter for a rack. Option can be used
multiple times for multiple racks
--topic <topic> Filter for a topic. Option can be used
multiple times for multiple topics
--topic-details if specified, shows topics and
partition counts in each topic
--zookeeper <zkurl> REQUIRED: The connection string for
zookeeper(s) in the form host:port,
host:port/zkchroot or host1,host2,
host3:port/zkchroot. |
The options "–broker", "–host", "–rack" and "–topic" provide filtering for the specified broker (broker-id), host, rack or topic. Each of the options can be specified multiple times. The option "--topic-details" makes the command to enumerate all the topic names in addition to giving the topic count. The option "--partition-details" makes the command to enumerate all the partitions for each topic. The partitions have an an optional prefix of "+" or "-" to indicate that the partition is a leader partition or an under-replicated partition respectively. An insync replica partition will not have any prefix.
Here are examples usages of the command.
Code Block | ||
---|---|---|
| ||
$ ./kafka-brokers.sh --zookeeper zk1,zk2,zk3:2181
BrokerId: 1 Hostname: host1 Rack: rack1 Endpoints: (host1,9092,PLAINTEXT), (host1,9093,SSL) Topics: 2 Partitions: 12 Leaders: 4 InSync: 8 Trailing: 0
BrokerId: 2 Hostname: host2 Rack: rack2 Endpoints: (host2,9092,PLAINTEXT), (host2,9093,SSL) Topics: 2 Partitions: 12 Leaders: 4 InSync: 8 Trailing: 0
BrokerId: 3 Hostname: host3 Rack: rack3 Endpoints: (host3,9092,PLAINTEXT), (host3,9093,SSL) Topics: 2 Partitions: 12 Leaders: 4 InSync: 8 Trailing: 0 |
Code Block | ||
---|---|---|
| ||
BrokerId: 1 Hostname: host1 Rack: rack1 Endpoints: (host1,9092,PLAINTEXT), (host1,9093,SSL) Topics: 2 Partitions: 12 Leaders: 4 InSync: 8 Trailing: 0 Topic Details: topic2 with 6 partitions, topic1 with 6 partitions
BrokerId: 2 Hostname: host2 Rack: rack2 Endpoints: (host2,9092,PLAINTEXT), (host2,9093,SSL) Topics: 2 Partitions: 12 Leaders: 4 InSync: 8 Trailing: 0 Topic Details: topic2 with 6 partitions, topic1 with 6 partitions
BrokerId: 3 Hostname: host3 Rack: rack3 Endpoints: (host3,9092,PLAINTEXT), (host3,9093,SSL) Topics: 2 Partitions: 12 Leaders: 4 InSync: 8 Trailing: 0 Topic Details: topic2 with 6 partitions, topic1 with 6 partitions |
Code Block | ||
---|---|---|
| ||
BrokerId: 1 Hostname: host1 Rack: rack1 Endpoints: (host1,9092,PLAINTEXT), (host1,9093,SSL) Topics: 2 Partitions: 12 Leaders: 4 InSync: 8 Trailing: 0 Partition Details: (topic2: 5,4,+3,2,1,+0), (topic1: 5,4,+3,2,1,+0)
BrokerId: 2 Hostname: host2 Rack: rack2 Endpoints: (host2,9092,PLAINTEXT), (host2,9093,SSL) Topics: 2 Partitions: 12 Leaders: 4 InSync: 8 Trailing: 0 Partition Details: (topic2: 5,+4,3,2,+1,0), (topic1: 5,+4,3,2,+1,0)
BrokerId: 3 Hostname: host3 Rack: rack3 Endpoints: (host3,9092,PLAINTEXT), (host3,9093,SSL) Topics: 2 Partitions: 12 Leaders: 4 InSync: 8 Trailing: 0 Partition Details: (topic2: +5,4,3,+2,1,0), (topic1: +5,4,3,+2,1,0) |
Code Block | ||
---|---|---|
| ||
BrokerId: 1 Hostname: host1 Rack: rack1 Endpoints: (host1,9092,PLAINTEXT), (host1,9093,SSL) Topics: 2 Partitions: 12 Leaders: 4 InSync: 8 Trailing: 0 Topic Details: topic2 with 6 partitions, topic1 with 6 partitions Partition Details: (topic2: 5,4,+3,2,1,+0), (topic1: 5,4,+3,2,1,+0)
BrokerId: 2 Hostname: host2 Rack: rack2 Endpoints: (host2,9092,PLAINTEXT), (host2,9093,SSL) Topics: 2 Partitions: 12 Leaders: 4 InSync: 8 Trailing: 0 Topic Details: topic2 with 6 partitions, topic1 with 6 partitions Partition Details: (topic2: 5,+4,3,2,+1,0), (topic1: 5,+4,3,2,+1,0)
BrokerId: 3 Hostname: host3 Rack: rack3 Endpoints: (host3,9092,PLAINTEXT), (host3,9093,SSL) Topics: 2 Partitions: 12 Leaders: 4 InSync: 8 Trailing: 0 Topic Details: topic2 with 6 partitions, topic1 with 6 partitions Partition Details: (topic2: +5,4,3,+2,1,0), (topic1: +5,4,3,+2,1,0) |
A hyphen/negative sign would indicates that the partition is not in-sync.As you can see, the above information provides a view of the cluster and brokers that complements kafka-topics.sh.
Compatibility, Deprecation, and Migration Plan
...