前言
文章目录
一、测试环境介绍
二、BenchmarkSQL-5.0安装部署
三、测试数据的准备及执行
四、部署相关报错处理
一、测试部署环境介绍
本次部署BenchmarkSQL 5.0使用的是CentOS 7.2,另外需要依赖java环境,我这里使用的是jdk-1.8.0。具体如下:
1.操作系统版本
[root@Aken-DB ~]# cat etc/redhat-releaseCentOS Linux release 7.2 (Final)
2.PostgreSQL和BenchmarSQL版本
benchmarksql 5.0PostgreSQL 11.5
[tbase@Aken-DB ~]$ java -versionjava version "1.8.0_241"Java(TM) SE Runtime Environment (build 1.8.0_241-b07)Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)e
二、BenchmarkSQL安装部署
1.部署Java环境
1)jdk下载地址:
https://www.oracle.com/java/technologies/javase-jdk8-downloads.html
2)上传jdk到服务器并解压:
mkdir -p usr/javatar -zxvf jdk-8u241-linux-x64.tar.gz -C /data/aken
2.安装ant工具。
yum -y install ant没有yum源的话也可到https://ant.apache.org/bindownload.cgi自行下载apache-ant-1.9.14-bin.zip
3. 编辑jdk和ant环境变量,vi .bash_profile编辑内容如下:
export PATH=$PATH:$HOME/.ftexport JAVA_HOME=/data/aken/jdk1.8.0_241export ANT_HOME=/data/aken/tpcc/apache-ant-1.9.14export JDK_PATH=${JAVA_HOME}/bin:${JAVA_HOME}/jre/binexport JDK_CLASSPATH=${JAVA_HOME}/lib:${JAVA_HOME}/jre/libexport PATH=${JDK_PATH}:${ANT_HOME}/bin:${PATH}
4. 下载benchmarksql 5.0 源码包,解压编译。
1)下载地址
https://sourceforge.net/projects/benchmarksql/
2)上传解压
su - tbase --我这里使用的是tbase用户,切换到对应的测试用户即可cd /data/aken/tpcctar -zxvf benchmarksql-5.0.tarcd benchmarksql-5.0
3) 编译
source ~/.bash_profileant
此时编译后的benchmarkSQL默认支持PostgresqlSQL:
[tbase@Aken-DB ~/tpcc]$ cat benchmarksql-5.0/src/client/jTPCC.java | grep postgreselse if (iDB.equals("postgres"))[tbase@Aken-DB ~/tpcc]$
三、测试数据准备及执行
vi data/aken/tpcc/benchmarksql-5.0/run/props.pg_cn01内容如下:
[tbase@Aken-DB ~/tpcc/benchmarksql-5.0/run]$ cat props.pg_cn01db=postgresdriver=org.postgresql.Driverconn=jdbc:postgresql://192.168.10.16:3452/benchmarksql <<<填写需要测试的目标环境 ip、port和database nameuser=tbase <<< DB用户名password=**** <<< DB用户密码warehouses=200#warehouses=1000loadWorkers=60terminals=50//To run specified transactions per terminal- runMins must equal zerorunTxnsPerTerminal=0runMins=30//Number of total transactions per minutelimitTxnsPerMin=0//Set to true to run in 4.x compatible mode. Set to false to use the//entire configured database evenly.terminalWarehouseFixed=true//To run for specified mitbaseult percentages of 45, 43, 4, 4 & 4 match the TPC-C specnewOrderWeight=45paymentWeight=43orderStatusWeight=4deliveryWeight=4stockLevelWeight=4// Directory name to create for collecting detailed result data.// Comment this out to suppress.//resultDirectory=my_result_%tY-%tm-%td_%tH%tM%tS//osCollectorScript=./misc/os_collector_linux.py//osCollectorInterval=1//osCollectorSSHAddr=ssh_user@target_dbhost//osCollectorDevices=net_eth0 blk_sda[tbaest@Aken-DB data/aken/tpcc/benchmarksql-5.0/run]#
2.修改表结构和索引
[tbase@Aken-DB /data/aken/tpcc/benchmarksql-5.0/run/sql.common]# ls -rlt-rw-r--r-- 1 tbase tbase 282 May 26 2016 tableTruncates.sql-rw-r--r-- 1 tbase tbase 306 May 26 2016 tableDrops.sql-rw-r--r-- 1 tbase tbase 620 May 26 2016 indexDrops.sql-rw-r--r-- 1 tbase tbase 1392 May 26 2016 foreignKeys.sql 《《《 如果测试分布式环境不支持外键,将该文件清空-rw-r--r-- 1 tbase tbase 117 May 26 2016 buildFinish.sql-rw-r--r-- 1 tbase tbase 3068 Mar 19 10:21 tableCreates.sql.bak 《《《修改表结构、字段、添加主键、分布键等-rw-r--r-- 1 tbase tbase 960 Mar 19 11:44 indexCreates.sql.bak 《《《如有需要修改的索引,也需要调整-rw-r--r-- 1 tbase tbase 191 Mar 19 11:45 indexCreates.sql-rw-r--r-- 1 tbase tbase 3495 Mar 19 19:46 tableCreates.sql[tbase@Aken-DB data/aken/tpcc/benchmarksql-5.0/run/sql.common]#
3.初始化测试数据:
1) 创建测试库
postgres=#postgres=# create database benchmarksql;CREATE DATABASEpostgres=#
2) 根据上述props.pg_cn01的配置,2000个仓库的数据量约为100G:
cd /data/aken/tpcc/benchmarksql-5.0/run./runDatabaseBuild.sh props.pg_cn01
benchmarksql=# \l+List of databasesName | Owner | Encoding | Collate | Ctype | Access privileges | Size | Tablespace | Description--------------+-------+----------+------------+------------+-------------------+-------+------------+--------------------------------------------benchmarksql | tbase | UTF8 | zh_CN.utf8 | zh_CN.utf8 | | 22 GB | pg_default |postgres | tbase | UTF8 | zh_CN.utf8 | zh_CN.utf8 | | 21 MB | pg_default | default administrative connection databasetemplate0 | tbase | UTF8 | zh_CN.utf8 | zh_CN.utf8 | =c/tbase +| 18 MB | pg_default | unmodifiable empty database| | | | | tbase=CTc/tbase | | |template1 | tbase | UTF8 | zh_CN.utf8 | zh_CN.utf8 | =c/tbase +| 20 MB | pg_default | default template for new databases| | | | | tbase=CTc/tbase | | |(4 rows)postgres=# \c benchmarksqlpsql (11.5)Type "help" for help.benchmarksql=# \dtList of relationsSchema | Name | Type | Owner--------+-----------------------------+-------+-------public | bmsql_config | table | tbasepublic | bmsql_customer | table | tbasepublic | bmsql_district | table | tbasepublic | bmsql_history | table | tbasepublic | bmsql_item | table | tbasepublic | bmsql_new_order | table | tbasepublic | bmsql_oorder | table | tbasepublic | bmsql_order_line | table | tbasepublic | bmsql_stock | table | tbasepublic | bmsql_warehouse | table | tbasepublic | tbase_subscription | table | tbasepublic | tbase_subscription_parallel | table | tbase(12 rows)
cd /data/aken/tpcc/benchmarksql-5.0/run./runBenchmark.sh props.pg_cn01
四、部署相关报错处理
1.jdk版本冲突问题
[tbase@Aken-DB /data/aken/tpcc/benchmarksql-5.0/run]# ./runDatabaseBuild.sh props.mysql# ------------------------------------------------------------# Loading SQL file ./sql.common/tableCreates.sql# ------------------------------------------------------------Exception in thread "main" java.lang.UnsupportedClassVersionError: ExecJDBC : Unsupported major.minor version 52.0at java.lang.ClassLoader.defineClass1(Native Method)at java.lang.ClassLoader.defineClass(ClassLoader.java:800)at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)at java.net.URLClassLoader.access$100(URLClassLoader.java:71)at java.net.URLClassLoader$1.run(URLClassLoader.java:361)at java.net.URLClassLoader$1.run(URLClassLoader.java:355)at java.security.AccessController.doPrivileged(Native Method)at java.net.URLClassLoader.findClass(URLClassLoader.java:354)at java.lang.ClassLoader.loadClass(ClassLoader.java:425)at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)at java.lang.ClassLoader.loadClass(ClassLoader.java:358)at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)


