org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster.<init>()方法的一些代码示例,展示了MiniZooKeeperCluster.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MiniZooKeeperCluster.<init>()方法的具体详情如下:
包路径:org.apache.hadoop.hbase.zookeeper.MiniZooKeeperCluster
类名称:MiniZooKeeperCluster
方法名:<init>

MiniZooKeeperCluster.<init>介绍

暂无

代码示例

代码示例来源:origin: apache/hbase

final MiniZooKeeperCluster zooKeeperCluster = new MiniZooKeeperCluster(conf);
File zkDataPath = new File(conf.get(HConstants.ZOOKEEPER_DATA_DIR));

代码示例来源:origin: apache/hbase

/**
 * Start a mini ZK cluster. If the property "test.hbase.zookeeper.property.clientPort" is set the
 * port mentioned is used as the default port for ZooKeeper.
 */
private MiniZooKeeperCluster startMiniZKCluster(File dir, int zooKeeperServerNum,
  int[] clientPortList) throws Exception {
 if (this.zkCluster != null) {
  throw new IOException("Cluster already running at " + dir);
 }
 this.passedZkCluster = false;
 this.zkCluster = new MiniZooKeeperCluster(this.getConfiguration());
 int defPort = this.conf.getInt("test.hbase.zookeeper.property.clientPort", 0);
 if (defPort > 0) {
  // If there is a port in the config file, we use it.
  this.zkCluster.setDefaultClientPort(defPort);
 }
 if (clientPortList != null) {
  // Ignore extra client ports
  int clientPortListSize = (clientPortList.length <= zooKeeperServerNum) ? clientPortList.length
    : zooKeeperServerNum;
  for (int i = 0; i < clientPortListSize; i++) {
   this.zkCluster.addClientPort(clientPortList[i]);
  }
 }
 int clientPort = this.zkCluster.startup(dir, zooKeeperServerNum);
 this.conf.set(HConstants.ZOOKEEPER_CLIENT_PORT, Integer.toString(clientPort));
 return this.zkCluster;
}

代码示例来源:origin: apache/hive

miniZooKeeperCluster = new MiniZooKeeperCluster();
 miniZooKeeperCluster.startup(zkWorkDir);
} else {

代码示例来源:origin: apache/hbase

@BeforeClass
public static void beforeAllTests() throws Exception {
 int clientZkPort = 21828;
 clientZkCluster = new MiniZooKeeperCluster(TEST_UTIL.getConfiguration());
 clientZkCluster.setDefaultClientPort(clientZkPort);
 clientZkCluster.startup(clientZkDir);
 // reduce the retry number and start log counter
 TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2);
 TEST_UTIL.getConfiguration().setInt("hbase.client.start.log.errors.counter", -1);
 TEST_UTIL.getConfiguration().setInt("zookeeper.recovery.retry", 1);
 // core settings for testing client ZK cluster
 TEST_UTIL.getConfiguration().set(HConstants.CLIENT_ZOOKEEPER_QUORUM, HConstants.LOCALHOST);
 TEST_UTIL.getConfiguration().setInt(HConstants.CLIENT_ZOOKEEPER_CLIENT_PORT, clientZkPort);
 // reduce zk session timeout to easier trigger session expiration
 TEST_UTIL.getConfiguration().setInt(HConstants.ZK_SESSION_TIMEOUT, ZK_SESSION_TIMEOUT);
 // Start a cluster with 2 masters and 3 regionservers.
 StartMiniClusterOption option = StartMiniClusterOption.builder()
   .numMasters(2).numRegionServers(3).numDataNodes(3).build();
 TEST_UTIL.startMiniCluster(option);
}

代码示例来源:origin: Impetus/Kundera

try
  zkCluster = new MiniZooKeeperCluster(conf);
  zkCluster.setDefaultClientPort(2181);
  zkCluster.setTickTime(18000);

代码示例来源:origin: apache/phoenix

public void preTest(HiveConf conf) throws Exception {
 if (zooKeeperCluster == null) {
  //create temp dir
  String tmpBaseDir =  System.getProperty(TEST_TMP_DIR_PROPERTY);
  File tmpDir = Utilities.createTempDir(tmpBaseDir);
  zooKeeperCluster = new MiniZooKeeperCluster();
  zkPort = zooKeeperCluster.startup(tmpDir);
 }
 if (zooKeeper != null) {
  zooKeeper.close();
 }
 int sessionTimeout =  (int) conf.getTimeVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_SESSION_TIMEOUT, TimeUnit.MILLISECONDS);
 zooKeeper = new ZooKeeper("localhost:" + zkPort, sessionTimeout, new Watcher() {
  @Override
  public void process(WatchedEvent arg0) {
  }
 });
 String zkServer = "localhost";
 conf.set("hive.zookeeper.quorum", zkServer);
 conf.set("hive.zookeeper.client.port", "" + zkPort);
}

代码示例来源:origin: jaibeermalik/searchanalytics-bigdata

miniZooKeeperCluster = new MiniZooKeeperCluster();
miniZooKeeperCluster.setDefaultClientPort(clientPort);
miniZooKeeperCluster.startup(clusterTestDir);

代码示例来源:origin: apache/tajo

/**
 * Start a mini ZK cluster. If the property "test.hbase.zookeeper.property.clientPort" is set
 *  the port mentionned is used as the default port for ZooKeeper.
 */
