kafkactl - CLI for Apache Kafka, Zookeeper and Burrow Management.
kafkactl is actively developed with new features being added and tested. Thus, ongoing optimization and re-factoring will occur so ensure you are aware of the latest releases.
git clone https://github.com/jbvmio/kafkactl
cd kafkactl/
go build -o $GOPATH/bin/kafkactl
GO111MODULE=on go build -o $GOPATH/bin/kafkactl
### **Homebrew**
brew tap jbvmio/tap brew install jbvmio/tap/kafkactl
brew upgrade jbvmio/tap/kafkactl
### **Docker**
docker pull docker.io/jbvmio/kafkactl:latest docker run --rm jbvmio/kafkactl -B broker:9092 get topics --lag docker run --rm jbvmio/kafkactl -Z zookeeper:2181 ls /brokers/ids/2 docker run --rm jbvmio/kafkactl config --sample
### **Manual Download and Install (Linux, Windows, Mac)**
- Download the [latest kafkactl tool](https://github.com/jbvmio/kafkactl/releases/latest) appropriate for your platform, extract and install to a valid directory, preferably located somewhere in your configured $PATH.
- Run "kafkactl config --sample" to generate and display a sample config. Create your config and place as $HOME/.kafkactl.yaml
#### **Alternatively, pass all arguments using flags instead of using a config file when running kafkactl:**
# kafkactl - Example Commands
### example config commands
kafkactl config --sample kafkactl config view kafkactl config get-contexts kafkactl config current-context kafkactl config use cluster1
### example config file (~/.kafkactl.yaml)
contexts: prod-atl01: name: prod-atl01 brokers:
# Usage
### kafkactl -h
kafkactl: Kafka Management Tool
Usage: kafkactl [flags] kafkactl [command]
Examples:
kafkactl --context
Available Commands:
admin Kafka Admin Actions
burrow Show Burrow Lag Evaluations
Flags: -B, --broker string Specify a single broker target host:port - Overrides config. --burrow string Specify a single burrow endpoint http://host:port - Overrides config. --cfg string config file (default is $HOME/.kafkactl.yaml) -C, --context string Specify a context. -x, --exact Find exact matches. -h, --help help for kafkactl -o, --out string Change Output Format - yaml|json. -v, --verbose Display additional info or errors. --version string Specify a client version. -Z, --zookeeper string Specify a single zookeeper target host:port - Overrides config.
### kafkactl admin -h
Available Commands: create Create Kafka Resources delete Delete Kafka Resources get Get Kafka Configurations move Move Partitions using Stdin set Set Kafka Configurations
### kafkactl zk -h
Zookeeper Actions
Usage: kafkactl zk [flags] kafkactl zk [command]
Available Commands: create Create Zookeeper Paths and Values delete Delete Zookeeper Paths and Values ls Print Zookeeper Paths and Values
Flags: -h, --help help for zk -o, --out string Change Output Format - yaml|json.
Global Flags: -B, --broker string Specify a single broker target host:port - Overrides config. --burrow string Specify a single burrow endpoint http://host:port - Overrides config. --cfg string config file (default is $HOME/.kafkactl.yaml) -C, --context string Specify a context. -x, --exact Find exact matches. -v, --verbose Display additional info or errors. --version string Specify a client version. -Z, --zookeeper string Specify a single zookeeper target host:port - Overrides config.
# Example output:
### kafka
Brokers: 5 Topics: 208 Groups: 126
Cluster: (Kafka: v1.1) brokerhost01:9092/1
(*)Controller
GROUPTYPE GROUP COORDINATOR consumer mygroup05 broker03:9092/3
kafkactl get group mygroup05 --lag
GROUP TOPIC PART MEMBER OFFSET LAG mygroup05 mytopic05 14 mygroup05-77885078-77abc 97 0 mygroup05 mytopic05 1 mygroup05-77885078-77abc 76 0 mygroup05 mytopic05 2 mygroup05-77885078-77abc 84 0 mygroup05 mytopic05 9 mygroup05-77885078-77abc 84 0 mygroup05 mytopic05 12 mygroup05-77885078-77abc 84 0 mygroup05 mytopic05 3 mygroup05-77885078-77abc 135 0 mygroup05 mytopic05 8 mygroup05-77885078-77abc 90 0 mygroup05 mytopic05 7 mygroup05-77885078-77abc 83 0 mygroup05 mytopic05 4 mygroup05-77885078-77abc 111 0 mygroup05 mytopic05 6 mygroup05-77885078-77abc 114 0 mygroup05 mytopic05 0 mygroup05-77885078-77abc 2329 0 mygroup05 mytopic05 5 mygroup05-77885078-77abc 85 0 mygroup05 mytopic05 11 mygroup05-77885078-77abc 139 0 mygroup05 mytopic05 10 mygroup05-77885078-77abc 125 0 mygroup05 mytopic05 13 mygroup05-77885078-77abc 97 0
### zookeeper
VALUE: /cluster/id {"version":"1","id":"wwI7vYwOShKnEqVzDhhUYqi"}
PATH: / cluster controller brokers zookeeper admin isr_change_notification log_dir_event_notification controller_epoch consumers burrow latest_producer_id_block config
Successfully Created: /testpath
Successfully Created: /testpath/testvalue
VALUE: /testpath/testvalue my testvalue from stdin
### burrow
kafkactl burrow mygroup07 -x
BURROW GROUP TOPIC PARTITION LAG TOPICLAG STATUS dc01-kafka mygroup07 mytopic07 0 0 0 OK dc01-kafka mygroup07 mytopic07 1 0 0 OK dc01-kafka mygroup07 mytopic07 2 0 0 OK dc01-kafka mygroup07 mytopic07 3 0 0 OK dc01-kafka mygroup07 mytopic07 4 0 0 OK dc01-kafka mygroup07 mytopic07 5 0 0 OK dc01-kafka mygroup07 mytopic07 6 0 0 OK dc01-kafka mygroup07 mytopic07 7 0 0 OK dc01-kafka mygroup07 mytopic07 8 0 0 OK dc01-kafka mygroup07 mytopic07 9 0 0 OK dc01-kafka mygroup07 mytopic07 10 0 0 OK dc01-kafka mygroup07 mytopic07 11 0 0 OK dc01-kafka mygroup07 mytopic07 12 0 0 OK dc01-kafka mygroup07 mytopic07 13 0 0 OK dc01-kafka mygroup07 mytopic07 14 0 0 OK