-
Notifications
You must be signed in to change notification settings - Fork 232
Raise LeaderNotAvailable Error when get topic #338
Comments
@xqliang What is the command you are running? Check out your Kafka topic status by running the built in kafka tool |
@xqliang I'm not sure which command you're running, but this error is expected if you start a consumer or producer when there are not enough brokers alive in the cluster to satisfy the replication factor for the topic you're using. |
@jasonrhaas Here is the describing result:
The console consumer is ok:
The metadata fetched by pykafka is:
|
The zookeeper info:
The logs from kafka-server[0,1].stdout:
It looks like metadata is out of sync among the brokers, it may be a kafka bug fixed in 0.9. I try to init consumer only with broker 2(192.168.229.153:19094), and the LeaderNotAvailable error is gone. That is to say, to work around this, pykafka can retry all given brokers to get the right metadata (rather than fetch from only one broker and raise LeaderNotAvailable) when brokers are out of sync. After i restart all brokers and clear kafka data, all goes well. |
Thanks for the thorough job gathering information @xqliang - I think your analysis is spot-on. If we'd retry our metadata fetch when hitting |
…utures-3 * parsely/master: fix held_offsets in balancedconsumer fixup sourcecode directives add Kafka 0.9 roadmap to ReadTheDocs balancedconsumer test pep8 pass zk connect string through to balanced consumer tests: fixes after changes to SimpleConsumer.held_offsets remove unused import test for zookeeper connect strings in Cluster() have Cluster accept zookeeper connect strings as well as broker lists return -2 if last_offset_consumed is -1. fixes #216 wrap another _socket call in a disconnect handler balancedconsumer: re-raise ConsumerStoppedException Set disconnected on socket errors from util. retry topic creation on a random broker. fixes #338
Sorry @emmett9001 , I'm kind of busy these days, and forgot this. After I totally restart all Kafka brokers, I can not reproduce this error. |
I have 3 brokers, and they are running without ERROR logs. The above error messages are logged directly to STDERR,and then the process quits for segmentation fault.
The text was updated successfully, but these errors were encountered: