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

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

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

ZooKeeperWatcher.isBaseZnodeAclSetup介绍

[英]Checks whether the ACLs returned from the base znode (/hbase) is set for secure setup.
[中]检查是否将从基本znode(/hbase)返回的ACL设置为安全设置。

代码示例

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

/**
 * On master start, we check the znode ACLs under the root directory and set the ACLs properly
 * if needed. If the cluster goes from an unsecure setup to a secure setup, this step is needed
 * so that the existing znodes created with open permissions are now changed with restrictive
 * perms.
 */
public void checkAndSetZNodeAcls() {
 if (!ZKUtil2.isSecureZooKeeper(getConfiguration())) {
  LOG.info("not a secure deployment, proceeding");
  return;
 }
 // Check the base znodes permission first. Only do the recursion if base znode's perms are not
 // correct.
 try {
  List<ACL> actualAcls = recoverableZooKeeper.getAcl(baseZNode, new Stat());
  if (!isBaseZnodeAclSetup(actualAcls)) {
   LOG.info("setting znode ACLs");
   setZnodeAclsRecursive(baseZNode);
  }
 } catch(KeeperException.NoNodeException nne) {
  return;
 } catch(InterruptedException ie) {
  interruptedException(ie);
 } catch (IOException|KeeperException e) {
  LOG.warn("Received exception while checking and setting zookeeper ACLs", e);
 }
}

代码示例来源:origin: harbby/presto-connectors

/**
 * On master start, we check the znode ACLs under the root directory and set the ACLs properly
 * if needed. If the cluster goes from an unsecure setup to a secure setup, this step is needed
 * so that the existing znodes created with open permissions are now changed with restrictive
 * perms.
 */
public void checkAndSetZNodeAcls() {
 if (!ZKUtil.isSecureZooKeeper(getConfiguration())) {
  LOG.info("not a secure deployment, proceeding");
  return;
 }
 // Check the base znodes permission first. Only do the recursion if base znode's perms are not
 // correct.
 try {
  List<ACL> actualAcls = recoverableZooKeeper.getAcl(baseZNode, new Stat());
  if (!isBaseZnodeAclSetup(actualAcls)) {
   LOG.info("setting znode ACLs");
   setZnodeAclsRecursive(baseZNode);
  }
 } catch(KeeperException.NoNodeException nne) {
  return;
 } catch(InterruptedException ie) {
  interruptedException(ie);
 } catch (IOException|KeeperException e) {
  LOG.warn("Received exception while checking and setting zookeeper ACLs", e);
 }
}

相关文章