Follower take some time to become the leader in case leader is down . you can 
build retry logic to around this to handle this situation .

On 4/28/20, 1:08 AM, "M.Gopala Krishnan" <mgkrish...@gmail.com> wrote:

    [External]


    Hi,

    I have a 3 node kafka cluster (replication-factor : 3), suddenly one of the
    node in the cluster was down and i started seeing the
    NotLeaderForPartitionException exception in my application logs when
    sending the message to one of the topics, however for some of the topics i
    am able post and consume messages.

    I could see this problem lasting until all the kafka servers are restarted,
    after the restart things are all ok.

    Now, my question is, why not the new leader not elected for those topics
    but keep throwing the same NotLeaderForPartitionException exception and how
    to get the new leader election happen for these topics.

    *Exception Trace:*

    2020-04-11 22:05:21,747 ERROR [pool-15-thread-297]
    [KafkaMessageProducer:92] Message send failed:
    java.util.concurrent.ExecutionException:
    org.apache.kafka.common.errors.NotLeaderForPartitionException: This server
    is not the leader for that topic-partition. at
    
org.apache.kafka.clients.producer.internals.FutureRecordMetadata.valueOrError(FutureRecordMetadata.java:94)
    at
    
org.apache.kafka.clients.producer.internals.FutureRecordMetadata.get(FutureRecordMetadata.java:64)
    at
    
org.apache.kafka.clients.producer.internals.FutureRecordMetadata.get(FutureRecordMetadata.java:29)

    Regards,
    Gopal


This e-mail and any files transmitted with it are for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
If you are not the intended recipient(s), please reply to the sender and 
destroy all copies of the original message. Any unauthorized review, use, 
disclosure, dissemination, forwarding, printing or copying of this email, 
and/or any action taken in reliance on the contents of this e-mail is strictly 
prohibited and may be unlawful. Where permitted by applicable law, this e-mail 
and other e-mail communications sent to and from Cognizant e-mail addresses may 
be monitored.

Reply via email to