I'm not sure if I'm doing something wrong or if I missed a step somewhere. A little while ago I successfully got the 0.8 quickstart example to work fine with the console producer/consumer. Then I went to work on some code to learn how to implement a producer, which failed with the producer not being able to send anything with the following error in the logs:
Produce request with correlation id 11 failed due to [test,0]: kafka.common.NotLeaderForPartitionException
So I went back to trying the console producer, and I'm getting the same error. To be sure, I removed all generated data by ZooKeeper and Kafka and re-followed the steps of the quickstart guide, but I'm getting the same error with the console producer/consumer.
kafka-list-topic.sh correctly lists my 1-partition, 1-replica test topic:
topic: test partition: 0 leader: 0 replicas: 0 isr: 0
ZK and the broker are of course both up and running. Starting the producer nothing out of the ordinary happens, but when starting the consumer (before attempting to send anything), I get the following exception:
[2013-07-15 13:25:46,487] INFO [ConsumerFetcherThread-console-consumer-943_polygon-1373919946074-f478ba53-0-0], Starting (kafka.consumer.ConsumerFetcherThread) [2013-07-15 13:25:46,517] ERROR [console-consumer-943_polygon-1373919946074-f478ba53-leader-finder-thread], Error due to (kafka.consumer.ConsumerFetcherManager$LeaderFinderThread) kafka.common.NotLeaderForPartitionException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
I'm at a loss at what's going on here. When the broker starts it clearly goes through the election process and becomes the leader (since it's the only broker anyway) for the 'test' topic:
[2013-07-15 13:33:05,345] INFO 0 successfully elected as leader (kafka.server.ZookeeperLeaderElector) [2013-07-15 13:33:05,550] INFO [Replica Manager on Broker 0]: Handling LeaderAndIsr request Name:LeaderAndIsrRequest;Version:0;Controller:0;ControllerEpoch:3;CorrelationId:0;ClientId:id_0-host_null-port_9092;PartitionState:(test,0) -> (LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:0,ControllerEpoch:1),ReplicationFactor:1),AllReplicas:0);Leaders:id:0,host:polygon.turn.com,port:9092 (kafka.server.ReplicaManager) [2013-07-15 13:33:05,551] INFO New leader is 0 (kafka.server.ZookeeperLeaderElector$LeaderChangeListener) [2013-07-15 13:33:05,563] INFO [Kafka Server 0], Started (kafka.server.KafkaServer) [2013-07-15 13:33:05,563] INFO [ReplicaFetcherManager on broker 0] Removing fetcher for partition [test,0] (kafka.server.ReplicaFetcherManager) [2013-07-15 13:33:05,566] INFO [Replica Manager on Broker 0]: Handled leader and isr request Name:LeaderAndIsrRequest;Version:0;Controller:0;ControllerEpoch:3;CorrelationId:0;ClientId:id_0-host_null-port_9092;PartitionState:(test,0) -> (LeaderAndIsrInfo:(Leader:0,ISR:0,LeaderEpoch:0,ControllerEpoch:1),ReplicationFactor:1),AllReplicas:0);Leaders:id:0,host:polygon.turn.com,port:9092 (kafka.server.ReplicaManager)
I'm running Kafka from branch 0.8 (b1891e7). Any idea what's going on there?
Maxime Petazzoni Sr. Platform Engineer m 408.310.0595 www.turn.com
This is because we populate the key in ReplicaManager.highWatermarkCheckpoints using the "dirs" config, but look up the key using log.dir.getParent. So, if you have a trailing slash in the config, they won't match. This seems a bug that we should fix. Could you file a jira?
Jun On Tue, Jul 30, 2013 at 9:18 AM, Maxime Petazzoni <[EMAIL PROTECTED]
NEW: Monitor These Apps!
Apache Lucene, Apache Solr and all other Apache Software Foundation projects and their respective logos are trademarks of the Apache Software Foundation.
Elasticsearch, Kibana, Logstash, and Beats are trademarks of Elasticsearch BV, registered in the U.S. and in other countries. This site and Sematext Group is in no way affiliated with Elasticsearch BV.
Service operated by Sematext