Consume from the beginning

Read all messages in a topic, starting from the earliest available offset

kafka-console-consumer.sh --bootstrap-server kafka:9092 --topic <name> --from-beginning

tool
kafka20 commands
tags
kafkadebug

More kafka commands

  • kafka-console-producer.sh --bootstrap-server kafka:9092 --topic <name>

    Type messages in stdin and send them to a topic

  • kafka-consumer-groups.sh --bootstrap-server kafka:9092 --list

    Show all consumer groups

  • kafka-consumer-groups.sh --bootstrap-server kafka:9092 --describe --group <group>

    Show lag for each partition of a consumer group

  • kafka-consumer-groups.sh --bootstrap-server kafka:9092 --group <group> --topic <topic> --reset-offsets --to-earliest --execute

    Move a consumer group back to the beginning of the topic

  • kafka-topics.sh --bootstrap-server kafka:9092 --alter --topic <name> --partitions 6

    Increase the number of partitions in a topic (you cannot decrease it)

all 20 kafka commands