Kafka执行脚本创建topic报错:ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException: Replicati
问题:在代码中测试SparkStreaming与Kafka整合的过程,需要在kafka中提前创建两个topic,但是在执行创建脚本的过程中报错如下kafka-topics.sh --zookeeper linux1:2181,linux2:2181,linux3:2181 --create --topic wufabao_topic01 --replication-factor 2 --parti
·
问题:
在代码中测试SparkStreaming与Kafka整合的过程,需要在kafka中提前创建两个topic,但是在执行创建脚本的过程中报错如下
kafka-topics.sh --zookeeper linux1:2181,linux2:2181,linux3:2181 --create --topic wufabao_topic01 --replication-factor 2 --partitions 3
WARNING: Due to limitations in metric names, topics with a period ('.') or underscore ('_') could collide. To avoid issues it is best to use either, but not both.
Error while executing topic command : Replication factor: 2 larger than available brokers: 0.
[2022-02-09 17:27:18,432] ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException: Replication factor: 2 larger than available brokers: 0.
(kafka.admin.TopicCommand$)
原因:
kafka配置的zookeeper存放的元数据的路径不对,我在kafka中配置的元数据路径为:
zookeeper.connect=linux1:2181,linux2:2181,linux3:2181/myKafka
解决方案:
修改脚本中kafka元数据路径为如下
kafka-topics.sh --zookeeper linux1:2181,linux2:2181,linux3:2181/myKafka --create --topic wufabao_topic01 --replication-factor 2 --partitions 3
创建成功
更多推荐
已为社区贡献6条内容
所有评论(0)