Git Product home page Git Product logo

kafka-tools's Introduction

kafka tools

This set of tools lets you quickly setup a local kafka (and zookeeper) cluster and get to work with it. Apart from create-topics.sh, these scripts are mere convenience wrappers around kafkacat.

start cluster

docker-compose up -d

start single node kafka and zookeeper

./start-kafka-single-node.sh

create a topic

docker run --rm -i --network=host confluentinc/cp-kafka:5.2.4 /usr/bin/kafka-topics \
	--create \
	--bootstrap-server localhost:9092 \
	--replication-factor 3 \
	--partitions 4 \
	--config retention.ms=60000 \
	--topic the-topic

list topics

docker run --rm -i --network=host edenhill/kcat:1.7.0 -L -b localhost:9092

start a consumer

docker run --rm -it --network=host edenhill/kcat:1.7.0 -C -f 'partition=%p offset=%o >> key=%k value=%s\n' -b "localhost:9092" -t "the-topic"

start a consumer group

docker run --rm -it --network=host edenhill/kcat:1.7.0 -b "localhost:9092" -f "topic=%t >> partition=%p offset=%o >> key=%k value=%s\n" -G consumer topicA topicB topicC

produce messages

echo "key:value" | docker run --rm -i --network=host edenhill/kcat:1.7.0 -X topic.partitioner=murmur2_random -P -b localhost:9092 -t the-topic -Z -K:

A slightly more structured message:

echo key:'{"uid":"'$(uuidgen)'", "message":"hello"}' | docker run --rm -i --network=host edenhill/kcat:1.7.0 -P -X topic.partitioner=murmur2_random -b localhost:9092 -t the-topic -K:

delete a topic

docker run --rm -i --network=host confluentinc/cp-kafka:5.2.4 /usr/bin/kafka-topics \
	--delete \
	--bootstrap-server localhost:9092 \
	--topic the-topic

shutdown cluster

docker-compose stop

shutdown cluster and remove all data

docker-compose down

kafka-tools's People

Contributors

hekmekk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.