1
votes

I set up a kafka cluster with three broker, and created several topics with the argument --replication-factor 2 --partitions 1 , no message produce or consume.

But I found one broker of them, continuous output INFO logs every second while other two brokers looks fine :

[2018-07-09 10:11:17,

743] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:18,744] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:19,744] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:20,745] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:21,746] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:22,746] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:23,747] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:24,747] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:25,748] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:26,749] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:27,749] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:28,750] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:29,750] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:30,751] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:31,752] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:32,752] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
[2018-07-09 10:11:33,753] INFO [ReplicaFetcher replicaId=3, leaderId=128, fetcherId=0] Retrying leaderEpoch request for partition TOPIC_LOGIN_EVENT-0 as the leader reported an error: NOT_LEADER_FOR_PARTITION (kafka.server.ReplicaFetcherThread)
1
I was facing the similar issue but couldn’t find a solution so as a work around I used to check. Is all brokers are available before putting data into kafka topic.Raman Mishra

1 Answers

4
votes

I found the root of the problem, I did not configure the listen address, so each broker used InetAddress.getLocalHost() to bind it by default. So unfortunately one broker who has the lead partition of the topic use "localhost:9092" . The problem broker was told to connect to the lead partition by "localhost:9092", and the result was connected to itself, and of course -- NOT_LEADER_FOR_PARTITION”

I corrected /etc/hosts , and it works