文章分为四个部分讲述怎样使用spark官方评测工具评测spark 2.0 tpc ds支持状况html
刀片机:1台 126G内存 64核心 centos 7.2c++
virtualbox安装四台虚拟机(centos 7.2,16G内存,4核):master,worker1,worker2,worker3(centos下)git
spark版本:2.0github
hadoop版本:2.6sql
安装请参考:hadoop安装或者Spark On Yarn安装shell
安装后的截图apache
davies/tpcds-kit是用来生成测试数据的工具centos
git clone https://github.com/davies/tpcds-kit.git工具
任选一台机器(这里咱们选择master)安装如下编译工具(默认软件里没有编译工具)oop
yum install gcc gcc-c++ bison flex cmake ncurses-devel cd tpcds-kit/tools cp Makefile.suite Makefile #复制Makefile.suite为Makefile make #运行make命令
接下来,拷贝tpcds-kit到全部机器的相同目录下(重要)
scp -r /目录/tpcds-kit root@worker1:/目录/tpcds-kit #执行三次该命令复制到worker1,worker2,worker3
git clone https://github.com/databricks/spark-sql-perf.git
使用sbt package打包的jar在使用时会出现依赖找不到状况,咱们使用Intellij Idea导入该工程
修改sbt.build,更改scala版本为2.11.8
打包成jar包
设置Project Structure
设置Artifacts
Build
jar包不须要每一个节点都有
SPARK_DRIVER_MEMORY=8G #依具体状况而定
cd spark-2.0.0-bin-hadoop2.6 ./bin/spark-shell --jars /jar包目录/spark-sql-perf.jar --num-executors 20 --executor-cores 2 --executor-memory 8G --master spark://master:7077
// 建立sqlContext val sqlContext=new org.apache.spark.sql.SQLContext(sc) import sqlContext.implicits._ // 生成数据 参数1:sqlContext 参数2:tpcds-kit目录 参数3:生成的数据量(GB) val tables=new Tables(sqlCotext,"/目录/tpcds-kit/tools",1) tables.genData("hdfs://master:8020:tpctest","parquet",true,false,false,false,false); // 建立表结构(外部表或者临时表) // talbles.createExternalTables("hdfs://master:8020:tpctest","parquet","mytest",false) talbles.createTemporaryTables("hdfs://master:8020:tpctest","parquet") import com.databricks.spark.sql.perf.tpcds.TPCDS val tpcds=new TPCDS(sqlContext=sqlContext) //运行测试 val experiment=tpcds.runExperiment(tpcds.tpcds1_4Queries)
在spark-shell中咱们能够调用 _experiment.html_查看执行状态
HDFS上生成的数据截图
运行截图
运行结果保存在spark/performance目录下
HDFS上的评测结果截图