Add topic partitions

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

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

tool
kafka20 commands
tags
kafka

More kafka commands

  • kafka-run-class.sh kafka.tools.GetOffsetShell --broker-list kafka:9092 --topic <name>

    Show the latest offset for each partition (add `--time -2` for the earliest)

  • kafka-topics.sh --bootstrap-server kafka:9092 --create --topic my-topic --partitions 6 --replication-factor 3

    Create a new Kafka topic with 6 partitions and RF=3

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

    Show lag for each partition of a consumer group

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

    Move consumer offsets back to the earliest offset of the topic

  • kafka-console-producer.sh --bootstrap-server kafka:9092 --topic my-topic --property 'key.separator=:' --property 'parse.key=true'

    Type key:value messages and send them to the topic

all 20 kafka commands