18/11/21 22:31:01 INFO ClientCnxn: Opening socket connection to server 192.168.85.133/192.168.85.133:2181. Will not attempt to authenticate using SASL (unknown error)
18/11/21 22:31:01 INFO ClientCnxn: Socket connection established to 192.168.85.133/192.168.85.133:2181, initiating session
18/11/21 22:31:01 WARN ClientCnxn: Session 0x0 for server 192.168.85.133/192.168.85.133:2181, unexpected error, closing socket connection and attempting reconnect
java.io.IOException: 远程主机强迫关闭了一个现有的连接。
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at org.apache.zookeeper.ClientCnxnSocketNIO.doIO(ClientCnxnSocketNIO.java:68)
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:366)
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081)
18/11/21 22:31:01 WARN RecoverableZooKeeper: Possibly transient ZooKeeper, quorum=192.168.85.133:2181, exception=org.apache.zookeeper.KeeperException$ConnectionLossException: KeeperErrorCode = ConnectionLoss for /hbase/hbaseid
在将数据传输至hbase时出现了该问题,终止进程,发现hbase中已经被传入了6300多行数据,所以,代码并没有问题,在调试环节中,尝试了多种解决方案,
查看zookeeper启动状态
查看防火墙
查看hbase.site.xml和hbase.env.sh的配置信息
最终发现,出现这个的原因是zookeeper客户端连接数太多,默认最大连接数是60
解决办法:
一、修改客户端连接数。
二、修改zookeeper的配置文件zoo.cfg,添加参数:maxClientCnxns=100