用hbase的rest服务给业务方提供web访问接口,
经常会遇到服务不可用的情况,查看日志,发现以下错误:
2012-11-08 06:10:37,447 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server hd0149-sw36.dc.sh-wgq.sdo.com/10.133.10.191: 2181 2012-11-08 06:10:37,447 WARN org.mortbay.log: /fh_spread_mes/ZTVzZmJ1cHNiYW90dWk=/: org.apache.hadoop.hbase.ZooKeeperConnectionException: HBas e is able to connect to ZooKeeper but the connection closes immediately. This could be a sign that the server has too many connections (30 is the default). Consider inspecting your ZK server logs for that error and then make sure you are reusing HBaseConfiguration as often as you can . See HTable's javadoc for more information. 2012-11-08 06:10:37,448 INFO org.apache.zookeeper.ClientCnxn: EventThread shut down 2012-11-08 06:10:37,454 INFO org.apache.zookeeper.ClientCnxn: Socket connection established to hd0149-sw36.dc.sh-wgq.sdo.com/10.133.10.191:218 1, initiating session 2012-11-08 06:10:37,454 INFO org.apache.zookeeper.ClientCnxn: Unable to read additional data from server sessionid 0x0, likely server has clos ed socket, closing socket connection and attempting reconnect 2012-11-08 06:10:37,961 INFO org.apache.zookeeper.ClientCnxn: Opening socket connection to server hd0003-sw1.dc.sh-wgq.sdo.com/10.133.10.14:21 81 2012-11-08 06:10:37,962 INFO org.apache.zookeeper.ClientCnxn: Socket connection established to hd0003-sw1.dc.sh-wgq.sdo.com/10.133.10.14:2181, initiating session 2012-11-08 06:10:37,964 WARN org.apache.zookeeper.ClientCnxn: Session 0x0 for server hd0003-sw1.dc.sh-wgq.sdo.com/10.133.10.14:2181, unexpecte d error, closing socket connection and attempting reconnect java.io.IOException: Connection reset by peer at sun.nio.ch.FileDispatcher.read0(Native Method) at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21) at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:202) at sun.nio.ch.IOUtil.read(IOUtil.java:169) at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:243) at org.apache.zookeeper.ClientCnxn$SendThread.doIO(ClientCnxn.java:858) at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1130)
说是hbase连接数过多,默认30,
org.apache.hadoop.hbase.ZooKeeperConnectionException: HBas e is able to connect to ZooKeeper but the connection closes immediately. This could be a sign that the server has too many connections (30 is the default).
在网上找了下解决方法:
修改hbase master的/etc/security/limits.conf
在最后加上: