Complete the code to set the replication factor to 3 when creating a Kafka topic.
kafka-topics --create --topic my-topic --partitions 1 --replication-factor [1] --bootstrap-server localhost:9092
The replication factor defines how many copies of the data are kept across Kafka brokers. Setting it to 3 means the data is replicated on 3 brokers.
Complete the code to describe the replication factor of the topic named 'orders'.
kafka-topics --describe --topic orders --bootstrap-server localhost:9092 | grep ReplicationFactor:[1]
The command filters the topic description to show lines with replication factor 3, which is common for production topics.
Fix the error in the command to create a topic with replication factor 2.
kafka-topics --create --topic test-topic --partitions 3 --replication-factor [1] --bootstrap-server localhost:9092
Replication factor must be a positive integer and cannot exceed the number of brokers. 2 is valid if you have at least 2 brokers.
Fill both blanks to create a topic with 4 partitions and replication factor 3.
kafka-topics --create --topic logs --partitions [1] --replication-factor [2] --bootstrap-server localhost:9092
The topic 'logs' is created with 4 partitions and a replication factor of 3 for good parallelism and fault tolerance.
Fill all three blanks to create a topic with replication factor 2, 5 partitions, and bootstrap server at localhost:9093.
kafka-topics --create --topic metrics --partitions [1] --replication-factor [2] --bootstrap-server [3]
This command creates the 'metrics' topic with 5 partitions, replication factor 2, and connects to the Kafka server at localhost:9093.