How to find the kafka version in linux

2019-02-01 16:09发布

问题:

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?

回答1:

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.



回答2:

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.



回答3:

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.



回答4:

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



回答5:

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

kafka-topics.sh --version

Using confluent utility:

Kakfa version check can be done with confluent utility which comes by default with Confluent platform(confluent utility can be added to cluster separately as well - credits cricket_007).

${confluent.home}/bin/confluent version kafka

Checking the version of other Confluent platform components like ksql schema-registry and connect

[confluent-4.1.0]$ ./bin/confluent version kafka
1.1.0-cp1

[confluent-4.1.0]$ ./bin/confluent version connect
4.1.0

[confluent-4.1.0]$ ./bin/confluent version schema-registry
4.1.0

[confluent-4.1.0]$ ./bin/confluent version ksql-server
4.1.0


回答6:

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


回答7:

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



回答8:

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



回答9:

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


回答10:

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