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

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

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

MiniZooKeeperCluster.setDefaultClientPort介绍

暂无

代码示例

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

zooKeeperCluster.setDefaultClientPort(zkClientPort);

代码示例来源: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/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

zkCluster.setDefaultClientPort(2181);
zkCluster.setTickTime(18000);

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

cluster2.setDefaultClientPort(defaultClientPort);
try {
 assertEquals(4, cluster2.getBackupZooKeeperServerNum());

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

int clientPort = 10235;
miniZooKeeperCluster = new MiniZooKeeperCluster();
miniZooKeeperCluster.setDefaultClientPort(clientPort);
miniZooKeeperCluster.startup(clusterTestDir);
LOG.info("Setting up Hbase zookeeper mini cluster done!");

代码示例来源: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

+ FConstants.ZOOKEEPER_CLIENT_PORT);
zooKeeperCluster.setDefaultClientPort(zkClientPort);
int clientPort = zooKeeperCluster.startup(zkDataPath);
if (clientPort != zkClientPort) {

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

+ HConstants.ZOOKEEPER_CLIENT_PORT);
zooKeeperCluster.setDefaultClientPort(zkClientPort);

代码示例来源: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: harbby/presto-connectors

zooKeeperCluster.setDefaultClientPort(zkClientPort);

代码示例来源: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: 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);
}

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

cluster2.setDefaultClientPort(defaultClientPort);
try {
 assertEquals(4, cluster2.getBackupZooKeeperServerNum());

相关文章