3 Important Commands
This topic provides the information about the important commands used for Kafka configuration.
View the Topic Configurations
./kafka-topics.sh --describe --zookeeper zookeeper-server --topic topic-name
./kafka-topics.sh --describe --zookeeper localhost:2181 --topic structure-closed
Topic: structure-closed PartitionCount: 2 ReplicationFactor: 2 Configs:
Topic: structure-closed Partition: 0 Leader: 1 Replicas: 1,0 Isr: 1,0
Topic: structure-closed Partition: 1 Leader: 0 Replicas: 0,1 Isr: 0,1
View the Messages Sent from producer-consumer
./kafka-console-consumer.sh --bootstrap-server Kafka-server --topic topic-name
./kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic structure-closed
Create Kafka Topics manually
./kafka-topics.sh --create --bootstrap-server kafka-server --replication-factor factor-value --partitions partition-value --topic topic-name
./kafka-topics.sh --create --bootstrap-server localhost:9092 --replication-factor 2 --partitions 2 --topic structure-closed
If the topics are created manually before the microservice deployment, then the values in the above command is considered otherwise if we are depending on the microservice deployment then the values configured in the server.properties file of Kafka is considered when the topics are created.
Configurations pertinent to topics have both a server default as well an optional per-topic override. If no per-topic configuration is given the server default is used. The override can be set at topic creation time by giving one or more --config options.