kafka-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 刘洋 <leoy...@gmail.com>
Subject Fwd: kafka.common.NotLeaderForPartitionException when 1 broker of 2 is down
Date Fri, 06 Dec 2013 03:58:40 GMT
Hi all,

I got kafka.common.NotLeaderForPartitionException when trying to do this:
* kafka cluster test1 with 2 brokers: id=1,host=localhost,port=9091; and
id=2,host=localhost,port=9092;
* create topic:1001, with partition=0/1/2/3; replica=2;
* stop broker id=2;
* check kafka's zookeeper, topic-1001:partition-0 's node information is:
   { "controller_epoch":15, "isr":[ 1 ], "leader":1, "leader_epoch":4,
"version":1 }
   it seems leader/isr are broker id=1, that's right, but when I use
producer.send(topic:1001, partition:0) got the following exception ( I'm
using kafka_2.8.0-0.8.0-beta1):

______________________

2013-12-06 09:58:45,471 [main] INFO  kafka.producer.SyncProducer -
Connected to localhost:9091 for producing
2013-12-06 09:58:45,472 [main] DEBUG
kafka.producer.async.DefaultEventHandler - Producer sent messages with
correlation id 11 for topics [10
01,1] to broker 1 on localhost:9091
2013-12-06 09:58:45,473 [main] WARN
 kafka.producer.async.DefaultEventHandler - Produce request with
correlation id 11 failed due to [1001,1
]: kafka.common.NotLeaderForPartitionException
2013-12-06 09:58:45,473 [main] INFO
 kafka.producer.async.DefaultEventHandler - Back off for 100 ms before
retrying send. Remaining retries
= 0
2013-12-06 09:58:45,573 [main] INFO  kafka.client.ClientUtils$ - Fetching
metadata from broker id:0,host:localhost,port:9091 with correlatio
n id 12 for 1 topic(s) Set(1001)
2013-12-06 09:58:45,574 [main] DEBUG kafka.network.BlockingChannel -
Created socket with SO_TIMEOUT = 10000 (requested 10000), SO_RCVBUF = 4
3690 (requested -1), SO_SNDBUF = 102400 (requested 102400).
2013-12-06 09:58:45,574 [main] INFO  kafka.producer.SyncProducer -
Connected to localhost:9091 for producing
2013-12-06 09:58:45,577 [main] INFO  kafka.producer.SyncProducer -
Disconnecting from localhost:9091
2013-12-06 09:58:45,577 [main] DEBUG kafka.client.ClientUtils$ -
Successfully fetched metadata for 1 topic(s) Set(1001)
2013-12-06 09:58:45,577 [main] INFO  kafka.producer.SyncProducer -
Disconnecting from localhost:9091
2013-12-06 09:58:45,579 [main] ERROR
kafka.producer.async.DefaultEventHandler - Failed to send requests for
topics 1001 with correlation ids
 in [0,12]

________________________

and server.log of broker-1 said:

[2013-12-06 11:22:05,754] ERROR [KafkaApi-1] Error while fetching metadata
for partition [1001,0] (kafka.server.KafkaApis)
kafka.common.ReplicaNotAvailableException
at kafka.server.KafkaApis$$anonfun$17$$anonfun$20.apply(KafkaApis.scala:471)
 at
kafka.server.KafkaApis$$anonfun$17$$anonfun$20.apply(KafkaApis.scala:456)
at
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
 at
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
at
scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:61)
 at scala.collection.immutable.List.foreach(List.scala:45)
at scala.collection.TraversableLike$class.map(TraversableLike.scala:206)
 at scala.collection.immutable.List.map(List.scala:45)
at kafka.server.KafkaApis$$anonfun$17.apply(KafkaApis.scala:456)
 at kafka.server.KafkaApis$$anonfun$17.apply(KafkaApis.scala:452)
at
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
 at
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:206)
at scala.collection.immutable.Set$Set1.foreach(Set.scala:81)
 at scala.collection.TraversableLike$class.map(TraversableLike.scala:206)
at scala.collection.immutable.Set$Set1.map(Set.scala:68)
 at kafka.server.KafkaApis.handleTopicMetadataRequest(KafkaApis.scala:452)
at kafka.server.KafkaApis.handle(KafkaApis.scala:69)
 at kafka.server.KafkaRequestHandler.run(KafkaRequestHandler.scala:42)
at java.lang.Thread.run(Thread.java:662)

thanks a lot!
_________________________________

Leo(刘洋) liuy@xiaomi.com
Email/Gtalk: leoyonn@gmail.com<https://mail.xiaomi.com/owa/redir.aspx?C=mScpCrbpN06UGAlDjEdz_Dz3jwb0xNAIPL4A3R2_MzszQ9IWgwcmwpnVtu94MZ-nxilMjeZzMIk.&URL=mailto%3aleoyonn%40gmail.com>
Miliao: 2481178
Mobile: +86-138-118-20678
_________________________________

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message