zhangli-s 发表于 2016-12-5 09:34:04

运行Hadoop测试代码

  $ cd $HADOOP_HOME
  $ ant jar-test
  $ bin/hadoop jar build/hadoop-0.19.1-dc-test.jar
  //从列表中选择想运行的程序TEST_PROGRAM
  $ bin/hadoop jar build/hadoop-0.19.1-dc-test.jar TEST_PROGRAM
  若报错:
  Caused by: java.lang.ClassNotFoundException: org.apache.jasper.runtime.JspSourceDependent
  这种类找不到的错误,就是classpath没设好,没有把需要的class包含进来。
  解决:
  先查找缺失的类在哪个包,上面的类在lib/jsp-2.1/jsp-2.1.jar,所以要把jsp-2.1.jar放到lib下,或者改classpath。
  对于测试框架中的NNThroughputBenchmark类,源码中没有把它编译进*-test.jar,查看build.xml后知道在AllTestDriver.java里面加上:
  pgd.addClass("nnthroughput", NNThroughputBenchmark.class, "measure namenode throughput");
  重新编译test包运行。
  自己添加的新测试类,如果想用单机测试Namenode性能,需要在NameNode.createNameNode(argv, conf)前修改conf:
  //disable modification of access time for open/list/...
    conf.setInt("dfs.access.time.precision", 0);
  FileSystem.setDefaultUri(conf, "hdfs://localhost:" + 0);
    conf.set("dfs.http.address", "0.0.0.0:0");
    NameNode.format(conf);
  运行单元测试:ant test-core -Dtestcase=org.apache.hadoop.hdfs.TestNNThroughputBenchmark
页: [1]
查看完整版本: 运行Hadoop测试代码