Giter Site home page Giter Site logo

kafka-docker-sample's Introduction

Description

This project includes a sample docker compose yml file which can be used to setup a local kafka env.

The project includes zookeeper and a single kafka node.

Clone this repo and run the following:

Setup environment

$ chmod +x make-commands-executable.sh

$ ./make-commands-executable.sh

start / stop environments

You can then use the following commands:

Start up the docker compose - bring up zookeeper and kafka

  • Kafka will start at port 9092
  • Zookeeper will start at port 2181
$ ./start

Stop the docker compose

$ ./stop

Kafka commands

Operational related commands

List available brokers

$ ./kafka/list-brokers

Show kafka logs

$ ./kafka/logs

Show kafka version

$ ./kafka/version

Get a bash shell on the kafka docker instance

$ ./kafka/shell

Run a command on inside the kafka docker instance

$ ./kafka/run-within-docker <the_command_that_you_would_like_to_run>

Topic related commands

List current topics

$ ./kafka/topic/list

Create a new kafka topic

  • created with replication-factor 1 and partitions 1
$ ./kafka/topic/create <topic_name>

sample:
./kafka/topic/create tone

Pick a look at the details of a topic

$ ./kafka/topic/details <topic_name>

sample:
./kafka/topic/details tone

Delete a topic

$ ./kafka/topic/delete <topic_name>

sample:
./kafka/topic/delete tone

Purge topic content

$ ./kafka/topic/purge

Change topic retention

$ ./kafka/topic/change-retention <topic_name> <retention_time_in_msec>

Increase topic partitions

$ ./kafka/topic/increase-partition <topic_name> <new_partition_size>

Message related commands

Produce a new message

  • Each line is a new message, hit ctrl-c to end.
$ ./kafka/message/produce <topic_name>

sample:
./kafka/message/produce tone

Consume new messages from last time

$ ./kafka/message/consume <topic_name>

sample:
./kafka/message/consume tone

Consume new messages from the beginning

$ ./kafka/message/consume-from-beginning <topic_name>

sample:
./kafka/message/consume-from-beginning tone

ZooKeeper commands

Show ZooKeeper logs

$ ./zookeeper/logs

Get a bash shell on the zookeeper docker instance

$ ./zookeeper/shell

kafka-docker-sample

kafka-docker-sample's People

Contributors

rajacsp avatar ni-swagger-git 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.