public MiniZooKeeperCluster startMiniZKCluster()
  throws Exception {
 File zkDataPath = new File(testBaseDir, "zk");
 if (this.zkCluster != null) {
  throw new IOException("Cluster already running at " + zkDataPath);
 }
 this.zkCluster = new MiniZooKeeperCluster(conf);
 final int defPort = this.conf.getInt("test.hbase.zookeeper.property.clientPort", 0);
 if (defPort > 0){
  // If there is a port in the config file, we use it.
  this.zkCluster.setDefaultClientPort(defPort);
 }
 int clientPort =  this.zkCluster.startup(zkDataPath, 1);
 this.conf.set(HConstants.ZOOKEEPER_CLIENT_PORT, Integer.toString(clientPort));
 LOG.info("MiniZooKeeperCluster started");
 return this.zkCluster;
}

代码示例来源:origin: alibaba/wasp

final MiniZooKeeperCluster zooKeeperCluster = new MiniZooKeeperCluster();
File zkDataPath = new File(conf.get(FConstants.ZOOKEEPER_DATA_DIR));
int zkClientPort = conf.getInt(FConstants.ZOOKEEPER_CLIENT_PORT, 0);

代码示例来源:origin: co.cask.hbase/hbase

new MiniZooKeeperCluster();
File zkDataPath = new File(conf.get(HConstants.ZOOKEEPER_DATA_DIR));
int zkClientPort = conf.getInt(HConstants.ZOOKEEPER_CLIENT_PORT, 0);

代码示例来源:origin: harbby/presto-connectors

final MiniZooKeeperCluster zooKeeperCluster = new MiniZooKeeperCluster(conf);
File zkDataPath = new File(conf.get(HConstants.ZOOKEEPER_DATA_DIR));

代码示例来源:origin: org.apache.hbase/hbase-zookeeper

/**
 * Start a mini ZK cluster. If the property "test.hbase.zookeeper.property.clientPort" is set the
 * port mentioned is used as the default port for ZooKeeper.
 */
private MiniZooKeeperCluster startMiniZKCluster(File dir, int zooKeeperServerNum,
  int[] clientPortList) throws Exception {
 if (this.zkCluster != null) {
  throw new IOException("Cluster already running at " + dir);
 }
 this.passedZkCluster = false;
 this.zkCluster = new MiniZooKeeperCluster(this.getConfiguration());
 int defPort = this.conf.getInt("test.hbase.zookeeper.property.clientPort", 0);
 if (defPort > 0) {
  // If there is a port in the config file, we use it.
  this.zkCluster.setDefaultClientPort(defPort);
 }
 if (clientPortList != null) {
  // Ignore extra client ports
  int clientPortListSize = (clientPortList.length <= zooKeeperServerNum) ? clientPortList.length
    : zooKeeperServerNum;
  for (int i = 0; i < clientPortListSize; i++) {
   this.zkCluster.addClientPort(clientPortList[i]);
  }
 }
 int clientPort = this.zkCluster.startup(dir, zooKeeperServerNum);
 this.conf.set(HConstants.ZOOKEEPER_CLIENT_PORT, Integer.toString(clientPort));
 return this.zkCluster;
}

代码示例来源:origin: com.aliyun.hbase/alihbase-zookeeper

/**
 * Start a mini ZK cluster. If the property "test.hbase.zookeeper.property.clientPort" is set the
 * port mentioned is used as the default port for ZooKeeper.
 */
private MiniZooKeeperCluster startMiniZKCluster(File dir, int zooKeeperServerNum,
  int[] clientPortList) throws Exception {
 if (this.zkCluster != null) {
  throw new IOException("Cluster already running at " + dir);
 }
 this.passedZkCluster = false;
 this.zkCluster = new MiniZooKeeperCluster(this.getConfiguration());
 int defPort = this.conf.getInt("test.hbase.zookeeper.property.clientPort", 0);
 if (defPort > 0) {
  // If there is a port in the config file, we use it.
  this.zkCluster.setDefaultClientPort(defPort);
 }
 if (clientPortList != null) {
  // Ignore extra client ports
  int clientPortListSize = (clientPortList.length <= zooKeeperServerNum) ? clientPortList.length
    : zooKeeperServerNum;
  for (int i = 0; i < clientPortListSize; i++) {
   this.zkCluster.addClientPort(clientPortList[i]);
  }
 }
 int clientPort = this.zkCluster.startup(dir, zooKeeperServerNum);
 this.conf.set(HConstants.ZOOKEEPER_CLIENT_PORT, Integer.toString(clientPort));
 return this.zkCluster;
}

代码示例来源:origin: org.apache.hbase/hbase-server

@BeforeClass
public static void beforeAllTests() throws Exception {
 int clientZkPort = 21828;
 clientZkCluster = new MiniZooKeeperCluster(TEST_UTIL.getConfiguration());
 clientZkCluster.setDefaultClientPort(clientZkPort);
 clientZkCluster.startup(clientZkDir);
 // reduce the retry number and start log counter
 TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2);
 TEST_UTIL.getConfiguration().setInt("hbase.client.start.log.errors.counter", -1);
 TEST_UTIL.getConfiguration().setInt("zookeeper.recovery.retry", 1);
 // core settings for testing client ZK cluster
 TEST_UTIL.getConfiguration().set(HConstants.CLIENT_ZOOKEEPER_QUORUM, HConstants.LOCALHOST);
 TEST_UTIL.getConfiguration().setInt(HConstants.CLIENT_ZOOKEEPER_CLIENT_PORT, clientZkPort);
 // reduce zk session timeout to easier trigger session expiration
 TEST_UTIL.getConfiguration().setInt(HConstants.ZK_SESSION_TIMEOUT, ZK_SESSION_TIMEOUT);
 // Start a cluster with 2 masters and 3 regionservers.
 TEST_UTIL.startMiniCluster(2, 3);
}

相关文章