I Love PG
关于我们
中国开源软件推进联盟PostgreSQL分会(简称:PG分会)于2017年成立,由国内多家PG生态企业所共同发起,业务上接受工信部产业发展研究院指导。PG分会致力于构建PG产业生态,推动PG产学研用发展,是国内一家PG行业协会组织。
技术文章精彩回顾 PostgreSQL学习的九层宝塔 PostgreSQL职业发展与学习攻略 搞懂PostgreSQL数据库透明数据加密之加密算法介绍 一文读懂PostgreSQL-12分区表 PostgreSQL源码学习之:RegularLock Postgresql源码学习之词法和语法分析 PostgreSQL buffer管理 最佳实践—PG数据库系统表空间重建 PostgreSQL V12中的流复制配置 2019,年度数据库舍 PostgreSQL 其谁? PostgreSQL使用分片(sharding)实现水平可扩展性 一文搞懂PostgreSQL物化视图 PostgreSQL原理解析之:PostgreSQL备机是否做checkpoint PostgreSQL复制技术概述 PG活动精彩回顾 见证精彩|PostgresConf.CN2019大会盛大开幕 PostgresConf.CN2019大会DAY2|三大分论坛,精彩不断 PostgresConf.CN2019培训日|爆满!Training Day现场速递! 「PCC-Training Day」培训日Day2圆满结束,PCC2019完美收官 创建PG全球生态!PostgresConf.CN2019大会盛大召开 首站起航!2019“让PG‘象’前行”上海站成功举行 走进蓉城丨2019“让PG‘象’前行”成都站成功举行 中国PG象牙塔计划发布,首批合作高校授牌仪式在天津举行 PostgreSQL实训基地落户沈阳航空航天大学和渤海大学,高校数据库课改正当时 群英论道聚北京,共话PostgreSQL 相聚巴厘岛| PG Conf.Asia 2019 DAY0、DAY1简报 相知巴厘岛| PG Conf.Asia 2019 DAY2简报 相惜巴厘岛| PG Conf.Asia 2019 DAY3简报 独家|硅谷Postgres大会简报 全球规模最大的PostgreSQL会议等你来! PG培训认证精彩回顾 关于中国PostgreSQL培训认证,你想知道的都在这里! 首批中国PGCA培训圆满结束,首批认证考试将于10月18日和20日举行! 中国首批PGCA认证考试圆满结束,203位考生成功获得认证! 中国第二批PGCA认证考试圆满结束,115位考生喜获认证! 请查收:中国首批PGCA证书! 重要通知:三方共建,中国PostgreSQL认证权威升级! 一场考试迎新年 | 12月28日,首次PGCE中级认证考试开考! 近500人参与!首次PGCE中级、第三批次PGCA初级认证考试落幕!
文章转载自开源软件联盟PostgreSQL分会,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。





