Skip to content
Jimmy Bonds edited this page Jul 17, 2020 · 10 revisions

kafkactl: Quickstart

Manual Download

  • Download the latest kafkactl tool and extract to a $PATH directory.
  • Run "kafkactl config --sample" to generate a sample config at $HOME/.kafkactl.yaml
  • Edit the config file and save.
  • Alternatively, pass all arguments to the command when running.
# kafkactl --broker brokerhost01:9092 admin create --topic newtopic01 --partitions 15 --rfactor 3

Using Docker

Run with Docker using cmdline args:

docker run --rm jbvmio/kafkactl -b brokerAddress:9092
docker run --rm jbvmio/kafkactl -b brokerAddress:9092 topics
docker run --rm jbvmio/kafkactl -b brokerAddress:9092 topics mytopic -x -m
docker run --rm jbvmio/kafkactl -b brokerAddress:9092 groups
docker run --rm jbvmio/kafkactl -b brokerAddress:9092 groups mygroup --lag
docker run --rm jbvmio/kafkactl -b brokerAddress:9092 admin create --topic mytopic2 --partitions 5 --rfactor 3

Using a config file with Docker:

  • Generate a sample config:
docker run --rm -v ${PWD}:/home/kafkactl jbvmio/kafkactl config --sample

  • This will generate a sample config named .kafkactl.yaml, edit this file with your values.
  • At minimum, specify at least one entry containing a Kafka broker.
# Minimum Config:
current: Cluster1
entries:
- name: Cluster1
  kafka:
  - broker01:9092
  • Now mount your .kafkactl.yaml file whenever running the Docker image:
docker run --rm -v ${PWD}/.kafkactl.yaml:/home/kafkactl/.kafkactl.yaml jbvmio/kafkactl
docker run --rm -v ${PWD}/.kafkactl.yaml:/home/kafkactl/.kafkactl.yaml jbvmio/kafkactl topics
docker run --rm -v ${PWD}/.kafkactl.yaml:/home/kafkactl/.kafkactl.yaml jbvmio/kafkactl groups

kafkactl tool - Example Commands

example config commands

kafkactl config --sample
kafkactl config --show
kafkactl config --use testcluster1

example config file (~/.kafkactl.yaml)

current: testCluster1
entries:
- name: testCluster1
  kafka:
  - brokerHost1:9092
  - brokerHost2:9092
  burrow:
  - http://burrow1:3000
  - http://burrow2:3000
  zookeeper:
  - http://zk1:2181
  - http://zk2:2181
- name: testCluster2
  kafka:
  - brokerHost1:9092
  - brokerHost2:9092
  burrow:
  - http://burrow1:3000
  - http://burrow2:3000
  zookeeper:
  - http://zk1:2181
  - http://zk2:2181

Show Cluster Details / Config:

  • Running "kafkactl config" without any arguments will show the current context or entry:
# > kafkactl config

CURRENT:
name: atl-dc
kafka:
- atl-dc-kafka01:9092
- atl-dc-kafka02:9092
- atl-dc-kafka03:9092
- atl-dc-kafka04:9092
- atl-dc-kafka05:9092
burrow:
- http://atl-dc-burrow:9000
zookeeper:
- atl-dc-kafka01:2181
- atl-dc-kafka01:2181
  • Running "kafkactl" alone will give you a high level overview of your cluster:
# > kafkactl

Brokers:  5
 Topics:  3
 Groups:  0

Cluster: (Kafka: v1.1)
* atl-dc-kafka01.jbvm.io:9092/1
  atl-dc-kafka02.jbvm.io:9092/2
  atl-dc-kafka03.jbvm.io:9092/3
  atl-dc-kafka04.jbvm.io:9092/4
  atl-dc-kafka05.jbvm.io:9092/5

(*)Controller

More