InKolev
4/10/2017 - 8:25 AM

Kafka-Docker-Commands.md

Local IP addresses

Kafka: 172.18.0.4
Zookeeper: 172.18.0.2

Useful commands

  • Create a topic named integration-test-topic with two partitions:

    • kafka-topics --create --zookeeper 172.18.0.2:3001 --replication-factor 1 --partitions 2 --topic integration-test-topic
  • Check topic information:

    • kafka-topics --zookeeper 172.18.0.2:3001 --describe --topic integration-test-topic
  • Changed the number of integration-test-topic topic's partitions:

    • kafka-topics --zookeeper 172.18.0.2:3001 --alter --topic integration-test-topic --partitions 10
  • Produce messages to integration-test-topic topic:

    • kafka-console-producer --broker-list 172.18.0.4:3002 --topic integration-test-topic
  • Listen to messages on integration-test-topic topic:

    • kafka-console-consumer --bootstrap-server 172.18.0.4:3002 --topic integration-test-topic --from-beginning