Jin Lee
Jin Lee

Reputation: 3512

How to check Kafka server status or details?

Is there a command to show the details of Kafka server or the status of Kafka server? (I am not trying to find out if the kafka server is running.)

I can only find information on topic, partition, producer, and consumer CLI commands.

Upvotes: 15

Views: 68834

Answers (2)

Gery
Gery

Reputation: 649

You can activate JMX metrics by setting environment variable JMX_PORT.

$ export JMX_PORT=9010
$ ./bin/kafka-server-start.sh ./config/server.properties

Then, you can use jconsole or Java Mission Control to display cluster metrics.

Upvotes: 1

Nishu Tayal
Nishu Tayal

Reputation: 20830

If you are looking for the Kafka cluster broker status, you can use zookeeper cli to find the details for each broker as given below:

ls /brokers/ids returns the list of active brokers IDs on the cluster.

get /brokers/ids/<id> returns the details of the broker with the given ID.

Example :

kafka_2.12-1.1.1 % ./bin/zookeeper-shell.sh localhost:2181 ls /brokers/ids
Connecting to localhost:2181

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
[0]

kafka_2.12-1.1.1 % ./bin/zookeeper-shell.sh localhost:2181 get /brokers/ids/0
Connecting to localhost:2181

WATCHER::

WatchedEvent state:SyncConnected type:None path:null
{"listener_security_protocol_map":{"PLAINTEXT":"PLAINTEXT"},"endpoints":["PLAINTEXT://localhost:9092"],"jmx_port":-1,"host":"localhost","timestamp":"1558428038778","port":9092,"version":4}
cZxid = 0x116
ctime = Tue May 21 08:40:38 UTC 2019
mZxid = 0x116
mtime = Tue May 21 08:40:38 UTC 2019
pZxid = 0x116
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x16ad9830f16000b
dataLength = 188
numChildren = 0

You can put these steps in some shell script to get the details for all brokers.

Upvotes: 18

Related Questions