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


Java DFSck类代码示例

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


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

示例1: runFsck

import org.apache.hadoop.hdfs.tools.DFSck; //导入依赖的package包/类
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode)
    Assert.assertEquals(expectedErrCode, errCode);
  return bStream.toString();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:TestClientReportBadBlock.java

示例2: runFsck

import org.apache.hadoop.hdfs.tools.DFSck; //导入依赖的package包/类
static void runFsck(Configuration conf) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{"/", "-files"});
  String result = bStream.toString();
  System.out.println("output from fsck:\n" + result);
  assertEquals(0, errCode);
  assertTrue(result.contains("/test1"));
  assertTrue(result.contains("/test2"));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:TestHAFsck.java

示例3: runFsck

import org.apache.hadoop.hdfs.tools.DFSck; //导入依赖的package包/类
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path)
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  FSImage.LOG.error("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:TestFsck.java

示例4: testFsckOnEncryptionZones

import org.apache.hadoop.hdfs.tools.DFSck; //导入依赖的package包/类
/**
 * Test running fsck on a system with encryption zones.
 */
@Test(timeout = 60000)
public void testFsckOnEncryptionZones() throws Exception {
  final int len = 8196;
  final Path zoneParent = new Path("/zones");
  final Path zone1 = new Path(zoneParent, "zone1");
  final Path zone1File = new Path(zone1, "file");
  fsWrapper.mkdir(zone1, FsPermission.getDirDefault(), true);
  dfsAdmin.createEncryptionZone(zone1, TEST_KEY);
  DFSTestUtil.createFile(fs, zone1File, len, (short) 1, 0xFEED);
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{ "/" });
  assertEquals("Fsck ran with non-zero error code", 0, errCode);
  String result = bStream.toString();
  assertTrue("Fsck did not return HEALTHY status",
      result.contains(NamenodeFsck.HEALTHY_STATUS));

  // Run fsck directly on the encryption zone instead of root
  errCode = ToolRunner.run(new DFSck(conf, out),
      new String[]{ zoneParent.toString() });
  assertEquals("Fsck ran with non-zero error code", 0, errCode);
  result = bStream.toString();
  assertTrue("Fsck did not return HEALTHY status",
      result.contains(NamenodeFsck.HEALTHY_STATUS));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:30,代码来源:TestEncryptionZones.java

示例5: runFsck

import org.apache.hadoop.hdfs.tools.DFSck; //导入依赖的package包/类
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path)
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  GenericTestUtils.setLogLevel(FSPermissionChecker.LOG, Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  GenericTestUtils.setLogLevel(FSPermissionChecker.LOG, Level.INFO);
  FSImage.LOG.error("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:15,代码来源:TestFsck.java

示例6: runFsck

import org.apache.hadoop.hdfs.tools.DFSck; //导入依赖的package包/类
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path) 
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  FSImage.LOG.error("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:15,代码来源:TestFsck.java

示例7: run

import org.apache.hadoop.hdfs.tools.DFSck; //导入依赖的package包/类
public void run() {
  try {
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    PrintStream ps = new PrintStream(os);
    new DFSck(conf, ps).run(new String[] { "/" });
  } catch (Exception e) {
  }
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:9,代码来源:TestHttpServerShutdown.java

示例8: runFsck

import org.apache.hadoop.hdfs.tools.DFSck; //导入依赖的package包/类
static String runFsck(Configuration conf, int expectedErrCode,
                      boolean checkErrorCode, String... path)
  throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger) FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger) FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  return bStream.toString();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:14,代码来源:TestFsck.java

示例9: getLostFileReader

import org.apache.hadoop.hdfs.tools.DFSck; //导入依赖的package包/类
private BufferedReader getLostFileReader(String[] dfsckArgs) 
    throws IOException {

  ByteArrayOutputStream bout = new ByteArrayOutputStream();
  PrintStream ps = new PrintStream(bout, true);
  DFSck dfsck = new DFSck(getConf(), ps);
  try {
    dfsck.run(dfsckArgs);
  } catch (Exception e) {
    throw new IOException(e);
  }
  ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
  return new BufferedReader(new InputStreamReader(bin));
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:15,代码来源:DistBlockIntegrityMonitor.java

示例10: runFsck

import org.apache.hadoop.hdfs.tools.DFSck; //导入依赖的package包/类
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    Assert.assertEquals(expectedErrCode, errCode);
  }
  return bStream.toString();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:11,代码来源:TestClientReportBadBlock.java

示例11: runFsck

import org.apache.hadoop.hdfs.tools.DFSck; //导入依赖的package包/类
static String runFsck(Configuration conf, int expectedErrCode,
    boolean checkErrorCode, String... path) throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger) FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode) {
    assertEquals(expectedErrCode, errCode);
  }
  ((Log4JLogger) FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  System.out.println("OUTPUT = " + bStream.toString());
  return bStream.toString();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:14,代码来源:TestFsck.java

示例12: runFsck

import org.apache.hadoop.hdfs.tools.DFSck; //导入依赖的package包/类
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path) 
                      throws Exception {
  PrintStream oldOut = System.out;
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream newOut = new PrintStream(bStream, true);
  System.setOut(newOut);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf), path);
  if (checkErrorCode)
    assertEquals(expectedErrCode, errCode);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  System.setOut(oldOut);
  return bStream.toString();
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre,代码行数:16,代码来源:TestFsck.java

示例13: runFsck

import org.apache.hadoop.hdfs.tools.DFSck; //导入依赖的package包/类
static String runFsck(Configuration conf, int expectedErrCode, 
                      boolean checkErrorCode,String... path) 
                      throws Exception {
  ByteArrayOutputStream bStream = new ByteArrayOutputStream();
  PrintStream out = new PrintStream(bStream, true);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.ALL);
  int errCode = ToolRunner.run(new DFSck(conf, out), path);
  if (checkErrorCode)
    assertEquals(expectedErrCode, errCode);
  ((Log4JLogger)FSPermissionChecker.LOG).getLogger().setLevel(Level.INFO);
  return bStream.toString();
}
 
开发者ID:cumulusyebl,项目名称:cumulus,代码行数:13,代码来源:TestFsck.java


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