安装java时报22o3错误_解决运行kafka时报"java.net.ConnectException: 拒绝连接..org.I0Itec.zkclient.exception.ZkTimeoutE...

一、异常描述

关于安装成功kafka后,运行后报"java.net.ConnectException: 拒绝连接...org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 6000"异常错误,详细日志如下>>[root@centos6 kafka_2.11-0.9.0.1]# bin/kafka-server-start.sh  config/server.properties @b@...@b@[2019-03-17 11:30:46,120] INFO Initiating client connection, connectString=localhost:2181 sessionTimeout=6000 watcher=org.I0Itec.zkclient.ZkClient@32c46396 (org.apache.zookeeper.ZooKeeper)@b@[2019-03-17 11:30:46,163] INFO Waiting for keeper state SyncConnected (org.I0Itec.zkclient.ZkClient)@b@[2019-03-17 11:30:46,203] INFO Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)@b@[2019-03-17 11:30:46,210] WARN Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)@b@java.net.ConnectException: 拒绝连接@b@        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)@b@        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:744)@b@        at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361)@b@        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)@b@[2019-03-17 11:30:46,313] INFO Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)@b@[2019-03-17 11:30:46,313] WARN Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect (org.apache.zookeeper.ClientCnxn)@b@...@b@[2019-03-17 11:30:52,164] INFO Terminate ZkClient event thread. (org.I0Itec.zkclient.ZkEventThread)@b@[2019-03-17 11:30:52,220] INFO Opening socket connection to server localhost/127.0.0.1:2181. Will not attempt to authenticate using SASL (unknown error) (org.apache.zookeeper.ClientCnxn)@b@[2019-03-17 11:30:52,323] INFO Session: 0x0 closed (org.apache.zookeeper.ZooKeeper)@b@[2019-03-17 11:30:52,323] INFO EventThread shut down (org.apache.zookeeper.ClientCnxn)@b@[2019-03-17 11:30:52,323] FATAL Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)@b@org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 6000@b@        at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:1223)@b@        at org.I0Itec.zkclient.ZkClient.(ZkClient.java:155)@b@        at org.I0Itec.zkclient.ZkClient.(ZkClient.java:129)@b@        at kafka.utils.ZkUtils$.createZkClientAndConnection(ZkUtils.scala:89)@b@        at kafka.utils.ZkUtils$.apply(ZkUtils.scala:71)@b@        at kafka.server.KafkaServer.initZk(KafkaServer.scala:278)@b@        at kafka.server.KafkaServer.startup(KafkaServer.scala:168)@b@        at kafka.server.KafkaServerStartable.startup(KafkaServerStartable.scala:37)@b@        at kafka.Kafka$.main(Kafka.scala:67)@b@        at kafka.Kafka.main(Kafka.scala)@b@[2019-03-17 11:30:52,324] INFO shutting down (kafka.server.KafkaServer)@b@[2019-03-17 11:30:52,328] INFO shut down completed (kafka.server.KafkaServer)@b@[2019-03-17 11:30:52,329] FATAL Fatal error during KafkaServerStartable startup. Prepare to shutdown (kafka.server.KafkaServerStartable)

二、解决方法

因没有安装zookeeper造成的,解决方法有两个 - 方法一:在本地服务器安装zk(安装步骤参见其他文章页面);方法二:将kafka的server.properties的zk改为其他服务器的zk(注释掉zookeeper.connect=localhost:2181,改为zookeeper.connect=192.168.1.33:2181)#方法二 修改server.properties @b@@b@[root@centos6 config]# vi  /home/soft/kafka_2.11-0.9.0.1/configserver.properties @b@@b@...@b@@b@# The minimum age of a log file to be eligible for deletion@b@log.retention.hours=168@b@@b@# A size-based retention policy for logs. Segments are pruned from the log as long as the remaining@b@# segments don't drop below log.retention.bytes.@b@#log.retention.bytes=1073741824@b@@b@# The maximum size of a log segment file. When this size is reached a new log segment will be created.@b@log.segment.bytes=1073741824@b@@b@# The interval at which log segments are checked to see if they can be deleted according@b@# to the retention policies@b@log.retention.check.interval.ms=300000@b@@b@############################# Zookeeper #############################@b@@b@# Zookeeper connection string (see zookeeper docs for details).@b@# This is a comma separated host:port pairs, each corresponding to a zk@b@# server. e.g. "127.0.0.1:3000,127.0.0.1:3001,127.0.0.1:3002".@b@# You can also append an optional chroot string to the urls to specify the@b@# root directory for all kafka znodes.@b@@b@#zookeeper.connect=localhost:2181 @b@zookeeper.connect=192.168.1.33:2181@b@@b@# Timeout in ms for connecting to zookeeper@b@zookeeper.connection.timeout.ms=6000

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值