Book Image

Apache Kafka Cookbook

By : Saurabh Minni
Book Image

Apache Kafka Cookbook

By: Saurabh Minni

Overview of this book

<p>This book will give you details about how to manage and administer your Apache Kafka Cluster.</p> <p>We will cover topics like how to configure your broker, producer, and consumer for maximum efficiency for your situation. Also, you will learn how to maintain and administer your cluster for fault tolerance. We will also explore tools provided with Apache Kafka to do regular maintenance operations. We shall also look at how to easily integrate Apache Kafka with big data tools like Hadoop, Apache Spark, Apache Storm, and Elasticsearch.</p>
Table of Contents (15 chapters)
Apache Kafka Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Verifying consumer rebalance


After the rebalancing operation, each partition must have selected an owner. One way to verify that is by reading the data from ZooKeeper at /consumers/[consumer_group]/owners/[topic]/[broker_id-partition_id] and finding an entry for each of /brokers/topics/[topic]/[broker-id]. This tool will make your life easier to make sure there is an owner for every partition.

Getting ready

You have a number of nodes in your Kafka node up and running. You also have a consumer group created and running.

How to do it...

  1. From the Kafka folder, run the following command:

    $ bin/kafka-run-class.sh kafka.tools.VerifyConsumerRebalance --zookeeper.connect localhost:2181 --group mytestconsumer
    

How it works…

The preceding command takes the following arguments:

  • --group: This is used to specify the consumer group.

  • --help: This prints the help message.

  • --zookeeper.connect: This is used to specify the ZooKeeper connect string.