gpt4 book ai didi

org.apache.hadoop.hive.common.ZooKeeperHiveHelper.getQuorumServers()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 15:17:31 27 4
gpt4 key购买 nike

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

ZooKeeperHiveHelper.getQuorumServers介绍

[英]Get the ensemble server addresses. The format is: host1:port, host2:port..
[中]获取集合服务器地址。格式为:host1:port,host2:port。。

代码示例

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

public CuratorFramework startZookeeperClient(ACLProvider zooKeeperAclProvider,
                       boolean addParentNode) throws Exception {
 String zooKeeperEnsemble = getQuorumServers();

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

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());
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com