Complete the code to create a Kafka topic with 3 partitions.
bin/kafka-topics.sh --create --topic my-topic --partitions [1] --bootstrap-server localhost:9092
The --partitions option sets the number of partitions for the topic. Here, 3 partitions are specified.
Complete the code to set the replication factor to 2 when creating a Kafka topic.
bin/kafka-topics.sh --create --topic my-topic --replication-factor [1] --bootstrap-server localhost:9092
The --replication-factor option sets how many copies of the data are kept. Here, 2 copies are specified.
Fix the error in the command to set the cleanup policy to 'compact' for a Kafka topic.
bin/kafka-configs.sh --alter --entity-type topics --entity-name my-topic --add-config cleanup.policy=[1] --bootstrap-server localhost:9092
The cleanup.policy can be set to compact to enable log compaction on the topic.
Fill both blanks to create a topic with 4 partitions and a retention time of 1 day (86400000 ms).
bin/kafka-topics.sh --create --topic my-topic --partitions [1] --config retention.ms=[2] --bootstrap-server localhost:9092
The --partitions option sets 4 partitions. The retention.ms config sets retention time in milliseconds; 86400000 ms equals 1 day.
Fill all three blanks to create a topic named 'logs' with 6 partitions, replication factor 3, and cleanup policy 'delete'.
bin/kafka-topics.sh --create --topic logs --partitions [1] --replication-factor [2] --config cleanup.policy=[3] --bootstrap-server localhost:9092
The topic is created with 6 partitions, replication factor 3, and cleanup policy set to 'delete' to remove old data.