linux 环境下 zookeeper服务启动成功,打开客户端查看时报错:拒绝链接
[root@izfvsms0q482wbz conf]# sh /lamp/zookeeper-3.3.6/bin/zkCli.sh
Connecting to localhost:2181
2017-03-29 10:59:17,174 - INFO  [main:Environment@97] - Client environment:zookeeper.version=3.3.6-1366786, built on 07/29/2012 06:22 GMT
2017-03-29 10:59:17,311 - INFO  [main:Environment@97] - Client environment:host.name=izfvsms0q482wbz
2017-03-29 10:59:17,318 - INFO  [main:Environment@97] - Client environment:java.version=1.8.0_111
2017-03-29 10:59:17,331 - INFO  [main:Environment@97] - Client environment:java.vendor=Oracle Corporation
2017-03-29 10:59:17,338 - INFO  [main:Environment@97] - Client environment:java.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre
2017-03-29 10:59:17,345 - INFO  [main:Environment@97] - Client environment:java.class.path=/lamp/zookeeper-3.3.6/bin/../build/classes:/lamp/zookeeper-3.3.6/bin/../build/lib/*.jar:/lamp/zookeeper-3.3.6/bin/../zookeeper-3.3.6.jar:/lamp/zookeeper-3.3.6/bin/../lib/log4j-1.2.15.jar:/lamp/zookeeper-3.3.6/bin/../lib/jline-0.9.94.jar:/lamp/zookeeper-3.3.6/bin/../src/java/lib/*.jar:/lamp/zookeeper-3.3.6/bin/../conf:
2017-03-29 10:59:17,351 - INFO  [main:Environment@97] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2017-03-29 10:59:17,368 - INFO  [main:Environment@97] - Client environment:java.io.tmpdir=/tmp
2017-03-29 10:59:17,380 - INFO  [main:Environment@97] - Client environment:java.compiler=<NA>
2017-03-29 10:59:17,387 - INFO  [main:Environment@97] - Client environment:os.name=Linux
2017-03-29 10:59:17,396 - INFO  [main:Environment@97] - Client environment:os.arch=amd64
2017-03-29 10:59:17,402 - INFO  [main:Environment@97] - Client environment:os.version=3.10.0-514.2.2.el7.x86_64
2017-03-29 10:59:17,411 - INFO  [main:Environment@97] - Client environment:user.name=root
2017-03-29 10:59:17,422 - INFO  [main:Environment@97] - Client environment:user.home=/root
2017-03-29 10:59:17,434 - INFO  [main:Environment@97] - Client environment:user.dir=/lamp/zookeeper-3.3.6/conf
2017-03-29 10:59:17,518 - INFO  [main:ZooKeeper@379] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@20ad9418
Welcome to ZooKeeper!
2017-03-29 10:59:18,303 - INFO  [main-SendThread():ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/127.0.0.1:2181
JLine support is enabled
2017-03-29 10:59:21,111 - WARN  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1185] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: 拒绝连接
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)
        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1143)
[zk: localhost:2181(CONNECTING) 0] 2017-03-29 10:59:22,495 - INFO  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1058] - Opening socket connection to server localhost/127.0.0.1:2181
2017-03-29 10:59:22,497 - WARN  [main-SendThread(localhost:2181):ClientCnxn$SendThread@1185] - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: 拒绝连接
        at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
        at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717)

        at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1143)


最后发现更改系统hosts即可

将127.0.0.1一行注释掉



[root@izfvsms0q482wbz conf]# sh /lamp/zookeeper-3.3.6/bin/zkServer.sh restart
JMX enabled by default
Using config: /lamp/zookeeper-3.3.6/bin/../conf/zoo.cfg
JMX enabled by default
Using config: /lamp/zookeeper-3.3.6/bin/../conf/zoo.cfg
Stopping zookeeper ... no zookeeper to stop (could not find file /tmp/zookeeper/data/zookeeper_server.pid)
JMX enabled by default
Using config: /lamp/zookeeper-3.3.6/bin/../conf/zoo.cfg
Starting zookeeper ... STARTED
[root@izfvsms0q482wbz conf]# sh /lamp/zookeeper-3.3.6/bin/zkCli.sh
Connecting to localhost:2181
2017-03-29 11:11:41,528 - INFO  [main:Environment@97] - Client environment:zookeeper.version=3.3.6-1366786, built on 07/29/2012 06:22 GMT
2017-03-29 11:11:41,696 - INFO  [main:Environment@97] - Client environment:host.name=izfvsms0q482wbz
2017-03-29 11:11:41,714 - INFO  [main:Environment@97] - Client environment:java.version=1.8.0_111
2017-03-29 11:11:41,721 - INFO  [main:Environment@97] - Client environment:java.vendor=Oracle Corporation
2017-03-29 11:11:41,734 - INFO  [main:Environment@97] - Client environment:java.home=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre
2017-03-29 11:11:41,749 - INFO  [main:Environment@97] - Client environment:java.class.path=/lamp/zookeeper-3.3.6/bin/../build/classes:/lamp/zookeeper-3.3.6/bin/../build/lib/*.jar:/lamp/zookeeper-3.3.6/bin/../zookeeper-3.3.6.jar:/lamp/zookeeper-3.3.6/bin/../lib/log4j-1.2.15.jar:/lamp/zookeeper-3.3.6/bin/../lib/jline-0.9.94.jar:/lamp/zookeeper-3.3.6/bin/../src/java/lib/*.jar:/lamp/zookeeper-3.3.6/bin/../conf:
2017-03-29 11:11:41,765 - INFO  [main:Environment@97] - Client environment:java.library.path=/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
2017-03-29 11:11:41,779 - INFO  [main:Environment@97] - Client environment:java.io.tmpdir=/tmp
2017-03-29 11:11:41,795 - INFO  [main:Environment@97] - Client environment:java.compiler=<NA>
2017-03-29 11:11:41,802 - INFO  [main:Environment@97] - Client environment:os.name=Linux
2017-03-29 11:11:41,815 - INFO  [main:Environment@97] - Client environment:os.arch=amd64
2017-03-29 11:11:41,825 - INFO  [main:Environment@97] - Client environment:os.version=3.10.0-514.2.2.el7.x86_64
2017-03-29 11:11:41,832 - INFO  [main:Environment@97] - Client environment:user.name=root
2017-03-29 11:11:41,846 - INFO  [main:Environment@97] - Client environment:user.home=/root
2017-03-29 11:11:41,868 - INFO  [main:Environment@97] - Client environment:user.dir=/lamp/zookeeper-3.3.6/conf
2017-03-29 11:11:41,938 - INFO  [main:ZooKeeper@379] - Initiating client connection, connectString=localhost:2181 sessionTimeout=30000 watcher=org.apache.zookeeper.ZooKeeperMain$MyWatcher@20ad9418
Welcome to ZooKeeper!

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

linux 环境下 zookeeper服务启动成功,打开客户端查看时报错:拒绝链接

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