user2351281
user2351281

Reputation: 137

how could I do when faced with "leader=-1" error in Kafka

I set up a Kafka application which has 2 brokers and create a topic which has 3 partitions,the replication factor=1. Then I use producer process to send data.when producer is running,I kill one of the 3 brokers and producer process gave out the following message:

kafka.common.FailedToSendMessageException: Failed to send messages after 3 tries.

If data losss is allowed,how could I do to make producer process recover automaticlly. I think the best solution is that move the partition in the deleted broker to another 2 brokers. How could I do? If not,does it just mean that there is no way to recover when faced with leader=-1?

note: In my situation,replicaion factor is set 1 for reducing bandwidth utilization.

Upvotes: 2

Views: 3431

Answers (1)

Anatoly Deyneka
Anatoly Deyneka

Reputation: 1258

http://kafka.apache.org/documentation.html

For a topic with replication factor N, we will tolerate up to N-1 server failures without losing any messages committed to the log.

So if you want to have automatic failover - increase replication factor.

Upvotes: 4

Related Questions