Git Product home page Git Product logo

kafka-cli's Introduction

kafka-cli

Interactive command line tool for kafka ops.

tested with kafka version:

  • 0.8.2.2

usage

three import config:

  • KAFKA_PATH --- kafka binary path
  • ZOOKEEPER --- zookeeper host port and path
  • BROEKR_LIST --- broker id list for topic migration

config get/set:

  • setpath
  • setbrokers
  • setzk
  • getpath
  • getbrokers
  • getzk

supported commands:

  • refresh --- get current topics metadata, used for topic name autocomplete
  • status --- show topic(s) metadata
  • execute --- do migration on specific topic(s)
  • verify --- verify migration progress
  • elect --- force leader election on specific topic(s)
  • unbalanced --- show topics which are not balanced
  • help --- show help message
  • exit

some examples:

<zk01:2190/kafka-cluster|[0, 1, 2]> status timeline.log
Topic:timeline.log	PartitionCount:6	ReplicationFactor:2	Configs:
	Topic: timeline.log	Partition: 0	Leader: 1	Replicas: 1,2	Isr: 2,1
	Topic: timeline.log	Partition: 1	Leader: 2	Replicas: 2,0	Isr: 0,2
	Topic: timeline.log	Partition: 2	Leader: 0	Replicas: 0,1	Isr: 1,0
	Topic: timeline.log	Partition: 3	Leader: 1	Replicas: 1,0	Isr: 0,1
	Topic: timeline.log	Partition: 4	Leader: 2	Replicas: 2,1	Isr: 1,2
	Topic: timeline.log	Partition: 5	Leader: 0	Replicas: 0,2	Isr: 2,0
<zk01:2190/kafka-cluster|[0, 1, 2]> elect timeline.log
Topic:timeline.log	PartitionCount:6	ReplicationFactor:2	Configs:
	Topic: timeline.log	Partition: 0	Leader: 1	Replicas: 1,2	Isr: 2,1
	Topic: timeline.log	Partition: 1	Leader: 2	Replicas: 2,0	Isr: 0,2
	Topic: timeline.log	Partition: 2	Leader: 0	Replicas: 0,1	Isr: 1,0
	Topic: timeline.log	Partition: 3	Leader: 1	Replicas: 1,0	Isr: 0,1
	Topic: timeline.log	Partition: 4	Leader: 2	Replicas: 2,1	Isr: 1,2
	Topic: timeline.log	Partition: 5	Leader: 0	Replicas: 0,2	Isr: 2,0

really want to do this? [y/n]
<zk01:2190/kafka-cluster|[0, 1, 2]> execute timeline.log sys.log
Current partition replica assignment

{"version":1,"partitions":[{"topic":"timeline.log","partition":1,"replicas":[2,0]},{"topic":"sys.log","partition":0,"replicas":[0,1]},{"topic":"timeline.log","partition":5,"replicas":[0,2]},{"topic":"timeline.log","partition":4,"replicas":[2,1]},{"topic":"sys.log","partition":3,"replicas":[0,2]},{"topic":"timeline.log","partition":0,"replicas":[1,2]},{"topic":"sys.log","partition":2,"replicas":[2,0]},{"topic":"sys.log","partition":4,"replicas":[1,0]},{"topic":"timeline.log","partition":3,"replicas":[1,0]},{"topic":"sys.log","partition":1,"replicas":[1,2]},{"topic":"sys.log","partition":5,"replicas":[2,1]},{"topic":"timeline.log","partition":2,"replicas":[0,1]}]}
Proposed partition reassignment configuration

{"version":1,"partitions":[{"topic":"timeline.log","partition":1,"replicas":[1,2]},{"topic":"sys.log","partition":0,"replicas":[1,0]},{"topic":"timeline.log","partition":5,"replicas":[2,1]},{"topic":"timeline.log","partition":4,"replicas":[1,0]},{"topic":"sys.log","partition":3,"replicas":[1,2]},{"topic":"timeline.log","partition":0,"replicas":[0,1]},{"topic":"sys.log","partition":4,"replicas":[2,0]},{"topic":"sys.log","partition":2,"replicas":[0,2]},{"topic":"timeline.log","partition":3,"replicas":[0,2]},{"topic":"sys.log","partition":5,"replicas":[0,1]},{"topic":"sys.log","partition":1,"replicas":[2,1]},{"topic":"timeline.log","partition":2,"replicas":[2,0]}]}

Status of partition reassignment:
ERROR: Assigned replicas (0,2) don't match the list of replicas for reassignment (1,2) for partition [sys.log,3]
ERROR: Assigned replicas (1,0) don't match the list of replicas for reassignment (0,2) for partition [timeline.log,3]
ERROR: Assigned replicas (0,1) don't match the list of replicas for reassignment (2,0) for partition [timeline.log,2]
ERROR: Assigned replicas (2,0) don't match the list of replicas for reassignment (0,2) for partition [sys.log,2]
ERROR: Assigned replicas (2,0) don't match the list of replicas for reassignment (1,2) for partition [timeline.log,1]
ERROR: Assigned replicas (1,2) don't match the list of replicas for reassignment (2,1) for partition [sys.log,1]
ERROR: Assigned replicas (0,2) don't match the list of replicas for reassignment (2,1) for partition [timeline.log,5]
ERROR: Assigned replicas (2,1) don't match the list of replicas for reassignment (1,0) for partition [timeline.log,4]
ERROR: Assigned replicas (1,0) don't match the list of replicas for reassignment (2,0) for partition [sys.log,4]
ERROR: Assigned replicas (1,2) don't match the list of replicas for reassignment (0,1) for partition [timeline.log,0]
ERROR: Assigned replicas (2,1) don't match the list of replicas for reassignment (0,1) for partition [sys.log,5]
ERROR: Assigned replicas (0,1) don't match the list of replicas for reassignment (1,0) for partition [sys.log,0]
Reassignment of partition [sys.log,3] failed
Reassignment of partition [timeline.log,3] failed
Reassignment of partition [timeline.log,2] failed
Reassignment of partition [sys.log,2] failed
Reassignment of partition [timeline.log,1] failed
Reassignment of partition [sys.log,1] failed
Reassignment of partition [timeline.log,5] failed
Reassignment of partition [timeline.log,4] failed
Reassignment of partition [sys.log,4] failed
Reassignment of partition [timeline.log,0] failed
Reassignment of partition [sys.log,5] failed
Reassignment of partition [sys.log,0] failed

really want to do this? [y/n]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.