当前位置: 首页>>代码示例>>Java>>正文


Java ExportedBlockKeys.isBlockTokenEnabled方法代码示例

本文整理汇总了Java中org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys.isBlockTokenEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java ExportedBlockKeys.isBlockTokenEnabled方法的具体用法?Java ExportedBlockKeys.isBlockTokenEnabled怎么用?Java ExportedBlockKeys.isBlockTokenEnabled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys的用法示例。


在下文中一共展示了ExportedBlockKeys.isBlockTokenEnabled方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: KeyManager

import org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys; //导入方法依赖的package包/类
public KeyManager(String blockpoolID, NamenodeProtocol namenode,
    boolean encryptDataTransfer, Configuration conf) throws IOException {
  this.namenode = namenode;
  this.encryptDataTransfer = encryptDataTransfer;

  final ExportedBlockKeys keys = namenode.getBlockKeys();
  this.isBlockTokenEnabled = keys.isBlockTokenEnabled();
  if (isBlockTokenEnabled) {
    long updateInterval = keys.getKeyUpdateInterval();
    long tokenLifetime = keys.getTokenLifetime();
    LOG.info("Block token params received from NN: update interval="
        + StringUtils.formatTime(updateInterval)
        + ", token lifetime=" + StringUtils.formatTime(tokenLifetime));
    String encryptionAlgorithm = conf.get(
        DFSConfigKeys.DFS_DATA_ENCRYPTION_ALGORITHM_KEY);
    this.blockTokenSecretManager = new BlockTokenSecretManager(
        updateInterval, tokenLifetime, blockpoolID, encryptionAlgorithm);
    this.blockTokenSecretManager.addKeys(keys);

    // sync block keys with NN more frequently than NN updates its block keys
    this.blockKeyUpdater = new BlockKeyUpdater(updateInterval / 4);
    this.shouldRun = true;
  } else {
    this.blockTokenSecretManager = null;
    this.blockKeyUpdater = null;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:KeyManager.java

示例2: registerBlockPoolWithSecretManager

import org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys; //导入方法依赖的package包/类
/**
 * After the block pool has contacted the NN, registers that block pool
 * with the secret manager, updating it with the secrets provided by the NN.
 * @throws IOException on error
 */
private synchronized void registerBlockPoolWithSecretManager(
    DatanodeRegistration bpRegistration, String blockPoolId) throws IOException {
  ExportedBlockKeys keys = bpRegistration.getExportedKeys();
  if (!hasAnyBlockPoolRegistered) {
    hasAnyBlockPoolRegistered = true;
    isBlockTokenEnabled = keys.isBlockTokenEnabled();
  } else {
    if (isBlockTokenEnabled != keys.isBlockTokenEnabled()) {
      throw new RuntimeException("Inconsistent configuration of block access"
          + " tokens. Either all block pools must be configured to use block"
          + " tokens, or none may be.");
    }
  }
  if (!isBlockTokenEnabled) return;
  
  if (!blockPoolTokenSecretManager.isBlockPoolRegistered(blockPoolId)) {
    long blockKeyUpdateInterval = keys.getKeyUpdateInterval();
    long blockTokenLifetime = keys.getTokenLifetime();
    LOG.info("Block token params received from NN: for block pool " +
        blockPoolId + " keyUpdateInterval="
        + blockKeyUpdateInterval / (60 * 1000)
        + " min(s), tokenLifetime=" + blockTokenLifetime / (60 * 1000)
        + " min(s)");
    final BlockTokenSecretManager secretMgr = 
        new BlockTokenSecretManager(0, blockTokenLifetime, blockPoolId,
            dnConf.encryptionAlgorithm);
    blockPoolTokenSecretManager.addBlockPool(blockPoolId, secretMgr);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:DataNode.java

示例3: registerBlockPoolWithSecretManager

import org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys; //导入方法依赖的package包/类
/**
 * After the block pool has contacted the NN, registers that block pool
 * with the secret manager, updating it with the secrets provided by the NN.
 * @param bpRegistration
 * @param blockPoolId
 * @throws IOException
 */
private synchronized void registerBlockPoolWithSecretManager(
    DatanodeRegistration bpRegistration, String blockPoolId) throws IOException {
  ExportedBlockKeys keys = bpRegistration.getExportedKeys();
  if (!hasAnyBlockPoolRegistered) {
    hasAnyBlockPoolRegistered = true;
    isBlockTokenEnabled = keys.isBlockTokenEnabled();
  } else {
    if (isBlockTokenEnabled != keys.isBlockTokenEnabled()) {
      throw new RuntimeException("Inconsistent configuration of block access"
          + " tokens. Either all block pools must be configured to use block"
          + " tokens, or none may be.");
    }
  }
  if (!isBlockTokenEnabled) return;
  
  if (!blockPoolTokenSecretManager.isBlockPoolRegistered(blockPoolId)) {
    long blockKeyUpdateInterval = keys.getKeyUpdateInterval();
    long blockTokenLifetime = keys.getTokenLifetime();
    LOG.info("Block token params received from NN: for block pool " +
        blockPoolId + " keyUpdateInterval="
        + blockKeyUpdateInterval / (60 * 1000)
        + " min(s), tokenLifetime=" + blockTokenLifetime / (60 * 1000)
        + " min(s)");
    final BlockTokenSecretManager secretMgr = 
        new BlockTokenSecretManager(0, blockTokenLifetime, blockPoolId,
            dnConf.encryptionAlgorithm);
    blockPoolTokenSecretManager.addBlockPool(blockPoolId, secretMgr);
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:37,代码来源:DataNode.java

示例4: registerBlockPoolWithSecretManager

import org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys; //导入方法依赖的package包/类
/**
 * After the block pool has contacted the NN, registers that block pool
 * with the secret manager, updating it with the secrets provided by the NN.
 *
 * @param bpRegistration
 * @param blockPoolId
 * @throws IOException
 */
private synchronized void registerBlockPoolWithSecretManager(
    DatanodeRegistration bpRegistration, String blockPoolId)
    throws IOException {
  ExportedBlockKeys keys = bpRegistration.getExportedKeys();
  if (!hasAnyBlockPoolRegistered) {
    hasAnyBlockPoolRegistered = true;
    isBlockTokenEnabled = keys.isBlockTokenEnabled();
  } else {
    if (isBlockTokenEnabled != keys.isBlockTokenEnabled()) {
      throw new RuntimeException(
          "Inconsistent configuration of block access" +
              " tokens. Either all block pools must be configured to use block" +
              " tokens, or none may be.");
    }
  }
  if (!isBlockTokenEnabled) {
    return;
  }
  
  if (!blockPoolTokenSecretManager.isBlockPoolRegistered(blockPoolId)) {
    long blockKeyUpdateInterval = keys.getKeyUpdateInterval();
    long blockTokenLifetime = keys.getTokenLifetime();
    LOG.info("Block token params received from NN: for block pool " +
        blockPoolId + " keyUpdateInterval=" +
        blockKeyUpdateInterval / (60 * 1000) + " min(s), tokenLifetime=" +
        blockTokenLifetime / (60 * 1000) + " min(s)");
    final BlockTokenSecretManager secretMgr =
        new BlockTokenSecretManager(0, blockTokenLifetime, blockPoolId,
            dnConf.encryptionAlgorithm);
    blockPoolTokenSecretManager.addBlockPool(blockPoolId, secretMgr);
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:41,代码来源:DataNode.java

示例5: init

import org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys; //导入方法依赖的package包/类
private void init(double threshold) throws IOException {
  this.threshold = threshold;
  this.namenode = createNamenode(conf);
  this.client = DFSClient.createNamenode(conf);
  this.fs = FileSystem.get(conf);
  ExportedBlockKeys keys = namenode.getBlockKeys();
  this.isBlockTokenEnabled = keys.isBlockTokenEnabled();
  if (isBlockTokenEnabled) {
    long blockKeyUpdateInterval = keys.getKeyUpdateInterval();
    long blockTokenLifetime = keys.getTokenLifetime();
    LOG.info("Block token params received from NN: keyUpdateInterval="
        + blockKeyUpdateInterval / (60 * 1000) + " min(s), tokenLifetime="
        + blockTokenLifetime / (60 * 1000) + " min(s)");
    this.blockTokenSecretManager = new BlockTokenSecretManager(false,
        blockKeyUpdateInterval, blockTokenLifetime);
    this.blockTokenSecretManager.setKeys(keys);
    /*
     * Balancer should sync its block keys with NN more frequently than NN
     * updates its block keys
     */
    this.keyUpdaterInterval = blockKeyUpdateInterval / 4;
    LOG.info("Balancer will update its block keys every "
        + keyUpdaterInterval / (60 * 1000) + " minute(s)");
    this.keyupdaterthread = new Daemon(new BlockKeyUpdater());
    this.shouldRun = true;
    this.keyupdaterthread.start();
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:29,代码来源:Balancer.java

示例6: NameNodeConnector

import org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys; //导入方法依赖的package包/类
NameNodeConnector(URI nameNodeUri,
    Configuration conf) throws IOException {
  this.nameNodeUri = nameNodeUri;
  
  this.namenode =
    NameNodeProxies.createProxy(conf, nameNodeUri, NamenodeProtocol.class)
      .getProxy();
  this.client =
    NameNodeProxies.createProxy(conf, nameNodeUri, ClientProtocol.class)
      .getProxy();
  this.fs = FileSystem.get(nameNodeUri, conf);

  final NamespaceInfo namespaceinfo = namenode.versionRequest();
  this.blockpoolID = namespaceinfo.getBlockPoolID();

  final ExportedBlockKeys keys = namenode.getBlockKeys();
  this.isBlockTokenEnabled = keys.isBlockTokenEnabled();
  if (isBlockTokenEnabled) {
    long blockKeyUpdateInterval = keys.getKeyUpdateInterval();
    long blockTokenLifetime = keys.getTokenLifetime();
    LOG.info("Block token params received from NN: keyUpdateInterval="
        + blockKeyUpdateInterval / (60 * 1000) + " min(s), tokenLifetime="
        + blockTokenLifetime / (60 * 1000) + " min(s)");
    String encryptionAlgorithm = conf.get(
        DFSConfigKeys.DFS_DATA_ENCRYPTION_ALGORITHM_KEY);
    this.blockTokenSecretManager = new BlockTokenSecretManager(
        blockKeyUpdateInterval, blockTokenLifetime, blockpoolID,
        encryptionAlgorithm);
    this.blockTokenSecretManager.addKeys(keys);
    /*
     * Balancer should sync its block keys with NN more frequently than NN
     * updates its block keys
     */
    this.keyUpdaterInterval = blockKeyUpdateInterval / 4;
    LOG.info("Balancer will update its block keys every "
        + keyUpdaterInterval / (60 * 1000) + " minute(s)");
    this.keyupdaterthread = new Daemon(new BlockKeyUpdater());
    this.shouldRun = true;
    this.keyupdaterthread.start();
  }
  this.encryptDataTransfer = fs.getServerDefaults(new Path("/"))
      .getEncryptDataTransfer();
  // Check if there is another balancer running.
  // Exit if there is another one running.
  out = checkAndMarkRunningBalancer(); 
  if (out == null) {
    throw new IOException("Another balancer is running");
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:50,代码来源:NameNodeConnector.java

示例7: NameNodeConnector

import org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys; //导入方法依赖的package包/类
NameNodeConnector(URI nameNodeUri, Configuration conf) throws IOException {
  this.nameNodeUri = nameNodeUri;
  
  this.namenode =
      NameNodeProxies.createProxy(conf, nameNodeUri, NamenodeProtocol.class)
          .getProxy();
  this.client =
      NameNodeProxies.createProxy(conf, nameNodeUri, ClientProtocol.class)
          .getProxy();
  this.fs = FileSystem.get(nameNodeUri, conf);

  final NamespaceInfo namespaceinfo = namenode.versionRequest();
  this.blockpoolID = namespaceinfo.getBlockPoolID();

  final ExportedBlockKeys keys = namenode.getBlockKeys();
  this.isBlockTokenEnabled = keys.isBlockTokenEnabled();
  if (isBlockTokenEnabled) {
    long blockKeyUpdateInterval = keys.getKeyUpdateInterval();
    long blockTokenLifetime = keys.getTokenLifetime();
    LOG.info("Block token params received from NN: keyUpdateInterval=" +
        blockKeyUpdateInterval / (60 * 1000) + " min(s), tokenLifetime=" +
        blockTokenLifetime / (60 * 1000) + " min(s)");
    String encryptionAlgorithm =
        conf.get(DFSConfigKeys.DFS_DATA_ENCRYPTION_ALGORITHM_KEY);
    this.blockTokenSecretManager =
        new BlockTokenSecretManager(blockKeyUpdateInterval,
            blockTokenLifetime, blockpoolID, encryptionAlgorithm);
    this.blockTokenSecretManager.addKeys(keys);
    /*
     * Balancer should sync its block keys with NN more frequently than NN
     * updates its block keys
     */
    this.keyUpdaterInterval = blockKeyUpdateInterval / 4;
    LOG.info("Balancer will update its block keys every " +
        keyUpdaterInterval / (60 * 1000) + " minute(s)");
    this.keyupdaterthread = new Daemon(new BlockKeyUpdater());
    this.shouldRun = true;
    this.keyupdaterthread.start();
  }
  this.encryptDataTransfer =
      fs.getServerDefaults(new Path("/")).getEncryptDataTransfer();
  // Check if there is another balancer running.
  // Exit if there is another one running.
  out = checkAndMarkRunningBalancer();
  if (out == null) {
    throw new IOException("Another balancer is running");
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:49,代码来源:NameNodeConnector.java

示例8: NameNodeConnector

import org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys; //导入方法依赖的package包/类
NameNodeConnector(URI nameNodeUri,
    Configuration conf) throws IOException {
  this.nameNodeUri = nameNodeUri;
  
  this.namenode =
    NameNodeProxies.createProxy(conf, nameNodeUri, NamenodeProtocol.class)
      .getProxy();
  this.client =
    NameNodeProxies.createProxy(conf, nameNodeUri, ClientProtocol.class)
      .getProxy();
  this.fs = FileSystem.get(nameNodeUri, conf);

  final NamespaceInfo namespaceinfo = namenode.versionRequest();
  this.blockpoolID = namespaceinfo.getBlockPoolID();

  final ExportedBlockKeys keys = namenode.getBlockKeys();
  this.isBlockTokenEnabled = keys.isBlockTokenEnabled();
  if (isBlockTokenEnabled) {
    long blockKeyUpdateInterval = keys.getKeyUpdateInterval();
    long blockTokenLifetime = keys.getTokenLifetime();
    LOG.info("Block token params received from NN: keyUpdateInterval="
        + blockKeyUpdateInterval / (60 * 1000) + " min(s), tokenLifetime="
        + blockTokenLifetime / (60 * 1000) + " min(s)");
    String encryptionAlgorithm = conf.get(
        DFSConfigKeys.DFS_DATA_ENCRYPTION_ALGORITHM_KEY);
    this.blockTokenSecretManager = new BlockTokenSecretManager(
        blockKeyUpdateInterval, blockTokenLifetime, blockpoolID,
        encryptionAlgorithm);
    this.blockTokenSecretManager.addKeys(keys);
    /*
     * Balancer should sync its block keys with NN more frequently than NN
     * updates its block keys
     */
    this.keyUpdaterInterval = blockKeyUpdateInterval / 4;
    LOG.info("Balancer will update its block keys every "
        + keyUpdaterInterval / (60 * 1000) + " minute(s)");
    this.keyupdaterthread = new Daemon(new BlockKeyUpdater());
    this.shouldRun = true;
    this.keyupdaterthread.start();
  }
  this.encryptDataTransfer = fs.getServerDefaults(new Path("/"))
      .getEncryptDataTransfer();
  // Check if there is another balancer running.
  // Exit if there is another one running.
  out = checkAndMarkRunningBalancer(); 
  if (out == null) {
    throw new IOException("Another balancer is running");
  }
  this.trustedChannelResolver = TrustedChannelResolver.getInstance(conf);
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:51,代码来源:NameNodeConnector.java


注:本文中的org.apache.hadoop.hdfs.security.token.block.ExportedBlockKeys.isBlockTokenEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。