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

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

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

ZooKeeperWatcher.setZnodeAclsRecursive介绍

[英]Set the znode perms recursively. This will do post-order recursion, so that baseZnode ACLs will be set last in case the master fails in between.
[中]递归设置znode perms。这将进行后序递归,以便在主节点失败时,baseZnode ACL将最后设置。

代码示例

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

/**
 * Set the znode perms recursively. This will do post-order recursion, so that baseZnode ACLs
 * will be set last in case the master fails in between.
 * @param znode
 */
private void setZnodeAclsRecursive(String znode) throws KeeperException, InterruptedException {
 List<String> children = recoverableZooKeeper.getChildren(znode, false);
 for (String child : children) {
  setZnodeAclsRecursive(ZKUtil2.joinZNode(znode, child));
 }
 List<ACL> acls = ZKUtil2.createACL(this, znode, true);
 LOG.info("Setting ACLs for znode:" + znode + " , acl:" + acls);
 recoverableZooKeeper.setAcl(znode, acls, -1);
}

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

/**
 * Set the znode perms recursively. This will do post-order recursion, so that baseZnode ACLs
 * will be set last in case the master fails in between.
 * @param znode
 */
private void setZnodeAclsRecursive(String znode) throws KeeperException, InterruptedException {
 List<String> children = recoverableZooKeeper.getChildren(znode, false);
 for (String child : children) {
  setZnodeAclsRecursive(ZKUtil.joinZNode(znode, child));
 }
 List<ACL> acls = ZKUtil.createACL(this, znode, true);
 LOG.info("Setting ACLs for znode:" + znode + " , acl:" + acls);
 recoverableZooKeeper.setAcl(znode, acls, -1);
}

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

相关文章