本文整理汇总了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());
}
示例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());
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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());
}
示例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());
}
示例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();
}
示例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();
}
示例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;
}