本文整理了Java中org.apache.hadoop.hbase.zookeeper.ZooKeeperHelper.getConnectedZooKeeper()
方法的一些代码示例,展示了ZooKeeperHelper.getConnectedZooKeeper()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperHelper.getConnectedZooKeeper()
方法的具体详情如下:
包路径:org.apache.hadoop.hbase.zookeeper.ZooKeeperHelper
类名称: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);
内容来源于网络,如有侵权,请联系作者删除!