• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NamenodeRegistration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration的典型用法代码示例。如果您正苦于以下问题:Java NamenodeRegistration类的具体用法?Java NamenodeRegistration怎么用?Java NamenodeRegistration使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NamenodeRegistration类属于org.apache.hadoop.hdfs.server.protocol包,在下文中一共展示了NamenodeRegistration类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: EditLogBackupOutputStream

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
EditLogBackupOutputStream(NamenodeRegistration bnReg, // backup node
                          JournalInfo journalInfo) // active name-node
throws IOException {
  super();
  this.bnRegistration = bnReg;
  this.journalInfo = journalInfo;
  InetSocketAddress bnAddress =
    NetUtils.createSocketAddr(bnRegistration.getAddress());
  try {
    this.backupNode = NameNodeProxies.createNonHAProxy(new HdfsConfiguration(),
        bnAddress, JournalProtocol.class, UserGroupInformation.getCurrentUser(),
        true).getProxy();
  } catch(IOException e) {
    Storage.LOG.error("Error connecting to: " + bnAddress, e);
    throw e;
  }
  this.doubleBuf = new EditsDoubleBuffer(DEFAULT_BUFFER_SIZE);
  this.out = new DataOutputBuffer(DEFAULT_BUFFER_SIZE);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:EditLogBackupOutputStream.java


示例2: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
NamenodeCommand startCheckpoint(NamenodeRegistration backupNode,
    NamenodeRegistration activeNamenode) throws IOException {
  checkOperation(OperationCategory.CHECKPOINT);
  writeLock();
  try {
    checkOperation(OperationCategory.CHECKPOINT);
    checkNameNodeSafeMode("Checkpoint not started");
    
    LOG.info("Start checkpoint for " + backupNode.getAddress());
    NamenodeCommand cmd = getFSImage().startCheckpoint(backupNode,
        activeNamenode);
    getEditLog().logSync();
    return cmd;
  } finally {
    writeUnlock();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:FSNamesystem.java


示例3: registerBackupNode

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
/**
 * Register a Backup name-node, verifying that it belongs
 * to the correct namespace, and adding it to the set of
 * active journals if necessary.
 * 
 * @param bnReg registration of the new BackupNode
 * @param nnReg registration of this NameNode
 * @throws IOException if the namespace IDs do not match
 */
void registerBackupNode(NamenodeRegistration bnReg,
    NamenodeRegistration nnReg) throws IOException {
  writeLock();
  try {
    if(getFSImage().getStorage().getNamespaceID() 
       != bnReg.getNamespaceID())
      throw new IOException("Incompatible namespaceIDs: "
          + " Namenode namespaceID = "
          + getFSImage().getStorage().getNamespaceID() + "; "
          + bnReg.getRole() +
          " node namespaceID = " + bnReg.getNamespaceID());
    if (bnReg.getRole() == NamenodeRole.BACKUP) {
      getFSImage().getEditLog().registerBackupNode(
          bnReg, nnReg);
    }
  } finally {
    writeUnlock();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:FSNamesystem.java


示例4: releaseBackupNode

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
/**
 * Release (unregister) backup node.
 * <p>
 * Find and remove the backup stream corresponding to the node.
 * @throws IOException
 */
void releaseBackupNode(NamenodeRegistration registration)
  throws IOException {
  checkOperation(OperationCategory.WRITE);
  writeLock();
  try {
    checkOperation(OperationCategory.WRITE);
    if(getFSImage().getStorage().getNamespaceID()
       != registration.getNamespaceID())
      throw new IOException("Incompatible namespaceIDs: "
          + " Namenode namespaceID = "
          + getFSImage().getStorage().getNamespaceID() + "; "
          + registration.getRole() +
          " node namespaceID = " + registration.getNamespaceID());
    getEditLog().releaseBackupStream(registration);
  } finally {
    writeUnlock();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:FSNamesystem.java


示例5: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
@Override // NamenodeProtocol
public NamenodeCommand startCheckpoint(NamenodeRegistration registration)
    throws IOException {
  checkNNStartup();
  namesystem.checkSuperuserPrivilege();
  verifyRequest(registration);
  if(!nn.isRole(NamenodeRole.NAMENODE))
    throw new IOException("Only an ACTIVE node can invoke startCheckpoint.");

  CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion(retryCache,
    null);
  if (cacheEntry != null && cacheEntry.isSuccess()) {
    return (NamenodeCommand) cacheEntry.getPayload();
  }
  NamenodeCommand ret = null;
  try {
    ret = namesystem.startCheckpoint(registration, nn.setRegistration());
  } finally {
    RetryCache.setState(cacheEntry, ret != null, ret);
  }
  return ret;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:NameNodeRpcServer.java


示例6: endCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
@Override // NamenodeProtocol
public void endCheckpoint(NamenodeRegistration registration,
                          CheckpointSignature sig) throws IOException {
  checkNNStartup();
  namesystem.checkSuperuserPrivilege();
  CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
  if (cacheEntry != null && cacheEntry.isSuccess()) {
    return; // Return previous response
  }
  boolean success = false;
  try {
    namesystem.endCheckpoint(registration, sig);
    success = true;
  } finally {
    RetryCache.setState(cacheEntry, success);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:NameNodeRpcServer.java


示例7: registerBackupNode

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
/**
 * Create (or find if already exists) an edit output stream, which
 * streams journal records (edits) to the specified backup node.<br>
 * 
 * The new BackupNode will start receiving edits the next time this
 * NameNode's logs roll.
 * 
 * @param bnReg the backup node registration information.
 * @param nnReg this (active) name-node registration.
 * @throws IOException
 */
synchronized void registerBackupNode(
    NamenodeRegistration bnReg, // backup node
    NamenodeRegistration nnReg) // active name-node
throws IOException {
  if(bnReg.isRole(NamenodeRole.CHECKPOINT))
    return; // checkpoint node does not stream edits
  
  JournalManager jas = findBackupJournal(bnReg);
  if (jas != null) {
    // already registered
    LOG.info("Backup node " + bnReg + " re-registers");
    return;
  }
  
  LOG.info("Registering new backup node: " + bnReg);
  BackupJournalManager bjm = new BackupJournalManager(bnReg, nnReg);
  synchronized(journalSetLock) {
    journalSet.add(bjm, false);
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:32,代码来源:FSEditLog.java


示例8: testConvertNamenodeRegistration

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
@Test
public void testConvertNamenodeRegistration() {
  StorageInfo info = getStorageInfo(NodeType.NAME_NODE);
  NamenodeRegistration reg = new NamenodeRegistration("address:999",
      "http:1000", info, NamenodeRole.NAMENODE);
  NamenodeRegistrationProto regProto = PBHelper.convert(reg);
  NamenodeRegistration reg2 = PBHelper.convert(regProto);
  assertEquals(reg.getAddress(), reg2.getAddress());
  assertEquals(reg.getClusterID(), reg2.getClusterID());
  assertEquals(reg.getCTime(), reg2.getCTime());
  assertEquals(reg.getHttpAddress(), reg2.getHttpAddress());
  assertEquals(reg.getLayoutVersion(), reg2.getLayoutVersion());
  assertEquals(reg.getNamespaceID(), reg2.getNamespaceID());
  assertEquals(reg.getRegistrationID(), reg2.getRegistrationID());
  assertEquals(reg.getRole(), reg2.getRole());
  assertEquals(reg.getVersion(), reg2.getVersion());

}
 
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestPBHelper.java


示例9: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
NamenodeCommand startCheckpoint(NamenodeRegistration backupNode,
    NamenodeRegistration activeNamenode) throws IOException {
  checkOperation(OperationCategory.CHECKPOINT);
  writeLock();
  try {
    checkOperation(OperationCategory.CHECKPOINT);
    checkNameNodeSafeMode("Checkpoint not started");
    
    LOG.info("Start checkpoint for " + backupNode.getAddress());
    NamenodeCommand cmd = getFSImage().startCheckpoint(backupNode,
        activeNamenode, getEffectiveLayoutVersion());
    getEditLog().logSync();
    return cmd;
  } finally {
    writeUnlock();
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:18,代码来源:FSNamesystem.java


示例10: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
NamenodeCommand startCheckpoint(NamenodeRegistration backupNode,
    NamenodeRegistration activeNamenode) throws IOException {
  checkOperation(OperationCategory.CHECKPOINT);
  CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion(retryCache,
      null);
  if (cacheEntry != null && cacheEntry.isSuccess()) {
    return (NamenodeCommand) cacheEntry.getPayload();
  }
  writeLock();
  NamenodeCommand cmd = null;
  try {
    checkOperation(OperationCategory.CHECKPOINT);
    checkNameNodeSafeMode("Checkpoint not started");
    
    LOG.info("Start checkpoint for " + backupNode.getAddress());
    cmd = getFSImage().startCheckpoint(backupNode, activeNamenode);
    getEditLog().logSync();
    return cmd;
  } finally {
    writeUnlock();
    RetryCache.setState(cacheEntry, cmd != null, cmd);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:24,代码来源:FSNamesystem.java


示例11: endCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
void endCheckpoint(NamenodeRegistration registration,
                          CheckpointSignature sig) throws IOException {
  checkOperation(OperationCategory.CHECKPOINT);
  CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
  if (cacheEntry != null && cacheEntry.isSuccess()) {
    return; // Return previous response
  }
  boolean success = false;
  readLock();
  try {
    checkOperation(OperationCategory.CHECKPOINT);

    checkNameNodeSafeMode("Checkpoint not ended");
    LOG.info("End checkpoint for " + registration.getAddress());
    getFSImage().endCheckpoint(sig);
    success = true;
  } finally {
    readUnlock();
    RetryCache.setState(cacheEntry, success);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:22,代码来源:FSNamesystem.java


示例12: startCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
NamenodeCommand startCheckpoint(NamenodeRegistration backupNode,
    NamenodeRegistration activeNamenode) throws IOException {
  checkOperation(OperationCategory.CHECKPOINT);
  CacheEntryWithPayload cacheEntry = RetryCache.waitForCompletion(retryCache,
      null);
  if (cacheEntry != null && cacheEntry.isSuccess()) {
    return (NamenodeCommand) cacheEntry.getPayload();
  }
  writeLock();
  NamenodeCommand cmd = null;
  try {
    checkOperation(OperationCategory.CHECKPOINT);

    if (isInSafeMode()) {
      throw new SafeModeException("Checkpoint not started", safeMode);
    }
    LOG.info("Start checkpoint for " + backupNode.getAddress());
    cmd = getFSImage().startCheckpoint(backupNode, activeNamenode);
    getEditLog().logSync();
    return cmd;
  } finally {
    writeUnlock();
    RetryCache.setState(cacheEntry, cmd != null, cmd);
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:26,代码来源:FSNamesystem.java


示例13: endCheckpoint

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
void endCheckpoint(NamenodeRegistration registration,
                          CheckpointSignature sig) throws IOException {
  CacheEntry cacheEntry = RetryCache.waitForCompletion(retryCache);
  if (cacheEntry != null && cacheEntry.isSuccess()) {
    return; // Return previous response
  }
  checkOperation(OperationCategory.CHECKPOINT);
  boolean success = false;
  readLock();
  try {
    checkOperation(OperationCategory.CHECKPOINT);

    if (isInSafeMode()) {
      throw new SafeModeException("Checkpoint not ended", safeMode);
    }
    LOG.info("End checkpoint for " + registration.getAddress());
    getFSImage().endCheckpoint(sig);
    success = true;
  } finally {
    readUnlock();
    RetryCache.setState(cacheEntry, success);
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:24,代码来源:FSNamesystem.java


示例14: releaseBackupNode

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
/**
 * Release (unregister) backup node.
 * <p>
 * Find and remove the backup stream corresponding to the node.
 * @param registration
 * @throws IOException
 */
void releaseBackupNode(NamenodeRegistration registration)
  throws IOException {
  checkOperation(OperationCategory.WRITE);
  writeLock();
  try {
    checkOperation(OperationCategory.WRITE);
    if(getFSImage().getStorage().getNamespaceID()
       != registration.getNamespaceID())
      throw new IOException("Incompatible namespaceIDs: "
          + " Namenode namespaceID = "
          + getFSImage().getStorage().getNamespaceID() + "; "
          + registration.getRole() +
          " node namespaceID = " + registration.getNamespaceID());
    getEditLog().releaseBackupStream(registration);
  } finally {
    writeUnlock();
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:26,代码来源:FSNamesystem.java


示例15: registerBackupNode

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
/**
 * Create (or find if already exists) an edit output stream, which
 * streams journal records (edits) to the specified backup node.<br>
 * 
 * The new BackupNode will start receiving edits the next time this
 * NameNode's logs roll.
 * 
 * @param bnReg the backup node registration information.
 * @param nnReg this (active) name-node registration.
 * @throws IOException
 */
synchronized void registerBackupNode(
    NamenodeRegistration bnReg, // backup node
    NamenodeRegistration nnReg) // active name-node
throws IOException {
  if(bnReg.isRole(NamenodeRole.CHECKPOINT))
    return; // checkpoint node does not stream edits
  
  JournalManager jas = findBackupJournal(bnReg);
  if (jas != null) {
    // already registered
    LOG.info("Backup node " + bnReg + " re-registers");
    return;
  }
  
  LOG.info("Registering new backup node: " + bnReg);
  BackupJournalManager bjm = new BackupJournalManager(bnReg, nnReg);
  journalSet.add(bjm, true);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:30,代码来源:FSEditLog.java


示例16: testConvertNamenodeRegistration

import org.apache.hadoop.hdfs.server.protocol.NamenodeRegistration; //导入依赖的package包/类
@Test
public void testConvertNamenodeRegistration() {
  StorageInfo info = getStorageInfo();
  NamenodeRegistration reg = new NamenodeRegistration("address:999",
      "http:1000", info, NamenodeRole.NAMENODE);
  NamenodeRegistrationProto regProto = PBHelper.convert(reg);
  NamenodeRegistration reg2 = PBHelper.convert(regProto);
  assertEquals(reg.getAddress(), reg2.getAddress());
  assertEquals(reg.getClusterID(), reg2.getClusterID());
  assertEquals(reg.getCTime(), reg2.getCTime());
  assertEquals(reg.getHttpAddress(), reg2.getHttpAddress());
  assertEquals(reg.getLayoutVersion(), reg2.getLayoutVersion());
  assertEquals(reg.getNamespaceID(), reg2.getNamespaceID());
  assertEquals(reg.getRegistrationID(), reg2.getRegistrationID());
  assertEquals(reg.getRole(), reg2.getRole());
  assertEquals(reg.getVersion(), reg2.getVersion());

}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:19,代码来源:TestPBHelper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MouseRotate类代码示例发布时间:2022-05-22
下一篇:
Java DavPropertyName类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap