Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

kafka AdminClient get kafka version

Tags:

apache-kafka

Is there a way to get the version of kafka cluster programmatically? Such as, using AdminClient API.

I want to identify the version of kafka cluster in a consumer/producer app.

like image 985
niaomingjian Avatar asked Oct 15 '25 18:10

niaomingjian


2 Answers

At the moment there is no way to retrieve the Kafka version brokers are running.

There is a KIP in progress to add that feature to the AdminClient: KIP-483: Add Broker Version API in Admin Client so that may be availabble in a future version.

In the meantime, there are a few workarounds you can try:

  • Use describeConfigs() to find the inter.broker.protocol.version config of the brokers. If that returns 2.2-IV1, it means the broker is running at least 2.2.

  • Check the ApiVersions response. Upon starting clients send an ApiVersions request and the response is written in the logs (at the INFO level). Or manually send an ApiVersions, it's pretty easy to craft such a request as it's an empty body. Then you can identify the broker version using https://cwiki.apache.org/confluence/display/KAFKA/Kafka+APIs

like image 119
Mickael Maison Avatar answered Oct 18 '25 15:10

Mickael Maison


You can use AppInfoParser.getVersion(); in your consumer/producer code.

like image 32
sev7e0 Avatar answered Oct 18 '25 16:10

sev7e0