tpcc-mysql 系列一:安装使用

1:安装epel包:

rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

  

2:

yum install bzr

报错了:

--> Finished Dependency Resolution
Error: Package: python-paramiko-1.7.6-1.el5.noarch (epel)
           Requires: python(abi) = 2.4
           Installed: python-2.6.6-36.el6.x86_64 (@anaconda-CentOS-201303020151.x86_64/6.4)
               python(abi) = 2.6
           Available: python-2.6.6-52.el6.x86_64 (base)
               python(abi) = 2.6
           Available: python26-2.6.8-2.el5.x86_64 (epel)
               python(abi) = 2.6
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

  

解决方案:

cd /etc/yum.repos.d/

mv epel.repo epel.repo.bak

 

重新安装:

yum install bzr

  

3:下载源码

bzr branch lp:~percona-dev/perconatools/tpcc-mysql
[root@localhost software]# bzr branch lp:~percona-dev/perconatools/tpcc-mysql
You have not informed bzr of your Launchpad ID, and you must do this to
write to Launchpad or access private data.  See "bzr help launchpad-login".
/    163KB    11KB/s | Fetching revisions:Inserting stream 

还得注册。。。。

 

4:用一下网上的源码(取自叶金荣老师

wget http://imysql.com/wp-content/uploads/2014/09/tpcc-mysql-src.tgz

  

tar -xvf tpcc-mysql-src.tar
tpcc-mysql的业务逻辑及其相关的几个表作用如下:

New-Order:新订单,一次完整的订单事务,几乎涉及到全部表
Payment:支付,主要对应 orders、history 表
Order-Status:订单状态,主要对应 orders、order_line 表
Delivery:发货,主要对应 order_line 表
Stock-Level:库存,主要对应 stock 表

其他相关表:
客户:主要对应 customer 表
地区:主要对应 district 表
商品:主要对应 item 表
仓库:主要对应 warehouse 表

  

5:编译安装

#如果 make 没有报错,就会在 /tpcc-mysql 下生成 tpcc 二进制命令行工具 tpcc_load 、 tpcc_start

cd /tpcc-mysql/src
make

  

报错:

load.c: In function ?.rror?.
load.c:1242: error: expected declaration specifiers before ?.YSQL_STMT?
load.c:1248: error: ?.ysql?.undeclared (first use in this function)
make: *** [load.o] Error 1

  

解决方案:

vim /etc/profile
export MYSQL_HOME=/usr/local/mysql/
export C_INLUDE_PATH=$MYSQL_HOME/include
export LD_LIBRARY_PATH=$MYSQL_HOME/lib
export PATH=$MYSQL_HOME/bin:$PATH

source /etc/profile

  

重新编译:

make

  

[root@localhost tpcc-mysql]# ll
total 248
-rw-r--r--. 1 root root   1621 Sep 14  2014 add_fkey_idx.sql
-rw-r--r--. 1 root root    317 Sep 14  2014 count.sql
-rw-r--r--. 1 root root   3105 Sep 14  2014 create_table.sql
-rw-r--r--. 1 root root    763 Sep 14  2014 drop_cons.sql
-rw-r--r--. 1 root root    477 Sep 14  2014 load.sh
-rw-r--r--. 1 root root    851 Sep 14  2014 README
drwxr-xr-x. 2 root root   4096 Sep 14  2014 schema2
drwxr-xr-x. 5 root root   4096 Sep 14  2014 scripts
drwxr-xr-x. 2 root root   4096 May 26 02:54 src
-rwxr-xr-x. 1 root root  60273 May 26 02:54 tpcc_load
-rwxr-xr-x. 1 root root 154064 May 26 02:54 tpcc_start

  

6:初始化测试库



mysqladmin create tpcc1000 mysql -f tpcc1000 < create_table.sql

 

或者:

 

mysql> create database tpcc1000;
Query OK, 1 row affected (0.04 sec)

mysql> use tpcc1000;
Database changed
mysql> source /root/software/tpcc-mysql/create_table.sql

  

ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock

./tpcc_load localhost tpcc1000 root "ge0513" 1000

  

 

你可能感兴趣的:(mysql)