Installation
This is an instruction how to build and start Kafka Command Line Tool (hereinafter - Shell). The implementation is in progress under KAFKA-1694.
To start Shell you need to have a running Kafka Cluster built from the given patch (attached under KAFKA-1694) and build the Shell itself.
Get the code.
Get the latest patch attached to KAFKA-1694.
The patch was built against trunk, on top of revision 01f20e0 (for patch KAFKA-1694_2015-03-12_13:04:37.patch). So reset to this commit and then run to apply the patch:git am KAFKA-1694_latest.patch
Build the code. Run:
./gradlew releaseTarGz
- Start somewhere Kafka Cluster from archive under
./core/build/distributions/kafka_2.10-0.8.3-SNAPSHOT.tgz
- Unpack build archive and start Shell:
#cd <kafka_home>/core/build/distributions/ && rm -rf kafka_2.10-0.8.3-SNAPSHOT && tar -xf kafka_2.10-0.8.3-SNAPSHOT.tgz
- Start the Shell:
sudo <kafka_home>/core/build/distributions/kafka_2.10-0.8.3-SNAPSHOT/bin/kafka.sh --shell --broker <host : port>
Where <host : port> is location of one of the running brokers from the Cluster. - To get Shell help run:
sudo <kafka_home>/core/build/distributions/kafka_2.10-0.8.3-SNAPSHOT/bin/kafka.sh --help
Sample usage
You can use Kafka Command Line Tool in two ways: 1) as a interactive shell 2) as a simple CLI.
E.g. to get list of topics you can:
1) Start Shell and run:
sudo bin/kafka.sh --shell --broker <host : port>
kafka> list-topics
Or
2) Run right from kafka.sh:
sudo bin/kafka.sh --list-topics --broker <host : port>