Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kafka error when running in swarm mode #209

Open
BogdanIrimie opened this issue Aug 10, 2017 · 4 comments
Open

kafka error when running in swarm mode #209

BogdanIrimie opened this issue Aug 10, 2017 · 4 comments

Comments

@BogdanIrimie
Copy link

BogdanIrimie commented Aug 10, 2017

When running the compose file example zookeper and kafka containers start ok, but when entering the kafka container and using ./kafka-console-producer.sh --broker-list <host_machine_ip>:9092 --topic test-kafka, the following error is generated:

WARN Error while fetching metadata with correlation id 1 : {test-kafka=LEADER_NOT_AVAILABLE} (org.apache.kafka.clients.NetworkClient)

Tried to change the host_mahcine_ip with conatiner_ip but still no success.

When running the consumer (./kafka-console-consumer.sh --zookeeper zookeeper:2181 --topic test-kafka --from-beginning) the following error appears

WARN [console-consumer-53007_b9e6b370721d-1502384702881-8827def7-leader-finder-thread]: Failed to add leader for partitions test-kafka-0; will retry (kafka.consumer.ConsumerFetcherManager$LeaderFinderThread)
kafka.common.UnknownTopicOrPartitionException

The objective is to run kafka in a cluster of 3 or more.

@nfazekas
Copy link

+1

@mrafeeq
Copy link

mrafeeq commented Mar 20, 2018

+1

@sscaling
Copy link
Collaborator

@IrimieBogdan - Did you try connecting to the public broker port 9094 ?

@ymatsiuk
Copy link

Had the same issue.
Check ./kafka-topics.sh --zookeeper zookeeper:2181 --describe
I assume you have no leader for partitions for particular topics.

Fixed that with

broker.id.generation.enable=false

and setting the following as broker ids:

export BROKER_ID=$(hostname -i | sed 's/\.//g')

(in my case this IP is bind to container, we're using host network to run kafka)
In compose file added as well:

      update_config:
        parallelism: 1
        delay: 5m
        order: stop-first

So next time container got killed/rescheduled or updated, first it stops broker gracefully and afterwards all partitions rebalanced.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants