本文整理了Java中org.apache.hadoop.hive.common.ZooKeeperHiveHelper
类的一些代码示例,展示了ZooKeeperHiveHelper
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZooKeeperHiveHelper
类的具体详情如下:
包路径:org.apache.hadoop.hive.common.ZooKeeperHiveHelper
类名称:ZooKeeperHiveHelper
[英]ZooKeeperHiveHelper. A helper class to hold ZooKeeper related configuration, to register and deregister ZooKeeper node for a given server and to fetch registered server URIs for clients.
[中]ZooKeeperHiveHelper。一个帮助类,用于保存与ZooKeeper相关的配置、注册和注销给定服务器的ZooKeeper节点,以及为客户端获取已注册的服务器URI。
代码示例来源:origin: apache/hive
public CuratorFramework startZookeeperClient(ACLProvider zooKeeperAclProvider,
boolean addParentNode) throws Exception {
String zooKeeperEnsemble = getQuorumServers();
代码示例来源:origin: apache/hive
metastoreUrisString = new ArrayList<String>();
for (String s : MetastoreConf.getZKConfig(conf).getServerUris()) {
metastoreUrisString.add("thrift://" + s);
代码示例来源:origin: apache/hive
zooKeeperClient = startZookeeperClient(zooKeeperAclProvider, true);
throw new Exception("Max znode creation wait time: " + znodeCreationTimeout + "s exhausted");
setDeregisteredWithZooKeeper(false);
final String znodePath = znode.getActualPath();
if (zooKeeperClient.checkExists().usingWatcher(watcher).forPath(znodePath) == null) {
代码示例来源:origin: apache/hive
public static ZooKeeperHiveHelper getZKConfig(Configuration conf) {
return new ZooKeeperHiveHelper(MetastoreConf.getVar(conf, ConfVars.THRIFT_URIS),
MetastoreConf.getVar(conf, ConfVars.THRIFT_ZOOKEEPER_CLIENT_PORT),
MetastoreConf.getVar(conf, ConfVars.THRIFT_ZOOKEEPER_NAMESPACE),
(int) MetastoreConf.getTimeVar(conf, ConfVars.THRIFT_ZOOKEEPER_SESSION_TIMEOUT,
TimeUnit.MILLISECONDS),
(int) MetastoreConf.getTimeVar(conf, ConfVars.THRIFT_ZOOKEEPER_CONNECTION_BASESLEEPTIME,
TimeUnit.MILLISECONDS),
MetastoreConf.getIntVar(conf, ConfVars.THRIFT_ZOOKEEPER_CONNECTION_MAX_RETRIES));
}
代码示例来源:origin: apache/hive
List<String> serverUris;
try {
zkClient = startZookeeperClient(null, false);
List<String> serverNodes =
zkClient.getChildren().forPath(ZOOKEEPER_PATH_SEPARATOR + rootNamespace);
代码示例来源:origin: apache/hive
try {
if (zooKeeperHelper != null) {
zooKeeperHelper.removeServerInstanceFromZooKeeper();
代码示例来源:origin: apache/hive
String znodePathPrefix = "serverUri=" + instanceURI + ";" +
"version=" + HiveVersionInfo.getVersion() + ";" + "sequence=";
zooKeeperHelper.addServerInstanceToZooKeeper(znodePathPrefix, znodeData,
zooKeeperAclProvider, new DeRegisterWatcher(zooKeeperHelper));
代码示例来源:origin: apache/hive
@Override
public void process(WatchedEvent event) {
if (event.getType().equals(Watcher.Event.EventType.NodeDeleted)) {
zooKeeperHiveHelper.deregisterZnode();
}
}
}
代码示例来源:origin: apache/hive
/**
* @return a ZooKeeperHiveHelper instance containing the ZooKeeper specifications from the
* given HiveConf.
*/
public ZooKeeperHiveHelper getZKConfig() {
return new ZooKeeperHiveHelper(getVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_QUORUM),
getVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_CLIENT_PORT),
getVar(HiveConf.ConfVars.HIVE_SERVER2_ZOOKEEPER_NAMESPACE),
(int) getTimeVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_SESSION_TIMEOUT,
TimeUnit.MILLISECONDS),
(int) getTimeVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_CONNECTION_BASESLEEPTIME,
TimeUnit.MILLISECONDS),
getIntVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_CONNECTION_MAX_RETRIES));
}
代码示例来源:origin: apache/hive
zKClientForPrivSync = hiveConf.getZKConfig().startZookeeperClient(zooKeeperAclProvider, true);
String rootNamespace = hiveConf.getVar(HiveConf.ConfVars.HIVE_SERVER2_ZOOKEEPER_NAMESPACE);
String path = ZooKeeperHiveHelper.ZOOKEEPER_PATH_SEPARATOR + rootNamespace
代码示例来源:origin: apache/hive
if (MetastoreConf.getVar(conf, ConfVars.THRIFT_SERVICE_DISCOVERY_MODE)
.equalsIgnoreCase("zookeeper")) {
zooKeeperHelper.removeServerInstanceFromZooKeeper();
代码示例来源:origin: apache/hive
zooKeeperHelper = MetastoreConf.getZKConfig(conf);
String serverInstanceURI = getServerInstanceURI(port);
zooKeeperHelper.addServerInstanceToZooKeeper(serverInstanceURI, serverInstanceURI, null,
new ZKDeRegisterWatcher(zooKeeperHelper));
HMSHandler.LOG.info("Metastore server instance with URL " + serverInstanceURI + " added to " +
代码示例来源:origin: apache/hive
public static synchronized CuratorFramework getInstance(HiveConf hiveConf) {
if (sharedClient == null) {
// Create a client instance
if (hiveConf == null) {
conf = new HiveConf();
} else {
conf = hiveConf;
}
int sessionTimeout = (int) conf.getTimeVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_SESSION_TIMEOUT, TimeUnit.MILLISECONDS);
int baseSleepTime = (int) conf.getTimeVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_CONNECTION_BASESLEEPTIME, TimeUnit.MILLISECONDS);
int maxRetries = conf.getIntVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_CONNECTION_MAX_RETRIES);
String quorumServers = conf.getZKConfig().getQuorumServers();
sharedClient = CuratorFrameworkFactory.builder().connectString(quorumServers)
.sessionTimeoutMs(sessionTimeout)
.retryPolicy(new ExponentialBackoffRetry(baseSleepTime, maxRetries))
.build();
sharedClient.start();
}
return sharedClient;
}
代码示例来源:origin: apache/hive
while (true) {
try {
List<String> serverUris = zkHelper.getServerUris();
代码示例来源:origin: apache/hive
String zooKeeperEnsemble = hiveConf.getZKConfig().getQuorumServers();
String rootNamespace = hiveConf.getVar(HiveConf.ConfVars.HIVE_SERVER2_ZOOKEEPER_NAMESPACE);
int baseSleepTime = (int) hiveConf.getTimeVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_CONNECTION_BASESLEEPTIME, TimeUnit.MILLISECONDS);
代码示例来源:origin: apache/hive
@Test
public void testGetQuorumServers() {
conf.setVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_QUORUM, "node1");
conf.setVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_CLIENT_PORT, "9999");
Assert.assertEquals("node1:9999", conf.getZKConfig().getQuorumServers());
conf.setVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_QUORUM, "node1,node2,node3");
conf.setVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_CLIENT_PORT, "9999");
Assert.assertEquals("node1:9999,node2:9999,node3:9999",
conf.getZKConfig().getQuorumServers());
conf.setVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_QUORUM, "node1:5666,node2,node3");
conf.setVar(HiveConf.ConfVars.HIVE_ZOOKEEPER_CLIENT_PORT, "9999");
Assert.assertEquals("node1:5666,node2:9999,node3:9999",
conf.getZKConfig().getQuorumServers());
}
内容来源于网络,如有侵权,请联系作者删除!