kumar
kumar

Reputation: 3035

How to find the kafka version in linux

How to find the kafka version in linux? whether there is a way to find the installed kafka version other than mentioning the version while downloading it?

Upvotes: 183

Views: 323751

Answers (18)

mrsrinivas
mrsrinivas

Reputation: 35424

Kafka 2.0 have the fix(KIP-278) for it:

kafka-topics.sh --version 

Or

kafka-topics --version

Running the above command in any of the brokers should output the version.

Upvotes: 133

SubrataG
SubrataG

Reputation: 161

I found an easy way to do this without searching directories or log files.

Navigate to the directory where Kafka is installed. Typically, this might be in '/opt/kafka', '/usr/local/kafka', or a similar directory depending on how Kafka was installed.

Run the following command:

bin/kafka-topics.sh --version

If Kafka is running inside a Docker container, use the following command:

docker exec <container_name> kafka-topics.sh --version

Upvotes: 1

samaneh noroozi
samaneh noroozi

Reputation: 31

Change directories to the Kafka home directory.

Use command-line utilities to enter the following command:

$  bin/kafka-topics.sh --version

It will return the version running:

$  bin/kafka-topics.sh --version
3.3.1 (Commit:e23c59d00e687ff5)

Upvotes: 2

amarVashishth
amarVashishth

Reputation: 877

cd confluent-7.2.0/share/java/kafka

then

$ ls -lha | grep kafka
-rw-r--r--  1 root root 5.3M Jul  5 09:45 kafka_2.13-7.2.0-ccs.jar
-rw-r--r--  1 root root 4.8M Jul  5 09:45 kafka-clients-7.2.0-ccs.jar
lrwxrwxrwx  1 root root   26 Jul 23 10:10 kafka.jar -> ./kafka_2.13-7.2.0-ccs.jar
-rw-r--r--  1 root root 9.4K Jul  5 09:45 kafka-log4j-appender-7.2.0-ccs.jar
-rw-r--r--  1 root root 458K Jul  5 09:45 kafka-metadata-7.2.0-ccs.jar
-rw-r--r--  1 root root 182K Jul  5 09:45 kafka-raft-7.2.0-ccs.jar
-rw-r--r--  1 root root  36K Jul  5 09:45 kafka-server-common-7.2.0-ccs.jar
-rw-r--r--  1 root root  84K Jul  5 09:45 kafka-shell-7.2.0-ccs.jar
-rw-r--r--  1 root root 151K Jul  5 09:45 kafka-storage-7.2.0-ccs.jar
-rw-r--r--  1 root root  23K Jul  5 09:45 kafka-storage-api-7.2.0-ccs.jar
-rw-r--r--  1 root root 1.6M Jul  5 09:45 kafka-streams-7.2.0-ccs.jar
-rw-r--r--  1 root root  41K Jul  5 09:45 kafka-streams-examples-7.2.0-ccs.jar
-rw-r--r--  1 root root 161K Jul  5 09:45 kafka-streams-scala_2.13-7.2.0-ccs.jar
-rw-r--r--  1 root root  52K Jul  5 09:45 kafka-streams-test-utils-7.2.0-ccs.jar
-rw-r--r--  1 root root 127K Jul  5 09:45 kafka-tools-7.2.0-ccs.jar

Upvotes: 0

Smaillns
Smaillns

Reputation: 3157

cd kafka

./bin/kafka-topics.sh --version

Upvotes: 6

Ricardo
Ricardo

Reputation: 4328

If you want to check the version of a specific Kafka broker, run this CLI on the broker*

kafka-broker-api-versions.sh --bootstrap-server localhost:9092 --version

where localhost:9092 is the accessible <hostname|IP Address>:<port> this API will check (localhost can be used if it's the same host you're running this command on). Example of output:

2.4.0 (Commit:77a89fcf8d7fa018)

* Apache Kafka comes with a variety of console tools in the ./bin sub-directory of your Kafka download; e.g. ~/kafka/bin/

Upvotes: 12

Shiva Garg
Shiva Garg

Reputation: 916

To check kafka version :

cd /usr/hdp/current/kafka-broker/libs
ls kafka_*.jar

Upvotes: -1

TBowman
TBowman

Reputation: 635

I found an easy way to do this without searching directories or log files:

kafka-dump-log --version

Output looks like this:

5.3.0-ccs (Commit:6481debc2be778ee)

Upvotes: 5

theNextBigThing
theNextBigThing

Reputation: 131

To find the Kafka Version, We can use the jps command which show all the java processes running on the machine.

Step 1: Let's say, you are running Kafka as the root user, so login to your machine with root and use jps -m. It will show the result like

4979 Jps -m
9434 Kafka config/server.properties

