Return-Path: X-Original-To: apmail-kafka-dev-archive@www.apache.org Delivered-To: apmail-kafka-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 13B27D897 for ; Tue, 5 Mar 2013 16:31:51 +0000 (UTC) Received: (qmail 13015 invoked by uid 500); 5 Mar 2013 16:31:50 -0000 Delivered-To: apmail-kafka-dev-archive@kafka.apache.org Received: (qmail 12974 invoked by uid 500); 5 Mar 2013 16:31:50 -0000 Mailing-List: contact dev-help@kafka.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@kafka.apache.org Delivered-To: mailing list dev@kafka.apache.org Received: (qmail 12964 invoked by uid 99); 5 Mar 2013 16:31:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Mar 2013 16:31:50 +0000 X-ASF-Spam-Status: No, hits=2.5 required=5.0 tests=FREEMAIL_REPLY,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of neha.narkhede@gmail.com designates 74.125.82.43 as permitted sender) Received: from [74.125.82.43] (HELO mail-wg0-f43.google.com) (74.125.82.43) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Mar 2013 16:31:43 +0000 Received: by mail-wg0-f43.google.com with SMTP id e12so6121311wge.22 for ; Tue, 05 Mar 2013 08:31:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=6ln6+JHmjbfOW4IARPHUKc4PlEwB1PVw9fdNRgBDo+0=; b=zICDbwzsDKFV5tkAfViN71Kg0ipLs4wqY9K31EC4Ttg+So+me3V8TcN5eqwCfrgJ70 t6md8rGVAmCyaVcjP4Gxq/ElIrh2LBCUNGLmWV/JUrpy6OiVX3cSc4/RSop5SC+PYkWq 7l/x1wv38AH+l6pXJ/+c5BIP/5l8LtXW4gxUAjWXQEmJgXMQ/s+dmYZ8NWnsqjL0bYug A35LXNWt5PfGcXplUo7iFhwb53mljx9ilJqbJ2Cx7dfBQqi/hD7fxjhlsJ3oFsgkIXKa dliZYvOJ6J5PKEVHwXKV/QiQFzX54UnLcwJX78Cov8iXRk7NyAxx6EYRezUYInoK+c+J fQGQ== MIME-Version: 1.0 X-Received: by 10.194.158.161 with SMTP id wv1mr40778244wjb.38.1362501082964; Tue, 05 Mar 2013 08:31:22 -0800 (PST) Received: by 10.216.32.74 with HTTP; Tue, 5 Mar 2013 08:31:22 -0800 (PST) In-Reply-To: References: Date: Tue, 5 Mar 2013 08:31:22 -0800 Message-ID: Subject: Re: Get all the partion details from zookeeper for a topic From: Neha Narkhede To: "dev@kafka.apache.org" Content-Type: multipart/alternative; boundary=089e013c6ab00e6b2f04d730011a X-Virus-Checked: Checked by ClamAV on apache.org --089e013c6ab00e6b2f04d730011a Content-Type: text/plain; charset=ISO-8859-1 The problem is that you need to invoke getData, not getChildren on this path - /brokers/topics/test-topic/1. That will return the # of partitions on this broker, which is 1. Thanks, Neha On Tue, Mar 5, 2013 at 6:48 AM, sourabh chaki wrote: > Hi Neha, > > Thanks for your reply. > > ZkClient zk = new ZkClient(serverstring ); > List partitions = zk.getChildren("/brokers/topics/test-topic/1"); > // my topic = test-topic, broker id = 1 > > This broker is associated with partition 0. So I am expecting output should > be [0] but I am getting empty response []. > > Is there anything wrong in the way I am calling it? > Please help. > > Thanks > Sourabh > > > On Wed, Feb 27, 2013 at 11:22 PM, Neha Narkhede >wrote: > > > Sourabh, > > > > In 0.7, you can use zkclient or the zookeeper client library to query the > > following zookeeper path to get a number of partitions for a topic - > > > > get /brokers/topics/[topic]/[broker-id] > > > > This will give you # of partitions/broker, you can then add up this value > > across all brokers. > > > > Thanks, > > Neha > > > > > > On Wed, Feb 27, 2013 at 4:32 AM, sourabh chaki > >wrote: > > > > > Hi All, > > > > > > I am using zookeeper based connector to get data from Kafka Server. Is > > > there any way to get all the partitions from zookeeper for a given > topic? > > > > > > I need do do that through java code. > > > > > > Please help!!! > > > > > > Thanks. > > > > > > --089e013c6ab00e6b2f04d730011a--