0
votes

I am trying to use KafkaConsumer to get the current position on partition with id 0.

consumer.position(new TopicPartition("my-topic-name", 0))

However, this never returns. It keeps trying to send these two requests :

  • Completed request:RequestHeader(apiKey=FIND_COORDINATOR, apiVersion=1, clientId=consumer-1, correlationId=6) -- {coordinator_key=,coordinator_type=0},response:{throttle_time_ms=0,error_code=15,error_message=null,coordinator={node_id=-1,host=,port=-1}}
  • Completed request:RequestHeader(apiKey=METADATA, apiVersion=5, clientId=consumer-1, correlationId=7) -- {topics=[my-topic-name],allow_auto_topic_creation=true},response:{throttle_time_ms=0,brokers=[{node_id=1,host=localhost,port=8833,rack=null}],cluster_id=randomly_generated_id,controller_id=1,topic_metadata=[{error_code=0,topic=my-topic-name,is_internal=false,partition_metadata=[{error_code=0,partition=0,leader=1,replicas=[1],isr=[1],offline_replicas=[]}]}]}

and it just keeps repeating them over and over. I get one error in between these two requests :

Number of alive brokers '1' does not meet the required replication factor '3' for the offsets topic

So it keeps repeating these steps

  • METADATA request
  • error message about replication factor
  • FIND_COORDINATOR request

and it doesn't stop

But this makes no sense since my topic is started with a replication factor of 1. I have only one kafka instance running on my localhost. And since number of brokers is 1, replication factor must also be 1, right ?

Please, help.

1
what is the version of kafka ?Ajay Srivastava

1 Answers

1
votes

since number of brokers is 1, replication factor must also be 1, right ?

Yes, but there are separate configurations for the internal topics

Based on the error about the "offsets topic", look for offsets.topic.replication.factor in your server.properties