问题
I'm using below commands to produce and create consumer groups, facing issue with consumer group not being created,. Can you please help..?
kafka-producer-perf-test --topic test-one --throughput 1000 --record-size 50 --num-records 10 --producer-props bootstrap.servers='localhost:9092' --producer.config producer.properties
kafka-consumer-perf-test --consumer.config consumer.properties --bootstrap-servers='localhost:9092' --topic test-one --messages 1
Command is able to produce a message but unable to create a consumer group and subscribe to topic instead produced message is consumed by some other topic.
回答1:
That command, kafka-producer-perf-test
is only intended to be a self-contained performance test to run on a cluster.
It seems something like this Kafka quickstart would be a much better starting point for you:
https://kafka.apache.org/quickstart
There's more details in the link, but in summary:
To produce messages:
- kafka-console-producer.sh --bootstrap-server localhost:9092 --topic test
To consume messages:
- kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic test --from-beginning
来源:https://stackoverflow.com/questions/62312364/kafka-commands-for-api-to-produce-message-create-consumer-group-subscribe-to-c