A command-line interface for Apache Kafka administration, built with the Franz-go client library. Designed as a management companion to kcat, providing comprehensive tools for Kafka cluster administration.
kac
provides a streamlined interface for managing:
- Kafka Topics
- Access Control Lists (ACLs)
- Consumer Groups
Built with security in mind, supporting SASL authentication and TLS encryption.
Download the latest pre-compiled binary for your platform from the GitHub Releases page.
# Linux (x86_64)
curl -L https://github.com/janfonas/kafka-admin-cli/releases/latest/download/kafka-admin-cli_Linux_x86_64.tar.gz | tar xz
sudo mv kac /usr/local/bin/
# macOS (Apple Silicon)
curl -L https://github.com/janfonas/kafka-admin-cli/releases/latest/download/kafka-admin-cli_Darwin_arm64.tar.gz | tar xz
sudo mv kac /usr/local/bin/
# Windows (x86_64)
# Download the ZIP file from the releases page and extract kac.exe
# Using go install
go install github.com/janfonas/kafka-admin-cli@latest
# Or clone and build
git clone https://github.com/janfonas/kafka-admin-cli.git
cd kafka-admin-cli
./build.sh
# List topics
kac topic list
# Create a topic
kac topic create mytopic --partitions 3 --replication-factor 1
# Manage consumer groups
kac consumergroup list
- Create topics with custom partitions and replication factors
- Modify topics
- Delete topics
- List all topics
- View detailed topic configuration
- Create and delete ACLs
- Modify ACLs
- List all ACLs
- View detailed ACL information
- Support for various resource types and operations
- List all consumer groups
- View detailed consumer group information
- Member assignments
- Partition offsets
- Consumer lag
- Modify consumer group offsets
- SASL/SCRAM-SHA-512 (default)
- SASL/PLAIN
- TLS with custom CA certificates
- TLS with self-signed certificates
# Using password prompt (recommended)
kac --brokers kafka1:9092 --username alice --prompt-password topic list
# Using password from stdin
echo "mysecret" | kac --brokers kafka1:9092 --username alice --prompt-password topic list
# Using password flag (not recommended)
kac --brokers kafka1:9092 --username alice --password secret topic list
# Using custom CA certificate
kac --brokers kafka1:9092 --username alice --prompt-password \
--ca-cert /path/to/ca.crt topic list
# Using self-signed certificates
kac --brokers kafka1:9092 --username alice --prompt-password --insecure topic list
# Display version information
kac version
Shows detailed version information including:
- Version number
- Git commit hash
- Build date
- Go version
- OS/Architecture
--brokers, -b
: Kafka broker list (comma-separated)--username, -u
: SASL username--password, -w
: SASL password (use -P to prompt for password)--prompt-password, -P
: Prompt for password or read from stdin--ca-cert
: CA certificate file path--sasl-mechanism
: Authentication mechanism (SCRAM-SHA-512 or PLAIN)--insecure
: Skip TLS certificate verification
# Create topic
kac topic create mytopic --partitions 6 --replication-factor 3
# List topics
kac topic list
# Get topic details
kac topic get mytopic
# Delete topic
kac topic delete mytopic
# Create ACL
kac acl create \
--resource-type TOPIC \
--resource-name mytopic \
--principal User:alice \
--host "*" \
--operation READ \
--permission ALLOW
# List ACLs
kac acl list
# Get ACL details
kac acl get \
--resource-type TOPIC \
--resource-name mytopic \
--principal User:alice
# Delete ACL
kac acl delete \
--resource-type TOPIC \
--resource-name mytopic \
--principal User:alice \
--operation READ \
--permission ALLOW
# List consumer groups
kac consumergroup list
# Get group details
kac consumergroup get my-group-id
# Set group offsets
kac consumergroup set-offsets my-group-id my-topic \
--partition 0 --offset 1000
The build script (build.sh
) provides:
- Version information from git tags
- CGO disabled for better portability
- Stripped debug information for smaller binary size
- Dependency management with
go mod tidy
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Copyright 2024 Jan Harald Fonås
Created by Jan Harald Fonås with the assistance of an LLM.