linux下,zookeeper安装并启动起来了
DEMO时,JAVA控制台出现:
- INFO 2014-03-06 09:48:41,276 (ClientCnxn.java:966) - Opening socket connection to server 10.70.42.99/10.70.42.99:2181. Will not attempt to authenticate using SASL (无法定位登录配置)
- WARN 2014-03-06 09:49:02,320 (ClientCnxn.java:1089) - Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
- java.net.ConnectException: Connection timed out: no further information
- at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method)
- at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:574)
- at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:350)
- at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1068)
zookeeper控制台日志
- 2014-03-05 17:59:32,173 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1001] - Closed socket connection for client /10.70.41.42:44726 (no session established for client)
- 2014-03-06 09:59:54,754 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxnFactory@197] - Accepted socket connection from /127.0.0.1:39106
- 2014-03-06 09:59:54,783 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:ZooKeeperServer@839] - Client attempting to establish new session at /127.0.0.1:39106
- 2014-03-06 09:59:54,835 [myid:] - INFO [SyncThread:0:ZooKeeperServer@595] - Established session 0x14491611e2f0002 with negotiated timeout 30000 for client /127.0.0.1:39106
- 2014-03-06 10:00:47,193 [myid:] - WARN [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@349] - caught end of stream exception
- EndOfStreamException: Unable to read additional data from client sessionid 0x14491611e2f0002, likely client has closed socket
- at org.apache.zookeeper.server.NIOServerCnxn.doIO(NIOServerCnxn.java:220)
- at org.apache.zookeeper.server.NIOServerCnxnFactory.run(NIOServerCnxnFactory.java:208)
- at java.lang.Thread.run(Thread.java:736)
- 2014-03-06 10:00:47,195 [myid:] - INFO [NIOServerCxn.Factory:0.0.0.0/0.0.0.0:2181:NIOServerCnxn@1001] - Closed socket connection for client /127.0.0.1:39106 which had sessionid 0x14491611e2f0002
- 2014-03-06 10:01:16,015 [myid:] - INFO [SessionTracker:ZooKeeperServer@325] - Expiring session 0x14491611e2f0002, timeout of 30000ms exceeded
- 2014-03-06 10:01:16,016 [myid:] - INFO [ProcessThread(sid:0 cport:-1)::PrepRequestProcessor@476] - Processed session termination for sessionid: 0x14491611e2f0002
JVM采用了socket代理,不知道跟代理有没有关系,安装不是以ROOT用户的
暂时没解决,记录下来先:
解决方案:
1.关闭防火墙。
通过zookeeper搭建dubbo注册中心遇到的问题:在linux下安装,配置并启动zookeeper。在window环境下启动服务提供方时,未成功启动,报以下错误:
报错信息
1
2
3
4
5
6
7
8
9
|
2017 - 03 - 02 19 : 52 : 32 , 270 INFO [org.apache.zookeeper.ZooKeeper] - Initiating client connection, connectString= 192.168 . 153.128 : 2181 sessionTimeout= 30000 watcher=org.I0Itec.zkclient.ZkClient @1d6ba2b 2017 - 03 - 02 19 : 52 : 32 , 288 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server 192.168 . 153.128 / 192.168 . 153.128 : 2181 . Will not attempt to authenticate using SASL (unknown error) 2017 - 03 - 02 19 : 52 : 53 , 291 WARN [org.apache.zookeeper.ClientCnxn] - Session 0x0 for server null , unexpected error, closing socket connection and attempting reconnect java.net.ConnectException: Connection timed out: no further information at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java: 739 ) at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java: 361 ) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java: 1081 ) 2017 - 03 - 02 19 : 52 : 54 , 394 INFO [org.apache.zookeeper.ClientCnxn] - Opening socket connection to server 192.168 . 153.128 / 192.168 . 153.128 : 2181 . Will not attempt to authenticate using SASL (unknown error) |
经检查,是linux下防火墙未关闭,使用一下命令关闭防火墙:
servcie iptables stop
关闭后查看防火墙状态
service –status-all
查看到一下信息则说明linux防火墙已经关闭。
2.可能是 客户端 zookeper版本与服务器端安装的zookeper版本不一致。
当关闭防火墙还是没有解决问题时候,可以看看是否版本不一致,我的问题在关闭防火墙之后解决。