首页 > 代码库 > Tpcc安装

Tpcc安装

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

安装bzr客户端

# yum clean all
# yum install bzr
Dependencies Resolved
 
========================================================================================================================================================================
 Package                                      Arch                                Version                                       Repository                         Size
========================================================================================================================================================================
Installing:
 bzr                                          i386                                2.1.4-2.el5                                   epel                              7.6 M
Installing for dependencies:
 python-crypto                                i386                                2.0.1-5.el5                                   epel                              188 k
 python-paramiko                              noarch                              1.7.6-1.el5                                   epel                              987 k
 python-pycurl                                i386                                7.15.5.1-8.el5                                base                               72 k
 
Transaction Summary
========================================================================================================================================================================
Install      4 Package(s)        
Update       0 Package(s)        
Remove       0 Package(s)        
 
Total download size: 8.8 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): python-pycurl-7.15.5.1-8.el5.i386.rpm                                                                                                     |  72 kB     00:00    
(2/4): python-crypto-2.0.1-5.el5.i386.rpm                                                                                                        | 188 kB     00:01    
(3/4): python-paramiko-1.7.6-1.el5.noarch.rpm                                                                                                    | 987 kB     00:02    
(4/4): bzr-2.1.4-2.el5.i386.rpm                                                                                                                  | 7.6 MB     00:28    
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                   275 kB/s | 8.8 MB     00:32    
warning: rpmts_HdrFromFdno: Header V4 DSA signature: NOKEY, key ID 217521f6
epel/gpgkey                                                                                                                                      | 1.7 kB     00:00    
Importing GPG key 0x217521F6 "Fedora EPEL <epel@fedoraproject.org>" from /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : python-pycurl                                                                                                                                    1/4
  Installing     : python-crypto                                                                                                                                    2/4
  Installing     : python-paramiko                                                                                                                                  3/4
  Installing     : bzr                                                                                                                                              4/4
 
Installed:
  bzr.i386 0:2.1.4-2.el5                                                                                                                                               
 
Dependency Installed:
  python-crypto.i386 0:2.0.1-5.el5                     python-paramiko.noarch 0:1.7.6-1.el5                     python-pycurl.i386 0:7.15.5.1-8.el5                     
 
Complete!

使用bzr下载tpcc-mysql源码    

bzr branch lp:~percona-dev/perconatools/tpcc-mysql
cd /tmp/tpcc-mysql/src
make

安装完成


报错处理

make

cc -w -O2 -g -I. `mysql_config --include`  -c load.c

/bin/sh: mysql_config: command not found

load.c:18:19: error: mysql.h: No such file or directory

In file included from load.c:20:

spt_proc.h:1: error: expected ‘)’ before ‘*’ token

load.c:26: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

load.c:27: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token

load.c:49: error: expected ‘)’ before ‘*’ token

load.c: In function ‘main’:

load.c:80: error: ‘MYSQL’ undeclared (first use in this function)

load.c:80: error: (Each undeclared identifier is reported only once

load.c:80: error: for each function it appears in.)

load.c:80: error: ‘resp’ undeclared (first use in this function)

load.c:183: error: ‘mysql’ undeclared (first use in this function)

load.c:203: error: ‘stmt’ undeclared (first use in this function)

load.c: In function ‘LoadItems’:

load.c:312: error: ‘MYSQL_BIND’ undeclared (first use in this function)

load.c:312: error: expected ‘;’ before ‘param’

load.c:366: error: ‘param’ undeclared (first use in this function)

load.c:367: error: ‘MYSQL_TYPE_LONG’ undeclared (first use in this function)

load.c:371: error: ‘MYSQL_TYPE_STRING’ undeclared (first use in this function)

load.c:374: error: ‘MYSQL_TYPE_FLOAT’ undeclared (first use in this function)

load.c:379: error: ‘stmt’ undeclared (first use in this function)

load.c:397: error: ‘mysql’ undeclared (first use in this function)

load.c: In function ‘LoadWare’:

load.c:428: error: ‘MYSQL_BIND’ undeclared (first use in this function)

load.c:428: error: expected ‘;’ before ‘param’

load.c:459: error: ‘param’ undeclared (first use in this function)

load.c:460: error: ‘MYSQL_TYPE_LONG’ undeclared (first use in this function)

load.c:462: error: ‘MYSQL_TYPE_STRING’ undeclared (first use in this function)

load.c:480: error: ‘MYSQL_TYPE_FLOAT’ undeclared (first use in this function)