Step 2: From the above result, you can take the PID for Kafka application and use pwdx 9434 which reports the current directory of the process. the result will be like

9434: /apps/kafka_2.12-2.4.0

here you can see the Kafka version which is 2.12-2.4.0

Upvotes: 0

Kalin Borisov
Kalin Borisov

Reputation: 1120

You can use for Debian/Ubuntu:

dpkg -l|grep kafka

Expected result should to be like:

ii  confluent-kafka-2.11                   0.11.0.1-1                                 all          publish-subscribe messaging rethought as a distributed commit log
ii  confluent-kafka-connect-elasticsearch  3.3.1-1                                    all          Kafka Connect connector for copying data between Kafka and Elasticsearch
ii  confluent-kafka-connect-hdfs           3.3.1-1                                    all          Kafka Connect connector for copying data between Kafka and Hadoop HDFS
ii  confluent-kafka-connect-jdbc           3.3.1-1                                    all          Kafka Connect connector for JDBC-compatible databases
ii  confluent-kafka-connect-replicator     3.3.1-1                                    all          Kafka Connect connector for replicating topics between Kafka clusters
ii  confluent-kafka-connect-s3             3.3.1-1                                    all          Kafka Connect S3 connector for copying data between Kafka and
ii  confluent-kafka-connect-storage-common 3.3.1-1                                    all          Kafka Connect Storage Common contains packages used by storage
ii  confluent-kafka-rest                   3.3.1-1                                    all          A REST proxy for Kafka

Upvotes: 5

Hartmut
Hartmut

Reputation: 776

Simple way on macOS e.g. installed via homebrew

$ ls -l $(which kafka-topics)
/usr/local/bin/kafka-topics -> ../Cellar/kafka/0.11.0.1/bin/kafka-topics

Upvotes: 7

notNull
notNull

Reputation: 31530

There are several methods to find kafka version

Method 1 simple:-

ps -ef|grep kafka

it will displays all running kafka clients in the console... Ex:- /usr/hdp/current/kafka-broker/bin/../libs/kafka-clients-0.10.0.2.5.3.0-37.jar we are using 0.10.0.2.5.3.0-37 version of kafka

Method 2:- go to

cd /usr/hdp/current/kafka-broker/libs
ll |grep kafka

Ex:- kafka_2.10-0.10.0.2.5.3.0-37.jar kafka-clients-0.10.0.2.5.3.0-37.jar

same result as method 1 we can find the version of kafka using in kafka libs.

Upvotes: 39

MD5
MD5

Reputation: 1786

go to kafka/libs folder we can see multiple jars search for something similar kafka_2.11-0.10.1.1.jar.asc in this case the kafka version is 0.10.1.1

Upvotes: 4

Ankit Maheshwari
Ankit Maheshwari

Reputation: 49

You can also type

cat /build.info

This will give you an output like this

BUILD_BRANCH=master
BUILD_COMMIT=434160726dacc4a1a592fe6036891d6e646a3a4a
BUILD_TIME=2017-05-12T16:02:04Z
DOCKER_REPO=index.docker.io/landoop/fast-data-dev
KAFKA_VERSION=0.10.2.1
CP_VERSION=3.2.1

Upvotes: -1

Karima Rafes
Karima Rafes

Reputation: 1108

When you install Kafka in Centos7 with confluent :

yum install confluent-platform-oss-2.11

You can see the version of Kafka with :

yum deplist confluent-platform-oss-2.11

You can read : confluent-kafka-2.11 >= 0.10.2.1

Upvotes: 0

tolitius
tolitius

Reputation: 22549

You can grep the logs to see the version. Let's say kafka is installed under /usr/local/kafka, then:

$ grep "Kafka version" /usr/local/kafka/logs/*

/usr/local/kafka/logs/kafkaServer.out: INFO Kafka version : 0.9.0.1 (org.apache.kafka.common.utils.AppInfoParser)

will reveal the version

Upvotes: 28

Salvador Dali
Salvador Dali

Reputation: 222849

There is nothing like kafka --version at this point. So you should either check the version from your kafka/libs/ folder or you can run

find ./libs/ -name \*kafka_\* | head -1 | grep -o '\kafka[^\n]*'

from your kafka folder (and it will do the same for you). It will return you something like kafka_2.9.2-0.8.1.1.jar.asc where 0.8.1.1 is your kafka version.

Upvotes: 53

serejja
serejja

Reputation: 23881

Not sure if there's a convenient way, but you can just inspect your kafka/libs folder. You should see files like kafka_2.10-0.8.2-beta.jar, where 2.10 is Scala version and 0.8.2-beta is Kafka version.

Upvotes: 135

Related Questions