欢迎使用普元产品知识库,本知识库包含普元应用开发平台EOSPlatform,流程平台BPS,企业服务总线ESB,微服务平台Microservice,运维管理平台Devops,数据集成平台DI
欢迎使用普元文档库
EOS Platform 8.1 LA CentOS Linux release 7.6.1810 (Core) 主机方式安装kafka 执行Create topic时报错:
org.apache.kafka.common.errors.InvalidReplicationFactorException:Replication factor: 1 larger than available brokers:0.\n(kafka.admin.TopicCommand$)
/opt/kafka/logs/server.log异常:
[2020-06-16 16:04:34,530] INFO Initiating client connection, connectString=xx.xx.xx.108:2181 sessionTimeout=6000 watcher=kafka.zookeeper.ZooKeeperClient$ZooKeeperClientWatcher$@4b0b0854 (org.apache.zookeeper.ZooKeeper)
[2020-06-16 16:04:34,545] INFO [ZooKeeperClient] Waiting until connected. (kafka.zookeeper.ZooKeeperClient)
[2020-06-16 16:04:40,547] INFO [ZooKeeperClient] Closing. (kafka.zookeeper.ZooKeeperClient)
[2020-06-16 16:04:44,557] INFO Opening socket connection to server xx.xx.xx.108/xx.xx.xx.108:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)
[2020-06-16 16:04:44,563] INFO Socket connection established to xx.xx.xx.108/xx.xx.xx.108:2181, initiating session (org.apache.zookeeper.ClientCnxn)
[2020-06-16 16:04:44,607] INFO Session establishment complete on server xx.xx.xx.108/xx.xx.xx.108:2181, sessionid = 0x1008b29140b0005, negotiated timeout = 6000 (org.apache.zookeeper.ClientCnxn)
[2020-06-16 16:04:44,619] INFO Session: 0x1008b29140b0005 closed (org.apache.zookeeper.ZooKeeper)
[2020-06-16 16:04:44,620] INFO EventThread shut down for session: 0x1008b29140b0005 (org.apache.zookeeper.ClientCnxn)
[2020-06-16 16:04:44,623] INFO [ZooKeeperClient] Closed. (kafka.zookeeper.ZooKeeperClient)
[2020-06-16 16:04:44,628] ERROR Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
at kafka.zookeeper.ZooKeeperClient.$anonfun$waitUntilConnected$3(ZooKeeperClient.scala:268)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:251)
at kafka.zookeeper.ZooKeeperClient.waitUntilConnected(ZooKeeperClient.scala:264)
at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:97)
at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1694)
at kafka.server.KafkaServer.createZkClient$1(KafkaServer.scala:348)
at kafka.server.KafkaServer.$anonfun$initZkClient$2(KafkaServer.scala:366)
at kafka.server.KafkaServer.$anonfun$initZkClient$2$adapted(KafkaServer.scala:364)
at scala.Option.foreach(Option.scala:257)
at kafka.server.KafkaServer.initZkClient(KafkaServer.scala:364)
at kafka.server.KafkaServer.startup(KafkaServer.scala:202)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:38)
at kafka.Kafka$.main(Kafka.scala:75)
at kafka.Kafka.main(Kafka.scala)
kafka和zookeeper都部署在同一台主机上:xx.xx.xx.108
排查:设置zookeeper.connect=127.0.0.1:2181/kafka,可以手动启动kafka并创建topic
项目中解决方式:/etc/hosts中添加xx.xx.xx.108 xx.xx.xx.108,删除手工创建的topic,重新按照主机方式安装,没再报之前的问题
建议:请使用EOS Platform 8.1 LA测试过的操作系统:CentOS 7.2.1511 最小化模式安装