Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does kafka change leader?

Tags:

apache-kafka

I was running my services that work with kafka already for a year and no spontaneous changes of leader happens. But for the last 2 weeks that started happens quite often. Kafka log on that:

  • [2015-09-27 15:35:14,826] INFO [ReplicaFetcherManager on broker 2] Removed fetcher for partitions [myTopic] (kafka.server.ReplicaFetcherManager)
  • [2015-09-27 15:35:14,830] INFO Truncating log myTopic-0 to offset 11520979. (kafka.log.Log)
  • [2015-09-27 15:35:14,845] WARN [Replica Manager on Broker 2]: Fetch request with correlation id 713276 from client ReplicaFetcherThread-0-2 on partition [myTopic,0] failed due to Leader not local for partition [myTopic,0] on broker 2 (kafka.server.ReplicaManager)
  • [2015-09-27 15:35:14,857] WARN [Replica Manager on Broker 2]: Fetch request with correlation id 256685 from client mirrormaker-1 on partition [myTopic,0] failed due to Leader not local for partition [myTopic,0] on broker 2 (kafka.server.ReplicaManager)
  • [2015-09-27 15:35:20,171] INFO [ReplicaFetcherManager on broker 2] Removed fetcher for partitions [myTopic,0] (kafka.server.ReplicaFetcherManager)

What can cause switching leader? If there is info in some kafka documentation - please - just point the link. I've failed to find.


System configuration

kafka version: kafka_2.10-0.8.2.1

os: Red Hat Enterprise Linux Server release 6.5 (Santiago)

server.properties (differs from default):

  • broker.id=001
  • socket.send.buffer.bytes=1048576
  • socket.receive.buffer.bytes=1048576
  • socket.request.max.bytes=104857600
  • log.flush.interval.messages=10000
  • log.flush.interval.ms=1000
  • log.retention.bytes=-1
  • controlled.shutdown.enable=true
  • auto.create.topics.enable=false
like image 672
Natalia Avatar asked Sep 28 '15 08:09

Natalia


People also ask

How leader is elected in Kafka?

Partition Leader Election is a process of electing a broker to be the leader of a partition. Use kafka-leader-election.sh utility for preferred or unclean leader election. Consult Demo: Using kafka-leader-election.sh. kafka-preferred-replica-election.sh tool has been deprecated since Kafka 2.4.

How do I change the leader of a Kafka topic?

Perform the following steps: Log in to Kafka Manager. Choose Topic > List. Click the topic name (for example, topic-test) for which a partition leader is to be modified.

Does Kafka have a leader?

Kafka has the notion of leader and follower brokers. In Kafka, for each topic partition, one broker is chosen as the leader for the other brokers (the followers). One of the chief duties of the leader is to assign replication of topic partitions to the follower brokers.

What does leader mean in Kafka?

A leader handles all read and write requests for a partition while the followers passively replicate the leader. Each server acts as a leader for some of its partitions and a follower for others so load is well balanced within the cluster.


1 Answers

It appears like lead broker is down for that partition. It might be that data directroy(log.dirs) configured in server.properties is out of space and broker is not able to accommodate. Also, what is replication factor of topic and cluster size of brokers?

like image 120
Giddy up Avatar answered Nov 16 '22 03:11

Giddy up