Kafka commands for API to produce message, create consumer group, subscribe to consumer group and read records

為{幸葍}努か 提交于 2020-06-29 03:54:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!