2015-02-14记录:附带最新的安装记录(centos6.4):
一:bazaar安装方式(扩展后的多表测试)
1、安装bazaar工具
yum install bzr
2、获取源码
bzr branch lp:sysbench
3、编译安装
cd sysbench/; ./configure --prefix=/usr/local/sysbench --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib
make & make install
5、数据准备
./sysbench --test=tests/db/parallel_prepare.lua --max-time=100 --oltp-dist-type=uniform --max-requests=0 --mysql-user=test --mysql-password=test --mysql-table-engine=innodb --oltp-table-size=100 --oltp-tables-count=8 --oltp-range-size=90 --oltp-point-selects=1 --oltp-simple-ranges=1 --oltp-sum-ranges=1 --oltp-order-ranges=1 --oltp-distinct-ranges=1 --oltp-non-index-updates=10 --num-threads=20 --mysql-host=127.0.0.1 --mysql-port=3306 prepare
6、测试
./sysbench --test=tests/db/oltp.lua --max-time=100 --oltp-dist-type=uniform --max-requests=0 --mysql-user=test --mysql-password=test --mysql-table-engine=innodb --oltp-table-size=100 --oltp-tables-count=8 --oltp-range-size=90 --oltp-point-selects=1 --oltp-simple-ranges=1 --oltp-sum-ranges=1 --oltp-order-ranges=1 --oltp-distinct-ranges=1 --oltp-non-index-updates=10 --num-threads=20 --mysql-host=127.0.0.1 --mysql-port=3306 run
二:没有扩展前的单表测试
1)下载地址:
wget http://downloads.sourceforge.net/project/sysbench/sysbench/0.4.12/sysbench-0.4.12.tar.gz
2)解压缩
tar -xvf /root/sysbench-0.4.12.tar.gz -C /usr/local
cd /usr/local/
mv sysbench-0.4.12 sysbench
chown -R root.root sysbench
chmod 750 sysbench
3)编译
./autogen.sh #清理下环境
./configure --prefix=/usr/local/sysbench --with-mysql-includes=/usr/local/mysql/include --with-mysql-libs=/usr/local/mysql/lib
4)安装
cp /usr/bin/libtool . #预防../libtool: line 2547: X-lz: command not found报错
make
make install
cp /usr/local/mysql/lib/libmysqlclient.so.18 /usr/lib64/
5)加入系统全局参数
echo "export PATH=$PATH:/usr/local/sysbench/bin/">>/etc/profile
source /etc/profile
6)测试:
[root@data01 sysbench]# sysbench --help
Usage:
sysbench [general-options]... --test=
General options:
--num-threads=N number of threads to use [1]
--max-requests=N limit for total number of requests [10000]
--max-time=N limit for total execution time in seconds [0]
--forced-shutdown=STRING amount of time to wait after --max-time before forcing shutdown [off]
--thread-stack-size=SIZE size of stack per thread [32K]
--init-rng=[on|off] initialize random number generator [off]
--test=STRING test to run
--debug=[on|off] print more debugging info [off]
--validate=[on|off] perform validation checks where possible [off]
--help=[on|off] print help and exit
--version=[on|off] print version and exit
Compiled-in tests:
fileio - File I/O test
cpu - CPU performance test
memory - Memory functions speed test
threads - Threads subsystem performance test
mutex - Mutex performance test
oltp - OLTP test
Commands: prepare run cleanup help version
See 'sysbench --test=
[root@data01 sysbench]#
2014年以前的安装记录(centos5.5):
down tar.gz
wget http://downloads.sourceforge.net/project/sysbench/sysbench/0.4.12/sysbench-0.4.12.tar.gz
1 login
Tools -> SSH File Transfer -- input the config and transfer into base server.
2 base -> db control server
scp sysbench-0.4.12.tar.gz [email protected]:/tmp/
ssh eanprdmydbctl.eao.abn-iad.ea.com
3 db control server -> db
scp sysbench-0.4.12.tar.gz [email protected]:/tmp/
4 tar -xvf sysbench-0.4.12.tar.gz
以上方法适用于 MySQL 安装在标准默认目录下的情况,如果 MySQL 并不是安装在标准目录下的话,那么就需要自己指定 MySQL 的路径了。比如我的 MySQL 喜欢自己安装在 /usr/local/mysql 下,则按照以下方法编译:
5 configure
./configure --with-mysql-includes=/opt/mysql/product/mysql/include --with-mysql-libs=/opt/mysql/product/mysql/lib
[[email protected]]# ./configure --with-mysql-includes=/opt/mysql/product/mysql/include --with-mysql-libs=/opt/mysql/product/mysql/lib
checking build system type... Invalid configuration `x86_64-unknown-linux-': machine `x86_64-unknown-linux' not recognized
configure: error: /bin/sh config/config.sub x86_64-unknown-linux- failed
[[email protected]]#
reference: http://wangwei.cao.blog.163.com/blog/static/102362526201110255102215/
[]yum install libtool
OK,success
checking for cc_r... gcc
checking for sqrt in -lm... yes
configure: error: invalid MySQL root directory: /opt/mysql/product/mysql
[[email protected]]# ./configure --with-mysql=/opt/mysql/product/5.5.25a --with-mysql-libs=/opt/mysql/product/5.5.25a/lib64/mysql
&& make && make install
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether to compile with MySQL support... (cached) yes
checking whether to compile with Oracle support... (cached) no
checking whether to compile with PostgreSQL support... (cached) no
checking for style of include used by make... none
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... none
checking whether SHM_HUGETLB is declared... yes
checking whether O_SYNC is declared... yes
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking dependency style of gcc... (cached) none
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1966080
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for xsltproc... no
checking for the pthreads library -lpthreads... no
checking whether pthreads work without any flags... no
checking whether pthreads work with -Kthread... no
checking whether pthreads work with -kthread... no
checking for the pthreads library -llthread... no
checking whether pthreads work with -pthread... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking if more special flags are required for pthreads... no
checking for cc_r... gcc
checking for sqrt in -lm... yes
checking MySQL includes... (cached) /opt/mysql/product/mysql/include
checking MySQL libraries... (cached) /opt/mysql/product/mysql/lib
checking libaio.h usability... no
checking libaio.h presence... no
checking for libaio.h... no
checking for malloc in -lumem... no
checking for malloc in -lmtmalloc... no
checking for ANSI C header files... (cached) yes
checking errno.h usability... yes
checking errno.h presence... yes
checking for errno.h... yes
checking fcntl.h usability... yes
checking fcntl.h presence... yes
checking for fcntl.h... yes
checking math.h usability... yes
checking math.h presence... yes
checking for math.h... yes
checking pthread.h usability... yes
checking pthread.h presence... yes
checking for pthread.h... yes
checking sched.h usability... yes
checking sched.h presence... yes
checking for sched.h... yes
checking signal.h usability... yes
checking signal.h presence... yes
checking for signal.h... yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking sys/aio.h usability... no
checking sys/aio.h presence... no
checking for sys/aio.h... no
checking sys/ipc.h usability... yes
checking sys/ipc.h presence... yes
checking for sys/ipc.h... yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking sys/mman.h usability... yes
checking sys/mman.h presence... yes
checking for sys/mman.h... yes
checking sys/shm.h usability... yes
checking sys/shm.h presence... yes
checking for sys/shm.h... yes
checking thread.h usability... no
checking thread.h presence... no
checking for thread.h... no
checking for unistd.h... (cached) yes
checking for inline... inline
checking for off_t... yes
checking for size_t... yes
checking whether time.h and sys/time.h may both be included... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for size_t... (cached) yes
checking size of size_t... 8
checking for stdlib.h... (cached) yes
checking for GNU libc compatible malloc... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for getpagesize... yes
checking for working mmap... yes
checking whether strerror_r is declared... yes
checking for strerror_r... yes
checking whether strerror_r returns char *... no
checking whether clock_gettime is declared... yes
checking for library containing clock_gettime... -lrt
checking for alarm... yes
checking for fdatasync... yes
checking for gettimeofday... yes
checking for lrand48... yes
checking for memalign... yes
checking for memset... yes
checking for posix_memalign... yes
checking for pthread_yield... yes
checking for setvbuf... yes
checking for sqrt... yes
checking for strdup... yes
checking for thr_setconcurrency... no
checking for valloc... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating doc/xsl/Makefile
config.status: creating doc/xsl/catalog.xml
config.status: creating doc/Makefile
config.status: creating sysbench/Makefile
config.status: creating sysbench/drivers/Makefile
config.status: creating sysbench/drivers/mysql/Makefile
config.status: creating sysbench/drivers/oracle/Makefile
config.status: creating sysbench/drivers/pgsql/Makefile
config.status: creating sysbench/tests/Makefile
config.status: creating sysbench/tests/cpu/Makefile
config.status: creating sysbench/tests/fileio/Makefile
config.status: creating sysbench/tests/memory/Makefile
config.status: creating sysbench/tests/threads/Makefile
config.status: creating sysbench/tests/mutex/Makefile
config.status: creating sysbench/tests/oltp/Makefile
config.status: creating config/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
6 make
-- make命令报错
-bash: make: command not found, make没有安装,需要重新安装
yum install make 搞定
drv_mysql.c:879: error: ‘MYSQL_RES’ undeclared (first use in this function)
drv_mysql.c:879: error: expected expression before ‘)’ token
make[3]: *** [libsbmysql_a-drv_mysql.o] Error 1
make[3]: Leaving directory `/root/sysbench-0.4.12/sysbench/drivers/mysql''
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/root/sysbench-0.4.12/sysbench/drivers''
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/root/sysbench-0.4.12/sysbench''
make: *** [all-recursive] Error 1
[]./configure --with-mysql-libs=/usr/local/mysql/lib/mysql/ --with-mysql-includes=/usr/local/mysql/include/mysql/
OK, success !
7 make install
OK, success !
8 如果万一安装失败,还有最后一招: yum install sysbench 可以尝试尝试。
Loaded plugins: product-id, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package sysbench.x86_64 0:0.4.12-5.el6 will be installed
--> Processing Dependency: libpq.so.5()(64bit) for package: sysbench-0.4.12-5.el6.x86_64
--> Running transaction check
---> Package postgresql-libs.x86_64 0:8.4.13-1.el6_3 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================================================
Package Arch Version Repository Size
===================================================================================================================================
Installing:
sysbench x86_64 0.4.12-5.el6 uxdepot-epel-latest-rhel6-server-x86_64 74 k
Installing for dependencies:
postgresql-libs x86_64 8.4.13-1.el6_3 uxdepot-latest-rhel6-server-x86_64 200 k
Transaction Summary
===================================================================================================================================
Install 2 Package(s)
Total download size: 274 k
Installed size: 792 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): postgresql-libs-8.4.13-1.el6_3.x86_64.rpm | 200 kB 00:00
(2/2): sysbench-0.4.12-5.el6.x86_64.rpm | 74 kB 00:00
-----------------------------------------------------------------------------------------------------------------------------------
Total 7.7 MB/s | 274 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : postgresql-libs-8.4.13-1.el6_3.x86_64 1/2
Installing : sysbench-0.4.12-5.el6.x86_64 2/2
Verifying : postgresql-libs-8.4.13-1.el6_3.x86_64 1/2
Verifying : sysbench-0.4.12-5.el6.x86_64 2/2
Installed:
sysbench.x86_64 0:0.4.12-5.el6
Dependency Installed:
postgresql-libs.x86_64 0:8.4.13-1.el6_3
Complete!