Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how do you get default Kafka configs global and per topic from command line?

Tags:

apache-kafka

How do you get default Kafka configs global and per topic from the command line or other ways?

I know the defaults are available on Broker Configs and you can get per topic "overrides" using describe, but if I make many changes to topic level configuration, it would be nice to get all values including the overrides per topic.

$KAFKA_HOME/bin/kafka-topics.sh --zookeeper $ZK --describe --topic test-topic $KAFKA_HOME/bin/kafka-configs.sh --zookeeper $ZK --describe --entity-name test-topic --entity-type topics 

FYI, I am just getting started with kafka v0.9.0.1.

Apparently, there is a discussion about why this is not possible, so I guess there is no solution.

like image 411
kisna Avatar asked Mar 14 '16 20:03

kisna


People also ask

Where are Kafka configuration files?

The Kafka configuration files are located at the /opt/bitnami/kafka/config/ directory.

How do I check topic details in Kafka?

You can use the bin/kafka-topics.sh shell script along with the Zookeeper service URL as well as the –list option to display a list of all the topics in the Kafka cluster. You can also pass the Kafka cluster URL to list all topics.

Which command is used in Kafka to retrieve messages from a topic?

Kafka provides the utility kafka-console-consumer.sh which is located at ~/kafka-training/kafka/bin/kafka-console-producer.sh to receive messages from a topic on the command line.


1 Answers

Since Kafka 2.5.0 (see https://issues.apache.org/jira/browse/KAFKA-9040), you can now use the --all option to see all (default and overridden) topic configuration:

% kafka-configs --bootstrap-server <KAFKA_SERVERS> --entity-type topics --entity-name <TOPIC_NAME> --describe --all All configs for topic <TOPIC_NAME> are:   compression.type=producer sensitive=false synonyms={}   message.format.version=1.0-IV0 sensitive=false synonyms={}   file.delete.delay.ms=60000 sensitive=false synonyms={}   leader.replication.throttled.replicas= sensitive=false synonyms={}   max.message.bytes=1000012 sensitive=false synonyms={}   min.compaction.lag.ms=0 sensitive=false synonyms={}   message.timestamp.type=CreateTime sensitive=false synonyms={}   min.insync.replicas=1 sensitive=false synonyms={}   segment.jitter.ms=0 sensitive=false synonyms={}   preallocate=false sensitive=false synonyms={}   index.interval.bytes=4096 sensitive=false synonyms={}   min.cleanable.dirty.ratio=0.5 sensitive=false synonyms={}   unclean.leader.election.enable=false sensitive=false synonyms={}   retention.bytes=-1 sensitive=false synonyms={}   delete.retention.ms=86400000 sensitive=false synonyms={}   cleanup.policy=delete sensitive=false synonyms={}   flush.ms=1000 sensitive=false synonyms={}   follower.replication.throttled.replicas= sensitive=false synonyms={}   segment.bytes=1073741824 sensitive=false synonyms={}   retention.ms=172800000 sensitive=false synonyms={}   segment.ms=604800000 sensitive=false synonyms={}   message.timestamp.difference.max.ms=9223372036854775807 sensitive=false synonyms={}   flush.messages=10000 sensitive=false synonyms={}   segment.index.bytes=10485760 sensitive=false synonyms={} 

As you can see in the PR, you can use this option for (at least) broker config too.

Also note that this option does not currently exist in kafka-topics CLI.

like image 55
user Avatar answered Sep 25 '22 08:09

user