Bird
0
0

Which of the following is the correct syntax to set the number of partitions for a Kafka topic using the CLI?

easy📝 Syntax Q3 of 15
Kafka - Kubernetes and Cloud Deployment
Which of the following is the correct syntax to set the number of partitions for a Kafka topic using the CLI?
Akafka-topics.sh --alter --topic myTopic --partitions 10 --bootstrap-server localhost:9092
Bkafka-topics.sh --create --topic myTopic --partitions=10 --zookeeper localhost:2181
Ckafka-topics.sh --delete --topic myTopic --partitions 10 --bootstrap-server localhost:9092
Dkafka-topics.sh --list --topic myTopic --partitions 10 --zookeeper localhost:2181
Step-by-Step Solution
Solution:
  1. Step 1: Identify the command to alter partitions

    To change partitions, use --alter with --partitions option.
  2. Step 2: Check the correct syntax for altering partitions

    kafka-topics.sh --alter --topic myTopic --partitions 10 --bootstrap-server localhost:9092 uses --alter, --topic, --partitions, and --bootstrap-server correctly.
  3. Final Answer:

    kafka-topics.sh --alter --topic myTopic --partitions 10 --bootstrap-server localhost:9092 -> Option A
  4. Quick Check:

    Alter partitions syntax = kafka-topics.sh --alter --topic myTopic --partitions 10 --bootstrap-server localhost:9092 [OK]
Quick Trick: Use --alter to change partitions, not --create or --delete [OK]
Common Mistakes:
  • Using --create to set partitions after topic creation
  • Using --delete or --list with partitions option
  • Mixing --zookeeper and --bootstrap-server incorrectly

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes