• Kafka错误“Network is unreachable”和“larger than available brokers”


    确定Kafka安装和启动正确,ZooKeeper可以查到所有的Brokers,但执行:
    kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 3 --partitions 1 --topic my-replicated-topic
    遇到如下错误:
    java.net.SocketException: Network is unreachable
            at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
            at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
            at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)
            at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1141)
    Error while executing topic command : replication factor: 3 larger than available brokers: 0
    [2017-06-26 17:25:18,037] ERROR org.apache.kafka.common.errors.InvalidReplicationFactorException: replication factor: 3 larger than available brokers: 0


    这个问题可能是broker的配置文件server.properties中的配置项zookeeper.connect指定了kafka的zookeeper的根目录,如:
    zookeeper.connect=192.168.31.32:2181,192.168.31.33:2181/kafka


    这个时候,命令行参数“--zookeeper”的值也需要带上根目录,否则就会报这个错误,正确做法是:
    kafka-topics.sh --create --zookeeper localhost:2181/kafka --replication-factor 3 --partitions 1 --topic my-replicated-topic
  • 相关阅读:
    手动编译安装nginx
    centoos 安装hadoop集群
    block中如何避免循环引用
    正则表达式
    iOS开发ARC内存管理
    block的内部实现
    Block存储区域
    block的语法
    Collection(数组、字典、集合)
    block捕获自动变量和对象
  • 原文地址:https://www.cnblogs.com/aquester/p/9891495.html
Copyright © 2020-2023  润新知