Я получаю исключение тайм-аута при попытке запустить мини-кластер 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.