| Crates.io | krs |
| lib.rs | krs |
| version | 0.2.4 |
| created_at | 2019-11-21 05:22:31.446029+00 |
| updated_at | 2019-12-10 07:08:52.002469+00 |
| description | Simple Kafka command-line tool |
| homepage | https://github.com/igozali/krs |
| repository | https://github.com/igozali/krs |
| max_upload_size | |
| id | 183124 |
| size | 92,163 |
krs is a simple Kafka command-line tool written in Rust, inspired by kt.
Dual-licensed under MIT or the UNLICENSE.
.env files, or pass it directly through the CLI.First and foremost, always consult -h or help (or let me know if some stuff
is unclear).
krs -h
krs help
# All subcommands also have `help`, thanks to the amazing `clap` library.
krs env help
krs collects Kafka brokers and Zookeeper hosts from environment variables,
.env file, and the CLI arguments as its context. To show context variables:
$ krs env show # or just `krs env`
If in doubt, you can always ask the tool which environment you're currently working on:
$ cat .env
KRS_ZOOKEEPER=localhost:2181
$ export KRS_BROKERS=localhost:9092
$ krs env show
Environment:
brokers: localhost:2181 (from env var (KRS_BROKERS))
zookeeper: localhost:9092 (from .env file (KRS_ZOOKEEPER))
There's a small helper to set the context variables (or you can just put the
environment variables KRS_BROKERS/KRS_ZOOKEEPER in your .env file
directly):
$ krs env set -b localhost:9092 -z localhost:2181
Once you've set context variables, you can list Kafka topics:
krs topics list # or just `krs topics`
# You should pipe the output to `jq` to make it look much better.
krs topics | jq
Describe a Kafka topic:
krs topics describe -b localhost:9092 -z localhost:2181 -t topic-name
Produce and consume from topics:
krs topics create -t my-topic
krs producer -t my-topic
Starting console producer. Press Ctrl+C to exit.
> hello
Sent: (0, 1)
MSRV is Rust 1.39.0 (mostly because I built the tool with that version and haven't tested it with previous ones).
Mostly tested with Kafka 2.1.1-cp1 (Commit:9aa84c2aaa91e392).
Note: There will be no guarantees as to when these features are going to be implemented, but feel free to submit a PR.
kafka-console-consumer --broker-list localhost:9092 --topic test is
a mouthful.kafka-topics --create, the tool will
bombard you with its complete list of options, burying the most important
error message that tells you what arguments you're missing.