kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gwens...@apache.org
Subject kafka git commit: MINOR: tidy up spacing for ConsumerGroupCommand related to KAFKA-1476 …
Date Tue, 08 Mar 2016 02:30:04 GMT
Repository: kafka
Updated Branches:
  refs/heads/trunk 33fcaad26 -> 2fed0c62d


MINOR: tidy up spacing for ConsumerGroupCommand related to KAFKA-1476 …

https://issues.apache.org/jira/browse/KAFKA-1476

Let me know if these kind of contributions should have their own requisite JIRA opened in
advance.

Cheers..

Author: Christian Posta <christian.posta@gmail.com>

Reviewers: Gwen Shapira

Closes #945 from christian-posta/ceposta-tidy-up-consumer-groups-describe


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/2fed0c62
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/2fed0c62
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/2fed0c62

Branch: refs/heads/trunk
Commit: 2fed0c62db0dac5a43c2bd29555f09010bfc74ec
Parents: 33fcaad
Author: Christian Posta <christian.posta@gmail.com>
Authored: Mon Mar 7 18:30:01 2016 -0800
Committer: Gwen Shapira <cshapi@gmail.com>
Committed: Mon Mar 7 18:30:01 2016 -0800

----------------------------------------------------------------------
 .../kafka/admin/ConsumerGroupCommand.scala      |  5 ++--
 docs/ops.html                                   | 29 ++++++++++++++++++++
 2 files changed, 31 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/2fed0c62/core/src/main/scala/kafka/admin/ConsumerGroupCommand.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/admin/ConsumerGroupCommand.scala b/core/src/main/scala/kafka/admin/ConsumerGroupCommand.scala
index c192a4f..4f9aca3 100755
--- a/core/src/main/scala/kafka/admin/ConsumerGroupCommand.scala
+++ b/core/src/main/scala/kafka/admin/ConsumerGroupCommand.scala
@@ -107,7 +107,7 @@ object ConsumerGroupCommand {
     }
 
     protected def printDescribeHeader() {
-      println("GROUP, TOPIC, PARTITION, CURRENT OFFSET, LOG END OFFSET, LAG, OWNER")
+      println("%-30s %-30s %-10s %-15s %-15s %-15s %s".format("GROUP", "TOPIC", "PARTITION",
"CURRENT-OFFSET", "LOG-END-OFFSET", "LAG", "OWNER"))
     }
 
     private def describePartition(group: String,
@@ -117,8 +117,7 @@ object ConsumerGroupCommand {
                                   ownerOpt: Option[String]) {
       def print(logEndOffset: Option[Long]): Unit = {
         val lag = offsetOpt.filter(_ != -1).flatMap(offset => logEndOffset.map(_ - offset))
-        println(Seq(group, topic, partition, offsetOpt.getOrElse("unknown"), logEndOffset.getOrElse("unknown"),
-          lag.getOrElse("unknown"), ownerOpt.getOrElse("none")).mkString(", "))
+        println("%-30s %-30s %-10s %-15s %-15s %-15s %s".format(group, topic, partition,
offsetOpt.getOrElse("unknown"), logEndOffset.getOrElse("unknown"), lag.getOrElse("unknown"),
ownerOpt.getOrElse("none")))
       }
       getLogEndOffset(topic, partition) match {
         case LogEndOffsetResult.LogEndOffset(logEndOffset) => print(Some(logEndOffset))

http://git-wip-us.apache.org/repos/asf/kafka/blob/2fed0c62/docs/ops.html
----------------------------------------------------------------------
diff --git a/docs/ops.html b/docs/ops.html
index 3cec8d6..4cfe17b 100644
--- a/docs/ops.html
+++ b/docs/ops.html
@@ -131,6 +131,35 @@ my-group        my-topic                       0   0               0
 my-group        my-topic                       1   0               0               0    
          test_jkreps-mn-1394154521217-1a0be913-0
 </pre>
 
+
+Note, however, after 0.9.0, the kafka.tools.ConsumerOffsetChecker tool is deprecated and
you should use the kafka.admin.ConsumerGroupCommand (or the bin/kafka-consumer-groups.sh script)
to manage consumer groups, including consumers created with the <a href="https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Client+Re-Design">new
consumer-groups API</a>.
+
+<h4><a id="basic_ops_consumer_group" href="#basic_ops_consumer_group">Managing
Consumer Groups</a></h4>
+
+With the ConumserGroupCommand tool, we can list, delete, or describe consumer groups. For
example, to list all consumer groups across all topics:
+
+<pre>
+ &gt; bin/kafka-consumer-groups.sh --zookeeper localhost:2181 --list
+
+test-consumer-group
+</pre>
+
+To view offsets as in the previous example with the ConsumerOffsetChecker, we "describe"
the consumer group like this:
+
+<pre>
+ &gt; bin/kafka-consumer-groups.sh --zookeeper localhost:2181 --describe --group test-consumer-group
+
+GROUP                          TOPIC                          PARTITION  CURRENT-OFFSET 
LOG-END-OFFSET  LAG             OWNER
+test-consumer-group            test-foo                       0          1              
3               2               test-consumer-group_postamac.local-1456198719410-29ccd54f-0
+</pre>
+
+
+When youre using the <a href="https://cwiki.apache.org/confluence/display/KAFKA/Consumer+Client+Re-Design">new
consumer-groups API</a> where the broker handles coordination of partition handling
and rebalance, you can manage the groups with the "--new-consumer" flags:
+
+<pre>
+ &gt; bin/kafka-consumer-groups.sh --new-consumer --bootstrap-server broker1:9092 --list
+</pre>
+
 <h4><a id="basic_ops_cluster_expansion" href="#basic_ops_cluster_expansion">Expanding
your cluster</a></h4>
 
 Adding servers to a Kafka cluster is easy, just assign them a unique broker id and start
up Kafka on your new servers. However these new servers will not automatically be assigned
any data partitions, so unless partitions are moved to them they won't be doing any work until
new topics are created. So usually when you add machines to your cluster you will want to
migrate some existing data to these machines.


Mime
View raw message