【问题标题】:java.io.IOException: Timed out waiting for Mini HDFS Cluster to startjava.io.IOException: 等待 Mini HDFS 集群启动超时
【发布时间】:2019-10-10 20:45:22
【问题描述】:

我在尝试启动 Hbase 迷你集群时遇到超时异常。此外,我想编写一个 hbase 测试用例,但目前它在 hadoop 3.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.

【问题讨论】:

    标签: hadoop hbase


    【解决方案1】:

    我使用的是 hadoop 2.7.3 版和 hbase 1.1.2 版

    对于超时异常,将 hadoop-client 依赖添加到你的 gradle 文件中:

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

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-17
      • 1970-01-01
      • 1970-01-01
      • 2018-05-10
      • 2012-04-18
      • 2016-11-25
      • 1970-01-01
      • 2019-02-28
      相关资源
      最近更新 更多