load.c:484: error: ‘stmt’ undeclared (first use in this function)

load.c:492: error: ‘mysql’ undeclared (first use in this function)

load.c: In function ‘LoadCust’:

load.c:521: error: ‘mysql’ undeclared (first use in this function)

load.c: In function ‘LoadOrd’:

load.c:550: error: ‘mysql’ undeclared (first use in this function)

load.c: In function ‘Stock’:

load.c:590: error: ‘MYSQL_BIND’ undeclared (first use in this function)

load.c:590: error: expected ‘;’ before ‘param’

load.c:644: error: ‘param’ undeclared (first use in this function)

load.c:645: error: ‘MYSQL_TYPE_LONG’ undeclared (first use in this function)

load.c:651: error: ‘MYSQL_TYPE_STRING’ undeclared (first use in this function)

load.c:684: error: ‘stmt’ undeclared (first use in this function)

load.c: In function ‘District’:

load.c:732: error: ‘MYSQL_BIND’ undeclared (first use in this function)

load.c:732: error: expected ‘;’ before ‘param’

load.c:756: error: ‘param’ undeclared (first use in this function)

load.c:757: error: ‘MYSQL_TYPE_LONG’ undeclared (first use in this function)

load.c:761: error: ‘MYSQL_TYPE_STRING’ undeclared (first use in this function)

load.c:779: error: ‘MYSQL_TYPE_FLOAT’ undeclared (first use in this function)

load.c:785: error: ‘stmt’ undeclared (first use in this function)

load.c: In function ‘Customer’:

load.c:838: error: ‘MYSQL_BIND’ undeclared (first use in this function)

load.c:838: error: expected ‘;’ before ‘param’

load.c:892: error: ‘param’ undeclared (first use in this function)

load.c:893: error: ‘MYSQL_TYPE_LONG’ undeclared (first use in this function)

load.c:899: error: ‘MYSQL_TYPE_STRING’ undeclared (first use in this function)

load.c:934: error: ‘MYSQL_TYPE_FLOAT’ undeclared (first use in this function)

load.c:941: error: ‘stmt’ undeclared (first use in this function)

load.c:987: error: ‘mysql’ undeclared (first use in this function)

load.c: In function ‘Orders’:

load.c:1024: error: ‘MYSQL_BIND’ undeclared (first use in this function)

load.c:1024: error: expected ‘;’ before ‘param’

load.c:1051: error: ‘param’ undeclared (first use in this function)

load.c:1052: error: ‘MYSQL_TYPE_LONG’ undeclared (first use in this function)

load.c:1060: error: ‘MYSQL_TYPE_STRING’ undeclared (first use in this function)

load.c:1065: error: ‘stmt’ undeclared (first use in this function)

load.c:1148: error: ‘MYSQL_TYPE_FLOAT’ undeclared (first use in this function)

load.c:1205: error: ‘mysql’ undeclared (first use in this function)

load.c: In function ‘Error’:

load.c:1242: error: expected declaration specifiers before ‘MYSQL_STMT’

load.c:1248: error: ‘mysql’ undeclared (first use in this function)

make: *** [load.o] Error 1

 

解决方法

vim /etc/profile

在末行加入 

#set mysql_home and tpcc
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

cc load.o support.o `mysql_config --libs_r` -lrt -o ../tpcc_load

cc -w -O2 -g -I. `mysql_config --include`  -c main.c

cc -w -O2 -g -I. `mysql_config --include`  -c spt_proc.c

cc -w -O2 -g -I. `mysql_config --include`  -c driver.c

cc -w -O2 -g -I. `mysql_config --include`  -c sequence.c

cc -w -O2 -g -I. `mysql_config --include`  -c rthist.c

cc -w -O2 -g -I. `mysql_config --include`  -c neword.c

cc -w -O2 -g -I. `mysql_config --include`  -c payment.c

cc -w -O2 -g -I. `mysql_config --include`  -c ordstat.c

cc -w -O2 -g -I. `mysql_config --include`  -c delivery.c

cc -w -O2 -g -I. `mysql_config --include`  -c slev.c

cc main.o spt_proc.o driver.o support.o sequence.o rthist.o neword.o payment.o ordstat.o delivery.o slev.o `mysql_config --libs_r` -lrt -o ../tpcc_start



本文出自 “梧桐” 博客,请务必保留此出处http://songhl.blog.51cto.com/1538319/1531602