[ 
https://issues.apache.org/jira/browse/KAFKA-2152?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14513482#comment-14513482
 ] 

Gwen Shapira commented on KAFKA-2152:
-------------------------------------

When you created the topic at first, the partitions were created on broker.id=0.
This configuration is saved in ZK and is "sticky". When you changed broker.id 
to 2, broker 2 is not a leader of any partition on the topic, nor does it have 
any replicas (since it did not exist when the topic was created). 

So, the topic has broker 0 assigned as the leader and the only replica for 
every partition, and broker 0 is not available. So you get " leader: none    
replicas: isr: isUnderReplicated:" Not the clearest error, but basically says 
"Your topic has no leader, no replicas and none of the replicas are in sync 
with the leader".

Meanwhile, broker 2 has nothing assigned to it. If you need to support this 
scenario (changing broker id), you need to use the reassignment tool 
(https://cwiki.apache.org/confluence/display/KAFKA/Replication+tools#Replicationtools-6.ReassignPartitionsTool)
 to move the partitions to the new broker.

The behavior you saw is expected, but a bit challenging to explain. Feel free 
to ask questions if I wasn't clear.

> Console producer fails to start when server running with broker.id != 0
> -----------------------------------------------------------------------
>
>                 Key: KAFKA-2152
>                 URL: https://issues.apache.org/jira/browse/KAFKA-2152
>             Project: Kafka
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 0.8.2.1
>            Reporter: Lior Gonnen
>            Priority: Critical
>
> Scenario to reproduce:
> 1. Start zookeeper as usual: bin/zookeeper-server-start.sh 
> config/zookeeper.properties
> 2. Start local server as usual: bin/kafka-server-start.sh 
> config/server.properties
> 3. Start console producer: bin/kafka-console-producer.sh --broker-list 
> localhost:9092 --topic test
> 4. Producer starts as usual, and allows sending messages
> 5. Stop the producer and server
> 6. In config/server.properties, change broker.id to 2 (or any other non-zero 
> number)
> 7. Repeat steps 2 and 3
> 8. The received output is as follows:
> [2015-04-26 20:00:47,571] WARN Error while fetching metadata  partition 0     
> leader: none    replicas:       isr:    isUnderReplicated: false for topic 
> partition [test,0]: [class kafka.common.LeaderNotAvailableException] 
> (kafka.producer.BrokerPartitionInfo)
> [2015-04-26 20:00:47,575] WARN Failed to collate messages by topic,partition 
> due to: No leader for any partition in topic test 
> (kafka.producer.async.DefaultEventHandler)
> [2015-04-26 20:00:47,682] WARN Error while fetching metadata  partition 0     
> leader: none    replicas:       isr:    isUnderReplicated: false for topic 
> partition [test,0]: [class kafka.common.LeaderNotAvailableException] 
> (kafka.producer.BrokerPartitionInfo)
> [2015-04-26 20:00:47,682] WARN Failed to collate messages by topic,partition 
> due to: No leader for any partition in topic test 
> (kafka.producer.async.DefaultEventHandler)
> [2015-04-26 20:00:47,789] WARN Error while fetching metadata  partition 0     
> leader: none    replicas:       isr:    isUnderReplicated: false for topic 
> partition [test,0]: [class kafka.common.LeaderNotAvailableException] 
> (kafka.producer.BrokerPartitionInfo)
> [2015-04-26 20:00:47,790] WARN Failed to collate messages by topic,partition 
> due to: No leader for any partition in topic test 
> (kafka.producer.async.DefaultEventHandler)
> [2015-04-26 20:00:47,897] WARN Error while fetching metadata  partition 0     
> leader: none    replicas:       isr:    isUnderReplicated: false for topic 
> partition [test,0]: [class kafka.common.LeaderNotAvailableException] 
> (kafka.producer.BrokerPartitionInfo)
> [2015-04-26 20:00:47,897] WARN Failed to collate messages by topic,partition 
> due to: No leader for any partition in topic test 
> (kafka.producer.async.DefaultEventHandler)
> [2015-04-26 20:00:48,002] WARN Error while fetching metadata  partition 0     
> leader: none    replicas:       isr:    isUnderReplicated: false for topic 
> partition [test,0]: [class kafka.common.LeaderNotAvailableException] 
> (kafka.producer.BrokerPartitionInfo)
> [2015-04-26 20:00:48,004] ERROR Failed to send requests for topics test with 
> correlation ids in [0,8] (kafka.producer.async.DefaultEventHandler)
> [2015-04-26 20:00:48,004] ERROR Error in handling batch of 1 events 
> (kafka.producer.async.ProducerSendThread)
> kafka.common.FailedToSendMessageException: Failed to send messages after 3 
> tries.
>       at 
> kafka.producer.async.DefaultEventHandler.handle(DefaultEventHandler.scala:90)
>       at 
> kafka.producer.async.ProducerSendThread.tryToHandle(ProducerSendThread.scala:105)
>       at 
> kafka.producer.async.ProducerSendThread$$anonfun$processEvents$3.apply(ProducerSendThread.scala:88)
>       at 
> kafka.producer.async.ProducerSendThread$$anonfun$processEvents$3.apply(ProducerSendThread.scala:68)
>       at scala.collection.immutable.Stream.foreach(Stream.scala:594)
>       at 
> kafka.producer.async.ProducerSendThread.processEvents(ProducerSendThread.scala:67)
>       at 
> kafka.producer.async.ProducerSendThread.run(ProducerSendThread.scala:45)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to