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

Java HBaseFileSystem类代码示例

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

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



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

示例1: createInitialFileSystemLayout

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
/**
 * Create initial layout in filesystem.
 * <ol>
 * <li>Check if the root region exists and is readable, if not create it.
 * Create hbase.version and the -ROOT- directory if not one.
 * </li>
 * <li>Create a log archive directory for RS to put archived logs</li>
 * </ol>
 * Idempotent.
 */
private Path createInitialFileSystemLayout() throws IOException {
  // check if the root directory exists
  checkRootDir(this.rootdir, conf, this.fs);

  // check if temp directory exists and clean it
  checkTempDir(this.tempdir, conf, this.fs);

  Path oldLogDir = new Path(this.rootdir, HConstants.HREGION_OLDLOGDIR_NAME);

  // Make sure the region servers can archive their old logs
  if(!this.fs.exists(oldLogDir)) {
    HBaseFileSystem.makeDirOnFileSystem(fs, oldLogDir);
  }

  return oldLogDir;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:27,代码来源:MasterFileSystem.java


示例2: getLogDirs

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
private List<Path> getLogDirs(final List<ServerName> serverNames) throws IOException {
  List<Path> logDirs = new ArrayList<Path>();
  for(ServerName serverName: serverNames){
    Path logDir = new Path(this.rootdir,
      HLog.getHLogDirectoryName(serverName.toString()));
    Path splitDir = logDir.suffix(HLog.SPLITTING_EXT);
    // rename the directory so a rogue RS doesn't create more HLogs
    if (fs.exists(logDir)) {
      if (!HBaseFileSystem.renameDirForFileSystem(fs, logDir, splitDir)) {
        throw new IOException("Failed fs.rename for log split: " + logDir);
      }
      logDir = splitDir;
      LOG.debug("Renamed region directory: " + splitDir);
    } else if (!fs.exists(splitDir)) {
      LOG.info("Log dir for server " + serverName + " does not exist");
      continue;
    }
    logDirs.add(splitDir);
  }
  return logDirs;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:22,代码来源:MasterFileSystem.java


示例3: checkTempDir

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
/**
 * Make sure the hbase temp directory exists and is empty.
 * NOTE that this method is only executed once just after the master becomes the active one.
 */
private void checkTempDir(final Path tmpdir, final Configuration c, final FileSystem fs)
    throws IOException {
  // If the temp directory exists, clear the content (left over, from the previous run)
  if (fs.exists(tmpdir)) {
    // Archive table in temp, maybe left over from failed deletion,
    // if not the cleaner will take care of them.
    for (Path tabledir: FSUtils.getTableDirs(fs, tmpdir)) {
      for (Path regiondir: FSUtils.getRegionDirs(fs, tabledir)) {
        HFileArchiver.archiveRegion(fs, this.rootdir, tabledir, regiondir);
      }
    }
    if (!HBaseFileSystem.deleteDirFromFileSystem(fs, tmpdir)) {
      throw new IOException("Unable to clean the temp directory: " + tmpdir);
    }
  }

  // Create the temp directory
  if (!HBaseFileSystem.makeDirOnFileSystem(fs, tmpdir)) {
    throw new IOException("HBase temp directory '" + tmpdir + "' creation failure.");
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:26,代码来源:MasterFileSystem.java


示例4: deleteFamilyFromFS

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
public void deleteFamilyFromFS(HRegionInfo region, byte[] familyName)
    throws IOException {
  // archive family store files
  Path tableDir = new Path(rootdir, region.getTableNameAsString());
  HFileArchiver.archiveFamily(fs, conf, region, tableDir, familyName);

  // delete the family folder
  Path familyDir = new Path(tableDir,
    new Path(region.getEncodedName(), Bytes.toString(familyName)));
  if (!HBaseFileSystem.deleteDirFromFileSystem(fs, familyDir)) {
    throw new IOException("Could not delete family "
        + Bytes.toString(familyName) + " from FileSystem for region "
        + region.getRegionNameAsString() + "(" + region.getEncodedName()
        + ")");
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:MasterFileSystem.java


示例5: archiveStoreFile

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
/**
 * Archive the store file
 * @param fs the filesystem where the store files live
 * @param regionInfo region hosting the store files
 * @param conf {@link Configuration} to examine to determine the archive directory
 * @param tableDir {@link Path} to where the table is being stored (for building the archive path)
 * @param family the family hosting the store files
 * @param storeFile file to be archived
 * @throws IOException if the files could not be correctly disposed.
 */
public static void archiveStoreFile(FileSystem fs, HRegionInfo regionInfo, Configuration conf,
    Path tableDir, byte[] family, Path storeFile) throws IOException {
  Path storeArchiveDir = HFileArchiveUtil.getStoreArchivePath(conf, regionInfo, tableDir, family);
  // make sure we don't archive if we can't and that the archive dir exists
  if (!HBaseFileSystem.makeDirOnFileSystem(fs, storeArchiveDir)) {
    throw new IOException("Could not make archive directory (" + storeArchiveDir + ") for store:"
        + Bytes.toString(family) + ", deleting compacted files instead.");
  }

  // do the actual archive
  long start = EnvironmentEdgeManager.currentTimeMillis();
  File file = new FileablePath(fs, storeFile);
  if (!resolveAndArchiveFile(storeArchiveDir, file, Long.toString(start))) {
    throw new IOException("Failed to archive/delete the file for region:"
        + regionInfo.getRegionNameAsString() + ", family:" + Bytes.toString(family) + " into "
        + storeArchiveDir + ". Something is probably awry on the filesystem.");
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:29,代码来源:HFileArchiver.java


示例6: finishSplitLogFile

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
public static void finishSplitLogFile(Path rootdir, Path oldLogDir,
    String logfile, Configuration conf) throws IOException {
  List<Path> processedLogs = new ArrayList<Path>();
  List<Path> corruptedLogs = new ArrayList<Path>();
  FileSystem fs;
  fs = rootdir.getFileSystem(conf);
  Path logPath = new Path(logfile);
  if (ZKSplitLog.isCorrupted(rootdir, logPath.getName(), fs)) {
    corruptedLogs.add(logPath);
  } else {
    processedLogs.add(logPath);
  }
  archiveLogs(null, corruptedLogs, processedLogs, oldLogDir, fs, conf);
  Path stagingDir = ZKSplitLog.getSplitLogDir(rootdir, logPath.getName());
  HBaseFileSystem.deleteDirFromFileSystem(fs, stagingDir);
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:HLogSplitter.java


示例7: createWAP

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
private WriterAndPath createWAP(byte[] region, Entry entry, Path rootdir,
    FileSystem fs, Configuration conf)
throws IOException {
  Path regionedits = getRegionSplitEditsPath(fs, entry, rootdir, true);
  if (regionedits == null) {
    return null;
  }
  if (fs.exists(regionedits)) {
    LOG.warn("Found existing old edits file. It could be the "
        + "result of a previous failed split attempt. Deleting "
        + regionedits + ", length="
        + fs.getFileStatus(regionedits).getLen());
    if (!HBaseFileSystem.deleteFileFromFileSystem(fs, regionedits)) {
      LOG.warn("Failed delete of old " + regionedits);
    }
  }
  Writer w = createWriter(fs, regionedits, conf);
  LOG.debug("Creating writer path=" + regionedits + " region="
      + Bytes.toStringBinary(region));
  return (new WriterAndPath(regionedits, w));
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:22,代码来源:HLogSplitter.java


示例8: restoreLCCHFiles

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
public static synchronized void restoreLCCHFiles() throws IOException {
  List<Path> listPath =
      listLCCPath(LCCIndexConstant.INDEX_DIR_NAME_DEBUG, LCCIndexConstant.INDEX_DIR_NAME);
  Path lccPath;
  for (Path p : listPath) {
    // p: /hbase/lcc/**/f/.debuglcc/name
    lccPath = new Path(p.getParent().getParent(), LCCIndexConstant.INDEX_DIR_NAME);
    if (!hdfs.exists(lccPath)) {
      hdfs.mkdirs(lccPath);
    }
    if (hdfs.exists(p)) {
      Path newPath = new Path(lccPath, p.getName());
      if (!HBaseFileSystem.renameDirForFileSystem(hdfs, p, newPath)) {
        System.out.println("winter in LCCIndexDebugger, restore file error: " + p);
      }
    } else {
      System.out.println("winter in LCCIndexDebugger, lcc debug hfile should exists but not: "
          + p);
    }
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:22,代码来源:LCCIndexDebuggerGiveUP.java


示例9: archiveStoreFile

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
/**
 * Archive the store file
 * @param fs the filesystem where the store files live
 * @param regionInfo region hosting the store files
 * @param conf {@link Configuration} to examine to determine the archive directory
 * @param tableDir {@link Path} to where the table is being stored (for building the archive path)
 * @param family the family hosting the store files
 * @param storeFile file to be archived
 * @throws IOException if the files could not be correctly disposed.
 */
public static void archiveStoreFile(FileSystem fs, HRegionInfo regionInfo,
    Configuration conf, Path tableDir, byte[] family, Path storeFile) throws IOException {
  Path storeArchiveDir = HFileArchiveUtil.getStoreArchivePath(conf, regionInfo, tableDir, family);
  // make sure we don't archive if we can't and that the archive dir exists
  if (!HBaseFileSystem.makeDirOnFileSystem(fs, storeArchiveDir)) {
    throw new IOException("Could not make archive directory (" + storeArchiveDir + ") for store:"
        + Bytes.toString(family) + ", deleting compacted files instead.");
  }

  // do the actual archive
  long start = EnvironmentEdgeManager.currentTimeMillis();
  File file = new FileablePath(fs, storeFile);
  if (!resolveAndArchiveFile(storeArchiveDir, file, Long.toString(start))) {
    throw new IOException("Failed to archive/delete the file for region:"
        + regionInfo.getRegionNameAsString() + ", family:" + Bytes.toString(family)
        + " into " + storeArchiveDir + ". Something is probably awry on the filesystem.");
  }
}
 
开发者ID:wanhao,项目名称:IRIndex,代码行数:29,代码来源:HFileArchiver.java


示例10: markCorrupted

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
public static void markCorrupted(Path rootdir, String logFileName,
    FileSystem fs) {
  Path file = new Path(getSplitLogDir(rootdir, logFileName), "corrupt");
  try {
    HBaseFileSystem.createNewFileOnFileSystem(fs, file);
  } catch (IOException e) {
    LOG.warn("Could not flag a log file as corrupted. Failed to create " +
        file, e);
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:11,代码来源:ZKSplitLog.java


示例11: moveToTemp

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
/**
 * Move the specified file/directory to the hbase temp directory.
 * @param path The path of the file/directory to move
 * @return The temp location of the file/directory moved
 * @throws IOException in case of file-system failure
 */
public Path moveToTemp(final Path path) throws IOException {
  Path tempPath = new Path(this.tempdir, path.getName());

  // Ensure temp exists
  if (!fs.exists(tempdir) && !HBaseFileSystem.makeDirOnFileSystem(fs, tempdir)) {
    throw new IOException("HBase temp directory '" + tempdir + "' creation failure.");
  }

  if (!HBaseFileSystem.renameDirForFileSystem(fs, path, tempPath)) {
    throw new IOException("Unable to move '" + path + "' to temp '" + tempPath + "'");
  }

  return tempPath;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:21,代码来源:MasterFileSystem.java


示例12: deleteRegionWithoutArchiving

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
/**
 * Without regard for backup, delete a region. Should be used with caution.
 * @param regionDir {@link Path} to the region to be deleted.
 * @param fs FileSystem from which to delete the region
 * @return <tt>true</tt> on successful deletion, <tt>false</tt> otherwise
 * @throws IOException on filesystem operation failure
 */
private static boolean deleteRegionWithoutArchiving(FileSystem fs, Path regionDir)
    throws IOException {
  if (HBaseFileSystem.deleteDirFromFileSystem(fs, regionDir)) {
    LOG.debug("Deleted all region files in: " + regionDir);
    return true;
  }
  LOG.debug("Failed to delete region directory:" + regionDir);
  return false;
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:17,代码来源:HFileArchiver.java


示例13: delete

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
@Override
public void delete() throws IOException {
  if (!compactedIndexFiles.isEmpty()) {
    for (Path indexfile : compactedIndexFiles) {
      if (!HBaseFileSystem.deleteFileFromFileSystem(fs, indexfile)) throw new IOException(
          "Failed to delete:" + indexfile);
    }
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:10,代码来源:HFileArchiver.java


示例14: remove

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
@Override
public HTableDescriptor remove(final String tablename)
throws IOException {
  if (!this.fsreadonly) {
    Path tabledir = FSUtils.getTablePath(this.rootdir, tablename);
    if (this.fs.exists(tabledir)) {
      if (!HBaseFileSystem.deleteDirFromFileSystem(fs, tabledir)) {
        throw new IOException("Failed delete of " + tabledir.toString());
      }
    }
  }
  TableDescriptorModtime tdm = this.cache.remove(tablename);
  return tdm == null ? null : tdm.getTableDescriptor();
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:15,代码来源:FSTableDescriptors.java


示例15: writeHTD

import org.apache.hadoop.hbase.HBaseFileSystem; //导入依赖的package包/类
private static void writeHTD(final FileSystem fs, final Path p,
    final HTableDescriptor htd)
throws IOException {
  FSDataOutputStream out = HBaseFileSystem.createPathOnFileSystem(fs, p, false);
  try {
    htd.write(out);
    out.write('\n');
    out.write('\n');
    out.write(Bytes.toBytes(htd.toString()));
  } finally {
    out.close();
  }
}
 
开发者ID:fengchen8086,项目名称:LCIndex-HBase-0.94.16,代码行数:14,代码来源:FSTableDescriptors.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java CapeManager类代码示例发布时间:2022-05-22
下一篇:
Java GraphFactory类代码示例发布时间: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