我在相关节点上运行了zookeeper守护程序,并尝试启动kafka代理,但收到以下错误:
FATAL [Kafka Server 13], Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
java.lang.NumberFormatException: For input string: "2181""
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:492)
at java.lang.Integer.parseInt(Integer.java:527)
at org.apache.zookeeper.client.ConnectStringParser.<init>(ConnectStringParser.java:72)
at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:443)
at org.apache.zookeeper.ZooKeeper.<init>(ZooKeeper.java:380)
at org.I0Itec.zkclient.ZkConnection.connect(ZkConnection.java:64)
at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:876)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:98)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:84)
at kafka.server.KafkaServer.initZk(KafkaServer.scala:157)
at kafka.server.KafkaServer.startup(KafkaServer.scala:82)
at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:29)
at kafka.Kafka$.main(Kafka.scala:46)
at kafka.Kafka.main(Kafka.scala)
我的server.properties
broker.id=13
port=9092
host.name=node013
num.network.threads=3
num.io.threads=8
zookeeper.connect="node014:2181,node135:2181,node136:2181"
zookeeper.connection.timeout.ms=6000
和zookeeper.properties
dataDir=/tmp/zookeeper
clientPort=2181
maxClientCnxns=0
我已经尝试但未能弄清楚为什么错误日志在port属性中显示额外的“。任何想法可能导致问题?
答案 0 :(得分:2)
在server.properties
文件中,您需要删除双引号。
它应该是
zookeeper.connect=node014:2181,node135:2181,node136:2181
答案 1 :(得分:-1)
可以通过删除端口“2181”和命令行选项“--list”之间的空格来解决异常。
$ ./kafka-topics --zookeeper localhost:2181 --list 线程“main”中的异常java.lang.NumberFormatException:对于输入字符串:“2181” at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) 在java.lang.Integer.parseInt(Integer.java:580) 在java.lang.Integer.parseInt(Integer.java:615) 在org.apache.zookeeper.client.ConnectStringParser。(ConnectStringParser.java:72) 在org.apache.zookeeper.ZooKeeper。(ZooKeeper.java:443) 在org.apache.zookeeper.ZooKeeper。(ZooKeeper.java:380) 在org.I0Itec.zkclient.ZkConnection.connect(ZkConnection.java:70) 在org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:1228) 在org.I0Itec.zkclient.ZkClient。(ZkClient.java:157) 在org.I0Itec.zkclient.ZkClient。(ZkClient.java:131) at kafka.utils.ZkUtils $ .createZkClientAndConnection(ZkUtils.scala:103) at kafka.utils.ZkUtils $ .apply(ZkUtils.scala:85) at kafka.admin.TopicCommand $ .main(TopicCommand.scala:58) 在kafka.admin.TopicCommand.main(TopicCommand.scala)