声明:本文章只介绍用TPCCRuner工具测试TiDB 7.5.4,集群请提前准备。
TPCC工具准备
1、下载tpcc源码包
https://sourceforge.net/projects/tpccruner/files/TPCCRunner_SRC_V1.00.zip/download
2、解压并编译源码包
unzip TPCCRunner_SRC_V1.00.zip
cd src
javac -d ../bin ./iomark/TPCCRunner/*
mkdir log
TPCC配置修改
conf/example/mysql下有4个文件,其中
loader.properties
为数据准备配置
master.properties slave1.properties slave2.properties
为数据压测配置
conf/example/mysql/loader.properties
配置如下
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://10.2.xxx.xxx:4000/tpcc?characterEncoding=UTF-8&useServerPrepStmts=true&rewriteBatchedStatements=true&allowMultiQueries=true
user=root
password=root
threads=100
warehouses=1000
master.properties
配置如下:
listenPort=27891
slaves=slave1,slave2
runMinutes=50
warmupMinutes=10
newOrderPercent=1
paymentPercent=1
orderStatusPercent=45
deliveryPercent=43
stockLevelPercent=10
newOrderThinkSecond=0
paymentThinkSecond=0
orderStatusThinkSecond=0
deliveryThinkSecond=0
stockLevelThinkSecond=0
slave1.properties
配置如下:
name=slave1
masterAddress=10.2.xxx.xxx
masterPort=27891
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://10.2.xxx.xxx:4000/tpcc?characterEncoding=UTF-8&useServerPrepStmts=true&rewriteBatchedStatements=true&allowMultiQueries=true
user=root
password=root
poolSize=100
userCount=100
warehouseCount=500
startWarehouseID=1
slave2.properties
配置如下:
name=slave2
masterAddress=10.2.xxx.xxx
masterPort=27891
driver=com.mysql.jdbc.Driver
url=jdbc:mysql://10.2.xxx.xxx:4000/tpcc?characterEncoding=UTF-8&useServerPrepStmts=true&rewriteBatchedStatements=true&allowMultiQueries=true
user=root
password=root
poolSize=100
userCount=100
warehouseCount=500
startWarehouseID=501
准备数据
参考readme.txt
MySQL
username: root
password: xxxxx
1. Create Database
mysql -uroot -pxxxxxx -P4000 -h 10.2.xx.xx -vvv < sql/example/mysql/create_database.sql
2. Create Table
mysql -uroot -pxxxxxx -P4000 -h 10.2.xx.xx -vvv < sql/example/mysql/create_table.sql
3. Load Data
java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Loader conf/example/mysql/loader.properties
4. Create index
mysql -uroot -phuawei -vvv -n < sql/example/mysql/create_index.sql
运行TPCC
参考readme.txt
Run Master
java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Master conf/example/mysql/master.properties
Run Slaves on Clients
java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Slave conf/example/mysql/slave1.properties
java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Slave conf/example/mysql/slave2.properties
而我这里放到脚本里了,如下:
cat run.sh
nohup java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Master conf/example/mysql/master.properties &
sleep 1
nohup java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Slave conf/example/mysql/slave1.properties &
sleep 1
nohup java -cp bin/:lib/mysql-connector-java-5.1.7-bin.jar iomark.TPCCRunner.Slave conf/example/mysql/slave2.properties &
sh run.sh
进行启动
目前启动后,日志errlog异常,仍在排查。