Search code examples
apache-kafkakafka-consumer-api

kafka-consumer-groups command issue


I run this command:

kafka-consumer-groups --bootstrap-server localhost:9092 --group my-consumer-group --reset-offsets --to-earliest --execute --topic my-topic-1

It gives error:

The syntax of the command is incorrect.

As per the help results for this command, what I have typed seems to be right.

What mistake am I making here?


Solution

  • EDIT: --execute does not seems to be required as per the documentation example when resetting offset for a consumer group.

    EDIT2: I have looked into the source code, apparently --execute is needed else it would be treated as a dry run thus offset will not be reset. If your binary is built before this fix, then you will get the mentioned invalid command error.


    Remove it and your command will work:

    kafka-consumer-groups --bootstrap-server localhost:9092 --group my-consumer-group --reset-offsets --to-earliest --topic my-topic-1