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


Java JMXGet.init方法代码示例

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


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

示例1: testDataNode

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
/**
 * test JMX connection to DataNode..
 * @throws Exception 
 */
@Test
public void testDataNode() throws Exception {
  int numDatanodes = 2;
  cluster = new MiniDFSCluster.Builder(config).numDataNodes(numDatanodes).build();
  cluster.waitActive();

  writeFile(cluster.getFileSystem(), new Path("/test"), 2);

  JMXGet jmx = new JMXGet();
  String serviceName = "DataNode";
  jmx.setService(serviceName);
  jmx.init();
  assertEquals(fileSize, Integer.parseInt(jmx.getValue("BytesWritten")));

  cluster.shutdown();
  MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer();
  ObjectName query = new ObjectName("Hadoop:service=" + serviceName + ",*");
  Set<ObjectName> names = mbsc.queryNames(query, null);
  assertTrue("No beans should be registered for " + serviceName, names.isEmpty());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:TestJMXGet.java

示例2: testDataNode

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
/**
 * test JMX connection to DataNode..
 * @throws Exception 
 */
@Test
public void testDataNode() throws Exception {
  int numDatanodes = 2;
  cluster = new MiniDFSCluster.Builder(config).numDataNodes(numDatanodes).build();
  cluster.waitActive();

  DFSTestUtil.createFile(cluster.getFileSystem(), new Path("/test"),
      fileSize, fileSize, blockSize, (short) 2, seed);

  JMXGet jmx = new JMXGet();
  String serviceName = "DataNode";
  jmx.setService(serviceName);
  jmx.init();
  DFSTestUtil.waitForMetric(jmx, "BytesWritten", fileSize);
  assertEquals(fileSize, Integer.parseInt(jmx.getValue("BytesWritten")));

  cluster.shutdown();
  MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer();
  ObjectName query = new ObjectName("Hadoop:service=" + serviceName + ",*");
  Set<ObjectName> names = mbsc.queryNames(query, null);
  assertTrue("No beans should be registered for " + serviceName, names.isEmpty());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:27,代码来源:TestJMXGet.java

示例3: testNameNode

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
/**
 * test JMX connection to NameNode..
 * @throws Exception 
 */
public void testNameNode() throws Exception {
  int numDatanodes = 2;
  cluster = new MiniDFSCluster(0, config, numDatanodes, true, true, null, 
      null, null);
  cluster.waitActive();

  writeFile(cluster.getFileSystem(), new Path("/test1"), 2);

  JMXGet jmx = new JMXGet();
  jmx.init();


  //get some data from different sources
  int blocks_corrupted = NameNode.getNameNodeMetrics().
  numBlocksCorrupted.get();
  assertEquals(Integer.parseInt(
      jmx.getValue("NumLiveDataNodes")), 2);
  assertEquals(Integer.parseInt(
      jmx.getValue("BlocksCorrupted")), blocks_corrupted);
  assertEquals(Long.parseLong(
      jmx.getValue("NumOpenConnectionsAvgTime")), 0);

  cluster.shutdown();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:29,代码来源:TestJMXGet.java

示例4: testDataNode

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
/**
 * test JMX connection to DataNode..
 * @throws Exception 
 */
public void testDataNode() throws Exception {
  int numDatanodes = 2;
  cluster = new MiniDFSCluster(0, config, numDatanodes, true, true, null,
      null, null);
  cluster.waitActive();

  writeFile(cluster.getFileSystem(), new Path("/test"), 2);

  JMXGet jmx = new JMXGet();
  jmx.setService("DataNode");
  jmx.init();
  assertEquals(Integer.parseInt(jmx.getValue("bytes_written")), 0);

  cluster.shutdown();
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:20,代码来源:TestJMXGet.java

示例5: testNameNode

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
/**
 * test JMX connection to NameNode..
 * @throws Exception 
 */
@Test
public void testNameNode() throws Exception {
  int numDatanodes = 2;
  cluster = new MiniDFSCluster.Builder(config).numDataNodes(numDatanodes).build();
  cluster.waitActive();

  writeFile(cluster.getFileSystem(), new Path("/test1"), 2);

  JMXGet jmx = new JMXGet();
  //jmx.setService("*"); // list all hadoop services
  //jmx.init();
  //jmx = new JMXGet();
  jmx.init(); // default lists namenode mbeans only

  //get some data from different source
  assertEquals(numDatanodes, Integer.parseInt(
      jmx.getValue("NumLiveDataNodes")));
  assertGauge("CorruptBlocks", Long.parseLong(jmx.getValue("CorruptBlocks")),
              getMetrics("FSNamesystem"));
  assertEquals(numDatanodes, Integer.parseInt(
      jmx.getValue("NumOpenConnections")));

  cluster.shutdown();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:29,代码来源:TestJMXGet.java

示例6: testDataNode

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
/**
 * test JMX connection to DataNode..
 * @throws Exception 
 */
@Test
public void testDataNode() throws Exception {
  int numDatanodes = 2;
  cluster = new MiniDFSCluster.Builder(config).numDataNodes(numDatanodes).build();
  cluster.waitActive();

  writeFile(cluster.getFileSystem(), new Path("/test"), 2);

  JMXGet jmx = new JMXGet();
  //jmx.setService("*"); // list all hadoop services
  //jmx.init();
  //jmx = new JMXGet();
  jmx.setService("DataNode");
  jmx.init();
  assertEquals(fileSize, Integer.parseInt(jmx.getValue("BytesWritten")));

  cluster.shutdown();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:23,代码来源:TestJMXGet.java

示例7: testDataNode

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
/**
 * test JMX connection to DataNode..
 *
 * @throws Exception
 */
@Test
public void testDataNode() throws Exception {
  int numDatanodes = 2;
  cluster =
      new MiniDFSCluster.Builder(config).numDataNodes(numDatanodes).build();
  cluster.waitActive();

  writeFile(cluster.getFileSystem(), new Path("/test"), 2);

  JMXGet jmx = new JMXGet();
  //jmx.setService("*"); // list all hadoop services
  //jmx.init();
  //jmx = new JMXGet();
  jmx.setService("DataNode");
  jmx.init();
  Thread.sleep(15000);
  assertEquals(fileSize, Integer.parseInt(jmx.getValue("BytesWritten")));

  cluster.shutdown();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:26,代码来源:TestJMXGet.java

示例8: testNameNode

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
/**
 * test JMX connection to NameNode..
 * @throws Exception 
 */
public void testNameNode() throws Exception {
  int numDatanodes = 2;
  cluster = new MiniDFSCluster.Builder(config).numDataNodes(numDatanodes).build();
  cluster.waitActive();

  writeFile(cluster.getFileSystem(), new Path("/test1"), 2);

  JMXGet jmx = new JMXGet();
  jmx.init();


  //get some data from different sources
  int blocks_corrupted = NameNode.getNameNodeMetrics().
  numBlocksCorrupted.get();
  assertEquals(Integer.parseInt(
      jmx.getValue("NumLiveDataNodes")), 2);
  assertEquals(Integer.parseInt(
      jmx.getValue("BlocksCorrupted")), blocks_corrupted);
  assertEquals(Integer.parseInt(
      jmx.getValue("NumOpenConnections")), 0);

  cluster.shutdown();
}
 
开发者ID:cumulusyebl,项目名称:cumulus,代码行数:28,代码来源:TestJMXGet.java

示例9: testNameNode

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
/**
 * test JMX connection to NameNode..
 * @throws Exception 
 */
public void testNameNode() throws Exception {
  int numDatanodes = 2;
  cluster = new MiniDFSCluster(0, config, numDatanodes, true, true, null, 
      null, null);
  cluster.waitActive();

  writeFile(cluster.getFileSystem(), new Path("/test1"), 2);

  JMXGet jmx = new JMXGet();
  jmx.init();


  //get some data from different sources
  int blocks_corrupted = NameNode.getNameNodeMetrics().
  numBlocksCorrupted.get();
  assertEquals(Integer.parseInt(
      jmx.getValue("NumLiveDataNodes")), 2);
  assertEquals(Integer.parseInt(
      jmx.getValue("BlocksCorrupted")), blocks_corrupted);
  assertEquals(Integer.parseInt(
      jmx.getValue("NumOpenConnections")), 0);

  cluster.shutdown();
}
 
开发者ID:iVCE,项目名称:RDFS,代码行数:29,代码来源:TestJMXGet.java

示例10: testNameNode

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
/**
 * test JMX connection to NameNode..
 * @throws Exception 
 */
@Test
public void testNameNode() throws Exception {
  int numDatanodes = 2;
  cluster = new MiniDFSCluster.Builder(config).numDataNodes(numDatanodes).build();
  cluster.waitActive();

  writeFile(cluster.getFileSystem(), new Path("/test1"), 2);

  JMXGet jmx = new JMXGet();
  String serviceName = "NameNode";
  jmx.setService(serviceName);
  jmx.init(); // default lists namenode mbeans only
  assertTrue("error printAllValues", checkPrintAllValues(jmx));

  //get some data from different source
  assertEquals(numDatanodes, Integer.parseInt(
      jmx.getValue("NumLiveDataNodes")));
  assertGauge("CorruptBlocks", Long.parseLong(jmx.getValue("CorruptBlocks")),
              getMetrics("FSNamesystem"));
  assertEquals(numDatanodes, Integer.parseInt(
      jmx.getValue("NumOpenConnections")));

  cluster.shutdown();
  MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer();
  ObjectName query = new ObjectName("Hadoop:service=" + serviceName + ",*");
  Set<ObjectName> names = mbsc.queryNames(query, null);
  assertTrue("No beans should be registered for " + serviceName, names.isEmpty());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:33,代码来源:TestJMXGet.java

示例11: testNameNode

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
/**
 * test JMX connection to NameNode..
 * @throws Exception 
 */
@Test
public void testNameNode() throws Exception {
  int numDatanodes = 2;
  cluster = new MiniDFSCluster.Builder(config).numDataNodes(numDatanodes).build();
  cluster.waitActive();

  DFSTestUtil.createFile(cluster.getFileSystem(), new Path("/test1"),
      fileSize, fileSize, blockSize, (short) 2, seed);

  JMXGet jmx = new JMXGet();
  String serviceName = "NameNode";
  jmx.setService(serviceName);
  jmx.init(); // default lists namenode mbeans only
  assertTrue("error printAllValues", checkPrintAllValues(jmx));

  //get some data from different source
  DFSTestUtil.waitForMetric(jmx, "NumLiveDataNodes", numDatanodes);
  assertEquals(numDatanodes, Integer.parseInt(
      jmx.getValue("NumLiveDataNodes")));
  assertGauge("CorruptBlocks", Long.parseLong(jmx.getValue("CorruptBlocks")),
              getMetrics("FSNamesystem"));
  DFSTestUtil.waitForMetric(jmx, "NumOpenConnections", numDatanodes);
  assertEquals(numDatanodes, Integer.parseInt(
      jmx.getValue("NumOpenConnections")));

  cluster.shutdown();
  MBeanServerConnection mbsc = ManagementFactory.getPlatformMBeanServer();
  ObjectName query = new ObjectName("Hadoop:service=" + serviceName + ",*");
  Set<ObjectName> names = mbsc.queryNames(query, null);
  assertTrue("No beans should be registered for " + serviceName, names.isEmpty());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:36,代码来源:TestJMXGet.java

示例12: testNameNode

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
/**
   * test JMX connection to NameNode..
   *
   * @throws Exception
   */
  @Test
  public void testNameNode() throws Exception {
    int numDatanodes = 2;
    cluster =
        new MiniDFSCluster.Builder(config).numDataNodes(numDatanodes).build();
    cluster.waitActive();

    writeFile(cluster.getFileSystem(), new Path("/test1"), 2);

    JMXGet jmx = new JMXGet();
    //jmx.setService("*"); // list all hadoop services
    //jmx.init();
    //jmx = new JMXGet();
    jmx.init(); // default lists namenode mbeans only
    Thread.sleep(25000);

    //get some data from different source
    assertEquals(numDatanodes,
        Integer.parseInt(jmx.getValue("NumLiveDataNodes")));
    assertGauge("CorruptBlocks", Long.parseLong(jmx.getValue("CorruptBlocks")),
        getMetrics("FSNamesystem"));

//    https://issues.apache.org/jira/browse/HDFS-10270
//    assertEquals(numDatanodes,
//        Integer.parseInt(jmx.getValue("NumOpenConnections")));

    cluster.shutdown();
  }
 
开发者ID:hopshadoop,项目名称:hops,代码行数:34,代码来源:TestJMXGet.java

示例13: testDataNode

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
/**
 * test JMX connection to DataNode..
 * @throws Exception 
 */
public void testDataNode() throws Exception {
  int numDatanodes = 2;
  cluster = new MiniDFSCluster.Builder(config).numDataNodes(numDatanodes).build();
  cluster.waitActive();

  writeFile(cluster.getFileSystem(), new Path("/test"), 2);

  JMXGet jmx = new JMXGet();
  jmx.setService("DataNode");
  jmx.init();
  assertEquals(Integer.parseInt(jmx.getValue("bytes_written")), 0);

  cluster.shutdown();
}
 
开发者ID:cumulusyebl,项目名称:cumulus,代码行数:19,代码来源:TestJMXGet.java

示例14: initJMX

import org.apache.hadoop.hdfs.tools.JMXGet; //导入方法依赖的package包/类
private JMXGet initJMX() throws Exception {
  JMXGet jmx = new JMXGet();
  jmx.setService(JMX_SERVICE_NAME);
  jmx.init();
  return jmx;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:LazyPersistTestCase.java


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