Bird
0
0

You want to update the configuration of a Kafka broker to change the log retention period. Which CLI tool and command structure should you use?

hard📝 Application Q9 of 15
Kafka - Basics and Event Streaming
You want to update the configuration of a Kafka broker to change the log retention period. Which CLI tool and command structure should you use?
Akafka-console-producer.sh --config retention.ms=604800000
Bkafka-topics.sh --alter --topic my-topic --config retention.ms=604800000
Ckafka-configs.sh --bootstrap-server localhost:9092 --entity-type brokers --entity-name 0 --alter --add-config retention.ms=604800000
Dkafka-consumer-groups.sh --alter --group my-group --config retention.ms=604800000
Step-by-Step Solution
Solution:
  1. Step 1: Identify the tool for broker configuration changes

    kafka-configs.sh is used to alter broker and topic configurations.
  2. Step 2: Use --entity-type brokers and specify broker ID with --entity-name

    To change broker config, specify entity-type as brokers and entity-name as broker ID (e.g., 0).
  3. Step 3: Use --alter and --add-config to set retention.ms

    This command updates the log retention period in milliseconds.
  4. Final Answer:

    kafka-configs.sh --bootstrap-server localhost:9092 --entity-type brokers --entity-name 0 --alter --add-config retention.ms=604800000 -> Option C
  5. Quick Check:

    Broker config changes use kafka-configs.sh with --entity-type brokers [OK]
Quick Trick: Use kafka-configs.sh with --entity-type brokers to change broker settings [OK]
Common Mistakes:
  • Using kafka-topics.sh which alters topic configs only
  • Trying to configure retention via producer or consumer tools
  • Confusing group config with broker config

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes