kafkainfo

command module
v0.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 14, 2017 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

kafainfo 是一个用于调试kafka的命令行工具

安装

源码build


# clone
export GOPATH=`pwd`
mkdir -p  $GOPATH/src/github.com/wupeaking && cd $GOPATH/src/github.com/wupeaking
git clone git@github.com:wupeaking/kafkainfo.git && cd kafkainfo

# build
go build -o kafkainfo main.go

命令

查看所有子命令

➜  kafkainfo git:(master) ✗ ./kafkainfo -h
NAME:
   kafkainfo - kafkainfo是一个简单的调试kafka的命令行工具

USAGE:
   kafkainfo [global options] command [command options] [arguments...]

VERSION:
   0.0.1

COMMANDS:
     topics      kafka的topic信息
     partitions  kafka的指定topic的分区
     brokers     kafka的指定所有brokers
     produce     向kafka生成若干消息
     consum      消费kafka消息
     uishow      在shell上图形化显示kafka概述信息
     help, h     Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

topics相关命令


# 列出所有的主题
➜  kafkainfo git:(master) ✗ ./kafkainfo topics  --addr 172.24.4.168:9092  list
INFO[0000] 所有的topics: [__consumer_offsets xxoo goclient beats]

# 某个主题的某个分区的leader信息
➜  kafkainfo git:(master) ✗ ./kafkainfo topics  --addr 172.24.4.168:9092   -t beats -p 0 leader
INFO[0000] topic:beats part:0 addr: 172.24.4.168:9092 id:1001

partitions命令

# 列出某个topic的所有分区
➜  kafkainfo git:(master) ✗ ./kafkainfo partitions --addr 172.24.4.168:9092 -t beats
INFO[0000] beats的分区情况: [0 1 2]

brokers命令


# 列出kafka的所有集群
➜  kafkainfo git:(master) ✗ ./kafkainfo brokers --addr 172.24.4.168:9092
INFO[0000] id: 0x131cac0 addr: 172.24.4.168:9092         index:=0
INFO[0000] id: 0x131cac0 addr: 172.24.6.144:9092         index:=1
INFO[0000] id: 0x131cac0 addr: 172.24.6.185:9092         index:=2

produce与consum 命令


➜  kafkainfo git:(master) ✗ ./kafkainfo produce -h
NAME:
   kafkainfo produce - 向kafka生成若干消息

USAGE:
   kafkainfo produce [command options] [arguments...]

OPTIONS:
   --addr value, --ip value   kafka集群的任意一个地址
   -t value, --topic value    指定topic
   -m value, --message value  消息内容
   -c value, --count value    生产几份消息 (default: 0)

➜  kafkainfo git:(master) ✗ ./kafkainfo consum -h
NAME:
   kafkainfo consum - 消费kafka消息

USAGE:
   kafkainfo consum [command options] [arguments...]

OPTIONS:
   --addr value, --ip value  kafka集群的任意一个地址
   -t value, --topic value   指定topic
   -c value, --count value   消费几份消息 (default: 0)
   -f, --forerver            一直消费 直到按下Ctrl-C

produce-consum

ui显示

./kafkainfo uishow --addr 172.24.4.168:9092

uishow

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址