MySQL DB Server 上面安裝 sysbench 作壓力測試

us_yunleiwang發表於2013-12-06

down tar.gz
wget 

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  
ssh eanprdmydbctl.eao.abn-iad.ea.com

3 db control server -> db
scp sysbench-0.4.12.tar.gz cm@xxxxdbcrol

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
[root@sysbench-0.4.12]# ./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
[root@sysbench-0.4.12]#

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


[root@sysbench-0.4.12]# ./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
--&gt Running transaction check
---&gt Package sysbench.x86_64 0:0.4.12-5.el6 will be installed
--&gt Processing Dependency: libpq.so.5()(64bit) for package: sysbench-0.4.12-5.el6.x86_64
--&gt Running transaction check
---&gt Package postgresql-libs.x86_64 0:8.4.13-1.el6_3 will be installed
--&gt 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!

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23490154/viewspace-1062523/,如需轉載,請註明出處,否則將追究法律責任。

相關文章