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

x33g5p2x  于2022-02-05 转载在 其他  
字(3.4k)|赞(0)|评价(0)|浏览(581)

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

ZooKeeperHelper.getConnectedZooKeeper介绍

[英]Get a ZooKeeper instance and wait until it connected before returning.
[中]获取ZooKeeper实例并等待它连接后返回。

代码示例

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

@BeforeClass
public static void setUp() throws Exception {
 PORT = UTIL.startMiniZKCluster().getClientPort();
 ZooKeeper zk = ZooKeeperHelper.getConnectedZooKeeper("localhost:" + PORT, 10000);
 DATA = new byte[10];
 ThreadLocalRandom.current().nextBytes(DATA);
 zk.create(PATH, DATA, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
 for (int i = 0; i < CHILDREN; i++) {
  zk.create(PATH + "/c" + i, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
 }
 zk.close();
 Configuration conf = UTIL.getConfiguration();
 conf.set(HConstants.ZOOKEEPER_QUORUM, "localhost:" + PORT);
 conf.setInt(ReadOnlyZKClient.RECOVERY_RETRY, 3);
 conf.setInt(ReadOnlyZKClient.RECOVERY_RETRY_INTERVAL_MILLIS, 100);
 conf.setInt(ReadOnlyZKClient.KEEPALIVE_MILLIS, 3000);
 RO_ZK = new ReadOnlyZKClient(conf);
 // only connect when necessary
 assertNull(RO_ZK.zookeeper);
}

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

getConnectedZooKeeper(ZKConfig.getZKQuorumServersString(TEST_UTIL.getConfiguration()),
  60000);

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

@BeforeClass
public static void setUp() throws Exception {
 PORT = UTIL.startMiniZKCluster().getClientPort();
 ZooKeeper zk = ZooKeeperHelper.getConnectedZooKeeper("localhost:" + PORT, 10000);
 DATA = new byte[10];
 ThreadLocalRandom.current().nextBytes(DATA);
 zk.create(PATH, DATA, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
 for (int i = 0; i < CHILDREN; i++) {
  zk.create(PATH + "/c" + i, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
 }
 zk.close();
 Configuration conf = UTIL.getConfiguration();
 conf.set(HConstants.ZOOKEEPER_QUORUM, "localhost:" + PORT);
 conf.setInt(ReadOnlyZKClient.RECOVERY_RETRY, 3);
 conf.setInt(ReadOnlyZKClient.RECOVERY_RETRY_INTERVAL_MILLIS, 100);
 conf.setInt(ReadOnlyZKClient.KEEPALIVE_MILLIS, 3000);
 RO_ZK = new ReadOnlyZKClient(conf);
 // only connect when necessary
 assertNull(RO_ZK.zookeeper);
}

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

@BeforeClass
public static void setUp() throws Exception {
 PORT = UTIL.startMiniZKCluster().getClientPort();
 ZooKeeper zk = ZooKeeperHelper.getConnectedZooKeeper("localhost:" + PORT, 10000);
 DATA = new byte[10];
 ThreadLocalRandom.current().nextBytes(DATA);
 zk.create(PATH, DATA, ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
 for (int i = 0; i < CHILDREN; i++) {
  zk.create(PATH + "/c" + i, new byte[0], ZooDefs.Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT);
 }
 zk.close();
 Configuration conf = UTIL.getConfiguration();
 conf.set(HConstants.ZOOKEEPER_QUORUM, "localhost:" + PORT);
 conf.setInt(ReadOnlyZKClient.RECOVERY_RETRY, 3);
 conf.setInt(ReadOnlyZKClient.RECOVERY_RETRY_INTERVAL_MILLIS, 100);
 conf.setInt(ReadOnlyZKClient.KEEPALIVE_MILLIS, 3000);
 RO_ZK = new ReadOnlyZKClient(conf);
 // only connect when necessary
 assertNull(RO_ZK.zookeeper);
}

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

getConnectedZooKeeper(ZKConfig.getZKQuorumServersString(TEST_UTIL.getConfiguration()),
  60000);

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

getConnectedZooKeeper(ZKConfig.getZKQuorumServersString(TEST_UTIL.getConfiguration()),
  60000);

相关文章

微信公众号

最新文章

更多