kafka创建topic报错

kafka-topics.sh \
--zookeeper mypc01:2181,mypc02:2181,mypc03:2181/kafka-2020 \
--create \
--topic news \
--partitions 1 \
--replication-factor 1
InvalidReplicationFactorException: Replication factor: 1 larger than available brokers: 0.
 (kafka.admin.TopicCommand$)

排查原因,
1 kafka正常启动
2 发现是zookeeper路径不正确.
就是创建topic时的zookeeper路径要和kafka配置server.properties中的一样

# Zookeeper connection string (see zookeeper docs for details).
# This is a comma separated host:port pairs, each corresponding to a zk
# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".
# You can also append an optional chroot string to the urls to specify the
# root directory for all kafka znodes.
zookeeper.connect=mypc01:2181,mypc02:2181,mypc03:2181/kafka-2020
Logo

Kafka开源项目指南提供详尽教程,助开发者掌握其架构、配置和使用,实现高效数据流管理和实时处理。它高性能、可扩展,适合日志收集和实时数据处理,通过持久化保障数据安全,是企业大数据生态系统的核心。

更多推荐