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 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.

Project details


Download files

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

Source Distribution

kafka-utils-4.0.1.tar.gz (102.4 kB view details)

Uploaded Source

Built Distribution

kafka_utils-4.0.1-py3-none-any.whl (164.6 kB view details)

Uploaded Python 3

File details

Details for the file kafka-utils-4.0.1.tar.gz.

File metadata

  • Download URL: kafka-utils-4.0.1.tar.gz
  • Upload date:
  • Size: 102.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for kafka-utils-4.0.1.tar.gz
Algorithm Hash digest
SHA256 1f2a54a10056b7bef673af27e3c013b7f0b0e485702664a679acacfc33979e1d
MD5 f6fbf372f5dc5a41affa143cb914c2fb
BLAKE2b-256 c000a1b62fdc8e96c90c8002d9bcee0fc0453c59d63f5d963ff82174bd57da64

See more details on using hashes here.

Provenance

File details

Details for the file kafka_utils-4.0.1-py3-none-any.whl.

File metadata

  • Download URL: kafka_utils-4.0.1-py3-none-any.whl
  • Upload date:
  • Size: 164.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for kafka_utils-4.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c3146886d43eba51686223e1b399b800fdbd8940fa47f84774fff31e33bc9e40
MD5 f519f0fb687478bd6369b256e974b006
BLAKE2b-256 76f5d5060733a306fe210a2f1242d1f21e1dc0589f395f5520658ec2d7eb317a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page