Tuesday, October 10, 2023

Apache Kafka CLI kcat

 HOWTO


Install kcat
$ sudo dnf install kafkacat
[sudo] password for dave: 
Last metadata expiration check: 0:30:11 ago on Tue 10 Oct 2023 08:36:11 AM CEST.
Dependencies resolved.
=================================================================================================================================================
 Package                            Architecture                   Version                                 Repository                       Size
=================================================================================================================================================
Installing:
 kcat                               x86_64                         1.7.1-1.fc37                            updates                          39 k
Installing dependencies:
 librdkafka                         x86_64                         1.6.1-5.fc37                            fedora                          662 k

Transaction Summary
=================================================================================================================================================
Install  2 Packages

Total download size: 701 k
Installed size: 2.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): kcat-1.7.1-1.fc37.x86_64.rpm                                                                              192 kB/s |  39 kB     00:00    
(2/2): librdkafka-1.6.1-5.fc37.x86_64.rpm                                                                        2.8 MB/s | 662 kB     00:00    
-------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                            1.0 MB/s | 701 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                         1/1 
  Installing       : librdkafka-1.6.1-5.fc37.x86_64                                                                                          1/2 
  Installing       : kcat-1.7.1-1.fc37.x86_64                                                                                                2/2 
  Running scriptlet: kcat-1.7.1-1.fc37.x86_64                                                                                                2/2 
  Verifying        : librdkafka-1.6.1-5.fc37.x86_64                                                                                          1/2 
  Verifying        : kcat-1.7.1-1.fc37.x86_64                                                                                                2/2 

Installed:
  kcat-1.7.1-1.fc37.x86_64                                             librdkafka-1.6.1-5.fc37.x86_64                                            

Complete!
[dave@dave go]$ which kcat
/usr/bin/kcat

list server state
$ kcat -b localhost:9094 -L
Metadata for all topics (from broker -1: localhost:9094/bootstrap):
 3 brokers:
  broker 106 at dave:9096 (controller)
  broker 103 at dave:9095
  broker 102 at dave:9094
 7 topics:
  topic "test_topic_5" with 1 partitions:
    partition 0, leader 102, replicas: 102,103,106, isrs: 102,103,106
  topic "test1" with 1 partitions:
    partition 0, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
  topic "test_topic_2" with 1 partitions:
    partition 0, leader 103, replicas: 103,102,106, isrs: 103,102,106
  topic "__consumer_offsets" with 50 partitions:
    partition 0, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 1, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 2, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 3, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 4, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 5, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 6, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 7, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 8, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 9, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 10, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 11, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 12, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 13, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 14, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 15, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 16, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 17, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 18, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 19, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 20, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 21, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 22, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 23, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 24, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 25, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 26, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 27, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 28, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 29, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 30, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 31, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 32, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 33, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 34, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 35, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 36, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 37, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 38, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 39, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 40, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 41, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 42, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 43, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 44, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 45, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 46, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 47, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 48, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
    partition 49, leader -1, replicas: 100, isrs: 100, Broker: Leader not available
  topic "test_topic_3" with 3 partitions:
    partition 0, leader 106, replicas: 106,103,102, isrs: 106,103,102
    partition 1, leader 103, replicas: 103,102,106, isrs: 103,102,106
    partition 2, leader 102, replicas: 102,106,103, isrs: 102,106,103
  topic "test_topic_4" with 2 partitions:
    partition 0, leader 102, replicas: 102,103, isrs: 102,103
    partition 1, leader 103, replicas: 103,106, isrs: 103,106
  topic "T3" with 1 partitions:
    partition 0, leader -1, replicas: 100, isrs: 100, Broker: Leader not available

No comments:

Post a Comment