Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Kafka, mail # user - Leader not local for partition error?


Copy link to this message
-
Re: Leader not local for partition error?
Jun Rao 2013-07-22, 04:39
Any error/exception in state-change or controller log? Also, could you try
the 0.8 beta1 release?

Thanks,

Jun
On Mon, Jul 15, 2013 at 1:36 PM, Maxime Petazzoni <[EMAIL PROTECTED]
> wrote:

> Hi all,
>
> I'm not sure if I'm doing something wrong or if I missed a step
> somewhere. A little while ago I successfully got the 0.8 quickstart
> example to work fine with the console producer/consumer. Then I went to
> work on some code to learn how to implement a producer, which failed
> with the producer not being able to send anything with the following
> error in the logs:
>
>   Produce request with correlation id 11 failed due to [test,0]:
> kafka.common.NotLeaderForPartitionException
>
> So I went back to trying the console producer, and I'm getting the same
> error. To be sure, I removed all generated data by ZooKeeper and Kafka
> and re-followed the steps of the quickstart guide, but I'm getting the
> same error with the console producer/consumer.
>
> kafka-list-topic.sh correctly lists my 1-partition, 1-replica test
> topic:
>
>   topic: test partition: 0  leader: 0 replicas: 0 isr: 0
>
> ZK and the broker are of course both up and running. Starting the
> producer nothing out of the ordinary happens, but when starting the
> consumer (before attempting to send anything), I get the following
> exception:
>
>   [2013-07-15 13:25:46,487] INFO
> [ConsumerFetcherThread-console-consumer-943_polygon-1373919946074-f478ba53-0-0],
> Starting  (kafka.consumer.ConsumerFetcherThread)
>   [2013-07-15 13:25:46,517] ERROR
> [console-consumer-943_polygon-1373919946074-f478ba53-leader-finder-thread],
> Error due to  (kafka.consumer.ConsumerFetcherManager$LeaderFinderThread)
>   kafka.common.NotLeaderForPartitionException
>     at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
>
> I'm at a loss at what's going on here. When the broker starts it clearly
> goes through the election process and becomes the leader (since it's the
> only broker anyway) for the 'test' topic:
>
>   [2013-07-15 13:33:05,345] INFO 0 successfully elected as leader
> (kafka.server.ZookeeperLeaderElector)
>   [2013-07-15 13:33:05,550] INFO [Replica Manager on Broker 0]: Handling
> LeaderAndIsr request
> Name:LeaderAndIsrRequest;Version:0;Controller:0;ControllerEpoch:3;CorrelationId:0;ClientId:id_0-host_null-port_9092;PartitionState:(test,0)
> ->
> (LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:0,ControllerEpoch:1),ReplicationFactor:1),AllReplicas:0);Leaders:id:0,host:
> polygon.turn.com,port:9092 (kafka.server.ReplicaManager)
>   [2013-07-15 13:33:05,551] INFO New leader is 0
> (kafka.server.ZookeeperLeaderElector$LeaderChangeListener)
>   [2013-07-15 13:33:05,563] INFO [Kafka Server 0], Started
> (kafka.server.KafkaServer)
>   [2013-07-15 13:33:05,563] INFO [ReplicaFetcherManager on broker 0]
> Removing fetcher for partition [test,0] (kafka.server.ReplicaFetcherManager)
>   [2013-07-15 13:33:05,566] INFO [Replica Manager on Broker 0]: Handled
> leader and isr request
> Name:LeaderAndIsrRequest;Version:0;Controller:0;ControllerEpoch:3;CorrelationId:0;ClientId:id_0-host_null-port_9092;PartitionState:(test,0)
> ->
> (LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:0,ControllerEpoch:1),ReplicationFactor:1),AllReplicas:0);Leaders:id:0,host:
> polygon.turn.com,port:9092 (kafka.server.ReplicaManager)
>
> I'm running Kafka from branch 0.8 (b1891e7). Any idea what's going on
> there?
>
> Thanks,
> /Max
>
> --
> Maxime Petazzoni
> Sr. Platform Engineer
> m 408.310.0595
> www.turn.com
>