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

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

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

ZKUtil.transformClusterKey介绍

[英]Separate the given key into the three configurations it should contain: hbase.zookeeper.quorum, hbase.zookeeper.client.port and zookeeper.znode.parent
[中]将给定的密钥分为它应该包含的三种配置:hbase。动物园管理员。法定人数,hbase。动物园管理员。客户港口和动物园管理员。兹诺德。父母亲

代码示例

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

/**
 * Apply the settings in the given key to the given configuration, this is
 * used to communicate with distant clusters
 * @param conf configuration object to configure
 * @param key string that contains the 3 required configuratins
 * @throws IOException
 */
public static void applyClusterKeyToConf(Configuration conf, String key)
  throws IOException{
 String[] parts = transformClusterKey(key);
 conf.set(HConstants.ZOOKEEPER_QUORUM, parts[0]);
 conf.set(HConstants.ZOOKEEPER_CLIENT_PORT, parts[1]);
 conf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, parts[2]);
}

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

public static void initCredentials(Job job) throws IOException {
 if (User.isHBaseSecurityEnabled(job.getConfiguration())) {
  try {
   // init credentials for remote cluster
   String quorumAddress = job.getConfiguration().get(
     TableOutputFormat.QUORUM_ADDRESS);
   if (quorumAddress != null) {
    String[] parts = ZKUtil.transformClusterKey(quorumAddress);
    Configuration peerConf = HBaseConfiguration.create(job
      .getConfiguration());
    peerConf.set(HConstants.ZOOKEEPER_QUORUM, parts[0]);
    peerConf.set("hbase.zookeeper.client.port", parts[1]);
    peerConf.set(HConstants.ZOOKEEPER_ZNODE_PARENT, parts[2]);
    User.getCurrent().obtainAuthTokenForJob(peerConf, job);
   }
   
   User.getCurrent().obtainAuthTokenForJob(job.getConfiguration(), job);
  } catch (InterruptedException ie) {
   LOG.info("Interrupted obtaining user authentication token");
   Thread.interrupted();
  }
 }
}

代码示例来源:origin: XiaoMi/themis

ZKUtil.transformClusterKey(quorumAddress);
conf.set(TableOutputFormat.QUORUM_ADDRESS, quorumAddress);

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

ZKUtil.transformClusterKey(quorumAddress);
conf.set(TableOutputFormat.QUORUM_ADDRESS,quorumAddress);

相关文章

微信公众号

最新文章

更多