服务器的HBase会话0x0,通过对等方重置连接

时间:2017-06-26 11:37:37

标签: java hbase

我在Java中使用Hbase。我的java应用程序和HBase都在dockers中运行。 这是一个我从以下网站获得HBase配置的课程:

public class HBaseConf {

    private static HBaseConf instance = new HBaseConf();

    private Configuration configuration;

    public Configuration getConfiguration() {
        return configuration;
    }

    public HBaseConf() {
        String hbasePort = System.getenv("LINK_NAME_PORT_2181_TCP_ADDR");
        this.configuration = org.apache.hadoop.hbase.HBaseConfiguration.create();
        if (hbasePort != null) {
            this.configuration.set("hbase.zookeeper.quorum", hbasePort);
            this.configuration.set("hbase.zookeeper.property.clientPort", "2181");
        }
    }

    public static Configuration getHbaseConf() {
         return instance.getConfiguration();
    }
}

然后我执行一些在hbase中触发扫描的请求。在几次(10-20)罚款请求后,我收到错误:

> org.apache.zookeeper.ClientCnxn - Session 0x0 for server 172.17.0.4/172.17.0.4:2181, unexpected error, closing socket connection and attempting reconnect
java.io.IOException: Connection reset by peer
    at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
    at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
    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)

这是我的hbase-site.xml:

<configuration>
<property>
    <name>hbase.master.port</name>
    <value>60000</value>
</property>
<property>
    <name>hbase.master.info.port</name>
    <value>60010</value>
</property>
<property>
    <name>hbase.regionserver.port</name>
    <value>60020</value>
</property>
<property>
    <name>hbase.regionserver.info.port</name>
    <value>60030</value>
</property>
<property>
    <name>hbase.zookeeper.quorum</name>
    <value>localhost</value>
</property>
<property>
    <name>hbase.zookeeper.property.maxClientCnxns</name>
    <value>300</value>
</property>
<property>
    <name>hbase.localcluster.port.ephemeral</name>
    <value>false</value>
</property>
<property>
    <name>hbase.rootdir</name>
    <value>file:///opt/hbase/data</value>
</property>
<property>
    <name>hbase.zookeeper.property.dataDir</name>
    <value>/opt/hbase/zookeeper</value>
</property>

1 个答案:

答案 0 :(得分:0)

看起来我已经超过了最大客户数量。将hbase.zookeeper.property.maxClientCnxns设置为0(无限制)就成了伎俩。

相关问题