No commit activity in last 3 years
No release in over 3 years
Simplified command-line administration for Kafka brokers
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

< 5, >= 2
~> 4.5.0
>= 0
~> 3.2.0
~> 0.11.0

Runtime

~> 1.2
>= 1.6.21, ~> 1.6
~> 1.8
>= 1.3.5, ~> 1.3
~> 2.0
>= 1.9.4, ~> 1.9
 Project Readme

Build Status

kafkat

Simplified command-line administration for Kafka brokers.

Contact

Let us know! If you fork this, or if you use it, or if it helps in anyway, we'd love to hear from you! opensource@airbnb.com

License & Attributions

This project is released under the Apache License Version 2.0 (APLv2).

How to release

  • update the version number in lib/kafkat/version.rb
  • execute bundle exec rake release

Usage

  • Install the gem.
gem install kafkat
  • Create a new configuration file to match your deployment.
{
  "kafka_path": "/srv/kafka/kafka_2.10-0.8.1.1",
  "log_path": "/mnt/kafka-logs",
  "zk_path": "zk0.foo.ca:2181,zk1.foo.ca:2181,zk2.foo.ca:2181/kafka",
  "json_files_path": "/tmp"
}

Kafkat searches for this file in two places, ~/.kafkatcfg and /etc/kafkatcfg.

  • At any time, you can run kafkat to get a list of available commands and their arguments.
$ kafkat
kafkat 0.0.10: Simplified command-line administration for Kafka brokers
usage: kafkat [command] [options]

Here's a list of supported commands:

  brokers                                                             Print available brokers from Zookeeper.
  clean-indexes                                                       Delete untruncated Kafka log indexes from the filesystem.
  controller                                                          Print the current controller.
  elect-leaders [topic]                                               Begin election of the preferred leaders.
  partitions [topic]                                                  Print partitions by topic.
  partitions [topic] --under-replicated                               Print partitions by topic (only under-replicated).
  partitions [topic] --unavailable                                    Print partitions by topic (only unavailable).
  reassign [topic] [--brokers <ids>] [--replicas <n>]                 Begin reassignment of partitions.
  resign-rewrite <broker id>                                          Forcibly rewrite leaderships to exclude a broker.
  resign-rewrite <broker id> --force                                  Same as above but proceed if there are no available ISRs.
  set-replication-factor [topic] [--newrf <n>] [--brokers id[,id]]    Set the replication factor of
  shutdown <broker id>                                                Gracefully remove leaderships from a broker (requires JMX).
  topics                                                              Print all topics.
  drain <broker id> [--topic <t>] [--brokers <ids>]                   Reassign partitions from a specific broker to other brokers.
  verify-reassign reassign_YYYY-MM-DDThh:mm:ssZ.json                  Verify reassignment of partitions.
  verify-replicas  [--topics] [--broker <id>] [--print-details] [--print-summary] Check if all partitions in a topic have same number of replicas.

Important Note

The gem needs read/write access to the Kafka log directory for some operations (clean indexes).