Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException

avatar

I've a 2-node cluster with 2 kafka-broker (1 in each) but when I try to generate a kafka-topic with replication factor = 2:

bin/kafka-topics.sh --create --zookeeper bigdata:2181 --replication-factor 2 --partitions 1 --topic programaCsd

I'm getting the error:

Error while executing topic command : replication factor: 2 larger than available brokers: 1
[2017-09-14 10:12:43,872] ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException: replication factor: 2 larger than available brokers: 1
 (kafka.admin.TopicCommand$)

In ambari I can see both kafka-brokers correctly installed and working.

Some idea why is this happening?

Thanks.

1 REPLY 1

avatar
Super Guru

Hi @Adrián Gil,

Make sure that two kafka brokers are running.

1) Did you try restarting all the Kafka brokers from Ambari.

2) Do you see any alerts for Kafka brokers in the UI.

If you do not see any alerts in the UI, please check if the brokers are actually running by running

ps -ef | grep kafka

Also, pass the znode while creating the topic. ie, --zookeeper bigdata:2181/kafka

If this doesn't work, try running with replication factor as 1 just to confirm if it is the issue with create topics itself or the no of brokers.

Thanks,

Aditya