Skip to main content

Kafka management utils

Project description

[![Build Status](](

# Kafka-Utils

A suite of python tools to interact and manage Apache Kafka clusters.
Kafka-Utils runs on python2.7 and python3.

## 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`

- "cluster-elb-1:9092"
zookeeper: ",,"
- "cluster-elb-2:9092"
zookeeper: ",,"
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
cluster-name: cluster-2
broker-list: cluster-elb-2:9092

### 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:

## Contributing

Everyone is encouraged to contribute to Kafka-Utils by forking the
[Github repository]( and making a pull request or opening an issue.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for kafka-utils, version 2.3.0
Filename, size File type Python version Upload date Hashes
Filename, size kafka-utils-2.3.0.tar.gz (94.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page