After several nights, weekends and late nights. Today we have the first stable release of Kafta. This project was born a while ago with me and @snakeice. We spent several days frustrated using the native commands that come with Kafka.
Kafta was created by developers for developers. We feel the pain of maintaining a kafka cluster using the bash's provided by apache-kafka, it's confusing and the experience is miserable. To facilitate the adoption of the kafka, the kafta began to be born. Kafta is a golang project that is easy to install, easy to configure and simple to use.
Overview
Kafta is built on a structure of commands, arguments & flags. Kafta will always be interacting on one cluster at a time, the reason for this is not having to pass which cluster is in each command, as it is with most command lines for kafka.
To see all exists commands, run:
$ kafta
Usage:
kafta [command]
Available Commands:
broker broker management
cluster cluster management
completion Output shell completion code
config Modify config files
console Console management
consumer Consumer group management
help Help about any command
schema Schema Registry management
topic Topics management
version Print the kafta version
Flags:
--context string The name of the kafkaconfig context to use
-d, --debug Debug mode
-h, --help help for kafta
--kafkaconfig string Path to the kafkaconfig file to
Use "kafta [command] --help" for more information about a command.
To see all options exists relate to same command, run:
$ kafta topic
Topics management
Usage:
kafta topic [command]
Available Commands:
create Create topics
delete Delete topics
describe Describe a topic
list List topics
Simple commands
Kafta is very similar to other cli's, it was made to avoid thinking "what is the syntax for this command". A great example is creating a topic. It's so simple, just run this command
$ kafta topic create my-topic --rf 3 --partitions 10
Topic created
That's it! your topic is created.
There are default values for partition and replication factor, which is why it can only be used without specifying RF or partition. The topic will be created with RF=3 and partition=10. Example:
$ kafta topic create my-topic
Topic created
Installing
Use go get to install the latest version. This command will install the Kafta executable along with the library and its dependencies:
go < 1.18: go get -u github.com/electric-saw/kafta
go >= 1.18: go install github.com/electric-saw/kafta/cmd/kafta@latest
If you prefer, just download the binary and run it on your machine, however and wherever you want.
Contexts & Config
Kafta will create a config file in ~/.kafta/config
. This yaml is used to support kafka multi-clusters and avoid passing all addresses every time.
Each cluster in Kafta is called a context, Kafta's proposal is to be more than a simple Kafka manager, thinking about managing schema-registry, connect and other parts of a Kafka environment, we call this group a context.
To set up a new context, create a new config via Kafta, you'll need to provide some information, don't worry, it's all in terminal, you don't need to edit any XML \o/
Follow the example:
$ kafta config set-context production
Bootstrap servers: b-1.mydomain:9092,b-2.mydomain:9092,b-3.mydomain:9092
Schema registry: https://schema-registry.com
Use SASL: y
SASL Algorithm: sha512
User: myuser
✔ Password: ******
To list the contexts, run:
$ kafta config get-contexts
+---------------+---------------------------+-----------------------------+------+---------+
| NAME | CLUSTER | SCHEMA REGISTRY | KSQL | CURRENT |
+---------------+---------------------------+-----------------------------+------+---------+
| dev | b-1.mydomain:9092 | https://schema-registry.com | | true |
| production | b-3.productiondomain:9092 | https://schema-registry.com | | false |
+---------------+---------------------------+-----------------------------+------+---------+
This part is a differential of Kafta. It is designed for environments with many clusters and it is essential to be easy to move from one cluster to another. To change the current cluster, run:
$ kafta config use-context production
Switched to context "production".
Others commands
Kafta has several commands and you can find an example of them in the project's README. Some commands it has:
- Consumer Groups
- Schema Registry - Partial support
- Consumer/Producer - Thanks Vinicius Folgosa for this contribution
- Broker
- Cluster configs
- Topics
Contribution
Kafta is very new and we have many opportunities to change and create many things, if you are interested in making a feature, please open a new issue and start a conversation with us. If you don't have time for that, just share the project and click on the star if you liked it ;)
Top comments (2)
I used kcat and topicctl
github.com/edenhill/kcat
github.com/segmentio/topicctl
What do think about it if you know them ?
kcat I had several problems configuring it in Arch/fedora. Topicctl is good but it is very topic focused and Kafta for now has a big focus on management