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:
$ chmod +x make-commands-executable.sh
$ ./make-commands-executable.sh
You can then use the following commands:
- Kafka will start at port 9092
- Zookeeper will start at port 2181
$ ./start
$ ./stop
$ ./kafka/list-brokers
$ ./kafka/logs
$ ./kafka/version
$ ./kafka/shell
$ ./kafka/run-within-docker <the_command_that_you_would_like_to_run>
$ ./kafka/topic/list
- created with replication-factor 1 and partitions 1
$ ./kafka/topic/create <topic_name>
sample:
./kafka/topic/create tone
$ ./kafka/topic/details <topic_name>
sample:
./kafka/topic/details tone
$ ./kafka/topic/delete <topic_name>
sample:
./kafka/topic/delete tone
$ ./kafka/topic/purge
$ ./kafka/topic/change-retention <topic_name> <retention_time_in_msec>
$ ./kafka/topic/increase-partition <topic_name> <new_partition_size>
- Each line is a new message, hit ctrl-c to end.
$ ./kafka/message/produce <topic_name>
sample:
./kafka/message/produce tone
$ ./kafka/message/consume <topic_name>
sample:
./kafka/message/consume tone
$ ./kafka/message/consume-from-beginning <topic_name>
sample:
./kafka/message/consume-from-beginning tone
$ ./zookeeper/logs
$ ./zookeeper/shell