Skip to content

telkomdev/kafka-cli

Repository files navigation

Kafka CLI

Kafka cli client

Install

Build from source

Require Go version 1.10 or higher

$ git clone https://github.com/telkomdev/kafka-cli.git

$ make build

$ kafka-cli --version

Mac OS

$ brew tap wuriyanto48/tool

$ brew install kafka-cli

$ kafka-cli --version

Linux

$ wget https://github.com/telkomdev/kafka-cli/releases/download/v0.0.0/kafka-cli-v0.0.0.linux-amd64.tar.gz

$ tar -zxvf kafka-cli-v0.0.0.linux-amd64.tar.gz

$ kafka-cli --version

Windows

Download latest version https://github.com/telkomdev/kafka-cli/releases

Usage

Publish message to Kafka broker and topic

$ kafka-cli pub -broker localhost:9092 -topic wurys -m "hahahaha" -V

JSON

$ kafka-cli pub -broker localhost:9092 -topic wurys -m "{"hello":"hello", "world":"world"}" -V

or multiple broker

$ kafka-cli pub -broker localhost:9092,localhost:9093,localhost:9094 -topic wurys -m "hahahaha" -V

Subscribe to Kafka broker and topic

$ kafka-cli sub -broker localhost:9092 -topic wurys

or multiple broker

$ kafka-cli sub -broker localhost:9092,localhost:9093,localhost:9094 -topic wurys

SASL auth mechanism you need add -auth flag for prompting username and password

$ kafka-cli sub -broker localhost:9092,localhost:9093,localhost:9094 -topic wurys -auth
$ username: your-username
$ password: your-password