java.io.ioexception:等待mini-hdfs集群启动时超时

cwtwac6a  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(251)

尝试启动hbase小型群集时出现超时异常。此外,我还想编写一个hbase测试用例,但目前它在hadoop3.1.1和hbase 2.0.2的组合中失败了。
1) 已尝试所有版本的>=3.1.1和hbase>=2.0.0(2)已从https://github.com/apache/hbase/blob/rel/2.0.2/hbase-server/src/test/java/org/apache/hadoop/hbase/testhbasetestingutility.java 以及https://github.com/apache/ranger/blob/master/hbase-agent/src/test/java/org/apache/ranger/authorization/hbase/hbaserangerauthorizationtest.java

import java.net.ServerSocket;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants;
public class HBaseRangerAuthorizationTest2 {

        private static int port;
        private static HBaseTestingUtility utility;
        public static void main(String args[]) {
            try {
                port = getFreePort();     
                utility = new HBaseTestingUtility();
                utility.getConfiguration().set("test.hbase.zookeeper.property.clientPort", "" + port);
                utility.getConfiguration().set("hbase.master.port", "" + getFreePort());
                utility.getConfiguration().set("hbase.master.info.port", "" + getFreePort());
                utility.getConfiguration().set("hbase.regionserver.port", "" + getFreePort());
                utility.getConfiguration().set("hbase.regionserver.info.port", "" + getFreePort());
                utility.getConfiguration().set("zookeeper.znode.parent", "/hbase-unsecure");
                utility.startMiniCluster();

                /*
                utility= new HBaseTestingUtility();
                // Set a different zk path for each cluster
                utility.getConfiguration().set(HConstants.ZOOKEEPER_ZNODE_PARENT, "/1");
                utility.startMiniZKCluster();
                utility.startMiniCluster();*/
            }catch(Exception e) {
                e.printStackTrace();
            }
        }
        public static int getFreePort() throws IOException {
            ServerSocket serverSocket = new ServerSocket(0);
            int port = serverSocket.getLocalPort();
            serverSocket.close();
            return port;
        }
}```

I expect the mini server should start without fail.
bvn4nwqk

bvn4nwqk1#

我使用的是hadoop版本2.7.3和hbase版本1.1.2
对于超时异常,请将hadoop客户端依赖项添加到gradle文件:

compile 'org.apache.hadoop:hadoop-client:2.7.3'

进一步检查是否添加了依赖项:

compile 'org.apache.hbase:hbase-testing-util:1.1.2'

相关问题