Kafka-Utils
A suite of python tools to interact and manage Apache Kafka clusters. Kafka-Utils runs on python 3.7+.
Configuration
Kafka-Utils reads cluster configuration needed to access Kafka clusters from yaml files. Each cluster is identified by type and name.
Multiple clusters of the same type should be listed in the same type.yaml file.
The yaml files are read from $KAFKA_DISCOVERY_DIR, $HOME/.kafka_discovery and /etc/kafka_discovery, the former overrides the latter.
Sample configuration for sample_type cluster at /etc/kafka_discovery/sample_type.yaml
---
clusters:
cluster-1:
broker_list:
- "cluster-elb-1:9092"
zookeeper: "11.11.11.111:2181,11.11.11.112:2181,11.11.11.113:2181/kafka-1"
cluster-2:
broker_list:
- "cluster-elb-2:9092"
zookeeper: "11.11.11.211:2181,11.11.11.212:2181,11.11.11.213:2181/kafka-2"
local_config:
cluster: cluster-1
Install
From PyPI:
$ pip install kafka-utils
Kafka-Utils command-line interface
List all clusters
$ kafka-utils
cluster-type sample_type:
cluster-name: cluster-1
broker-list: cluster-elb-1:9092
zookeeper: 11.11.11.111:2181,11.11.11.112:2181,11.11.11.113:2181/kafka-1
cluster-name: cluster-2
broker-list: cluster-elb-2:9092
zookeeper: 11.11.11.211:2181,11.11.11.212:2181,11.11.11.213:2181/kafka-2
Get consumer offsets
$ kafka-consumer-manager --cluster-type sample_type offset_get sample_consumer
Get consumer watermarks
$ kafka-consumer-manager --cluster-type sample_type get_topic_watermark sample.topic
Rebalance cluster cluster1 of type sample_cluster
$ kafka-cluster-manager --cluster-type sample_type --cluster-name cluster1
--apply rebalance --brokers --leaders --max-partition-movements 10
--max-leader-changes 15
Rolling-restart a cluster
$ kafka-rolling-restart --cluster-type sample_type
Check in-sync replicas
$ kafka-check --cluster-type sample_type min_isr
Check number of unavailable replicas
$ kafka-check --cluster-type sample_type replica_unavailability
Documentation
Read the documentation at Read the Docs.
License
Kafka-Utils is licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
Contributing
Everyone is encouraged to contribute to Kafka-Utils by forking the Github repository and making a pull request or opening an issue.
Metadata
Release files for kafka-utils 4.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| kafka-utils-4.1.0.tar.gz | 106.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kafka_utils-4.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 277.6 kB
Release files / kafka-utils-4.1.0.tar.gz
| Download URL | kafka-utils-4.1.0.tar.gz |
|---|---|
| Size | 106.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd74de6cf5c48740a9bd3899a9de1b41ffd6a8e06963f7fccf9d52b1d62e1f17
|
|
BLAKE2b-256 checksum How to use checksums |
96cd7db60eb657771b79673e4bc6ad9882fedf8a0604134ef91838b7a6e463b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Release files / kafka_utils-4.1.0-py3-none-any.whl
| Download URL | kafka_utils-4.1.0-py3-none-any.whl |
|---|---|
| Size | 171.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3cf918f13991d9ff2d87cf7922f22642508317dcc1e93f52cbc22c282a18368b
|
|
BLAKE2b-256 checksum How to use checksums |
458d1bf742cfdd52ca0e91dfe074dca91beb13d12e1535b42206ad1fde02a389
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.15
|
Security for kafka-utils 4.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.