Kafka CLI Flashcards
What is the purpose of the kafka-topics.sh CLI script?
To manage Kafka topics, such as creating, deleting, listing, or describing them.
What type of properties does playground.config typically contain?
Connection properties, such as authentication and security settings.
What is the function of the -bootstrap-server option?
Specifies the Kafka broker to connect to.
What is the command to view all topics?
kafka-topics.sh –command-config playground.config –bootstrap-server cluster.playground.cdkt.io:9092 –list
How do you describe a specific topic?
Add the topic name and –describe to the kafka-topics.sh command.
kafka-topics.sh –command-config playground.config –botstrap-server cluster.playground.cdkt.io:9092 –topic first_topic –describe
What is a replication factor in Kafka?
The number of copies of a partition that are maintained across different brokers.
True or False: You can have a higher replication factor than the number of brokers available.
False.
What command is used to delete a topic?
kafka-topics.sh –command-config playground.config –bootstrap-server cluster.playground.cdkt.io:9092 –topic second_topic –delete
What is the purpose of the kafka-console-producer.sh command?
To produce data to a topic.
What happens when you produce to a non-existing topic?
You will get an error unless the command is run in local Kafka, which will create a topic with default config. (replica= 1, partition=1), warning.
Fill in the blank: The command to produce messages with keys is to use the property parse.key set to _______.
true
What does the –property key.separator=: do?
It separates the key and value in produced messages.
How do you consume messages from the tail of the topic?
kafka-console-consumer.sh –consumer.config playground.config –botstrap-server cluster.playground.cdkt.io:9092 –topic second_topic
What is the command to consume messages from the beginning of the topic?
Add –from-beginning to the kafka-console-consumer.sh command.
kafka-console-consumer.sh –consumer.config playground.config –botstrap-server cluster.playground.cdkt.io:9092 –topic second_topic –from-beginning
What does the –group option do in the consumer command?
It specifies that the consumer is part of a consumer group.