Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 17, 2022 09:48 pm GMT

Kafta is a modern non-JVM command line for managing Kafka clusters

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 versionFlags:  --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 topicTopics managementUsage:  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 10Topic 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-topicTopic 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 productionBootstrap servers: b-1.mydomain:9092,b-2.mydomain:9092,b-3.mydomain:9092Schema registry: https://schema-registry.comUse SASL: ySASL Algorithm: sha512User: 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 productionSwitched 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 ;)


Original Link: https://dev.to/lucasviecelli/kafta-is-a-modern-non-jvm-command-line-for-managing-kafka-clusters-12hh

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To