Bird
0
0

You run this command but get an error: kafka-console-producer.sh --topic mytopic. What is missing?

medium📝 Debug Q14 of 15
Kafka - Basics and Event Streaming
You run this command but get an error: kafka-console-producer.sh --topic mytopic. What is missing?
AThe <code>--bootstrap-server</code> option specifying the Kafka server address.
BThe <code>--create</code> option to create the topic.
CThe <code>--from-beginning</code> option to read messages.
DThe <code>--max-messages</code> option to limit output.
Step-by-Step Solution
Solution:
  1. Step 1: Identify required options for kafka-console-producer.sh

    The producer needs to know which Kafka server to connect to, specified by --bootstrap-server.
  2. Step 2: Check the given command

    The command lacks --bootstrap-server, so it cannot connect and throws an error.
  3. Final Answer:

    The --bootstrap-server option specifying the Kafka server address. -> Option A
  4. Quick Check:

    Producer needs --bootstrap-server to connect [OK]
Quick Trick: Always include --bootstrap-server to avoid connection errors [OK]
Common Mistakes:
  • Assuming topic creation is automatic without --create
  • Confusing producer options with consumer options
  • Adding irrelevant options like --from-beginning for producer

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes