0

Is it possible in Apache kafka through the kafkacat command to see which partition is located in broker? for example: broker 0 partition 1,2

broker 1 partition 0,1,2

Many thanks

I use the .\bin\win\kafkacat -L -b hostname:port command it shows BROKERS and a partitions, but does not show a relationship between them.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
Bigsol
  • 1
  • 2

1 Answers1

0

You can use built-in kafka-topics --describe command. This will show replica placement and leader partition by broker IDs

But that same information is in latest release of kcat -L output

 1 topics:
  topic "foo" with 3 partitions:
    partition 0, leader 1001, replicas: 1001, isrs: 1001
    partition 1, leader 1001, replicas: 1001, isrs: 1001
    partition 2, leader 1001, replicas: 1001, isrs: 1001

1001 maps to broker.id in server.properties... If you want a reverse lookup to a host/IP, then you need to do extra work.

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
  • I just want to make sure I understood you correctly. output of kcat. topic "my-main_topic" with 4 partitions: partition 0, leader 0, replicas: 0, isrs: 0 partition 1, leader 2, replicas: 2, isrs: 2 partition 2, leader 2, replicas: 2, isrs: 2 partition 3, leader 0, replicas: 0, isrs: 0 . partition 0 found in broker 0, partition 1 found in broker 2. – Bigsol Jan 24 '23 at 20:59
  • If you have 3 brokers, you should create the topic with more than one replica, but yes – OneCricketeer Jan 24 '23 at 23:23