MySQL自带的基准测试套件中很多工具都需要DBI、DBD的支持:
Can't locate DBI.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl/5.8.7 /usr/lib/perl5/site_perl/5.8.6 /usr/lib/perl5/site_perl/5.8.5 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.7/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.6/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl/5.8.7 /usr/lib/perl5/vendor_perl/5.8.6 /usr/lib/perl5/vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl /usr/lib/perl5/5.8.8/i386-linux-thread-multi /usr/lib/perl5/5.8.8 .) at ./test-insert line 32.
错误原因:系统没有按安装DBI组件。
DBI(Database Interface)是perl连接数据库的接口。其是perl连接数据库的最优秀方法,他支持包括Orcal,Sybase,mysql,db2等绝大多数的数据库。
解决办法:安装DBI、Data-ShowTable、DBD-mysql (假设你已安装完perl和mysql数据库)。具体如下:
到ftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/by-module下载三个文件DBI-1.601.tar.gz、Data-ShowTable-3.3.tar.gz、DBD-mysql-3.0007_1.tar.gz,分别处于DBI,DATA,BDB目录下。注意下载的DBI的版本不能太低,如之前作者下载过低版本DBI-1.20不能编译通过。
下载后最好保存在目录:/usr/local/src下,并解压产生各模块的安装文件目录。如下
[root@localhost src]#tar zxvf DBI-1.601.tar.gz
[root@localhost src]#tar zxvf Data-ShowTable-3.3.tar.gz
[root@localhost src]#tar zxvf DBD-mysql-3.0007_1.tar.gz
安装DBI
[root@localhost src]# cd DBI-1.601
[root@localhost DBI-1.601]# perl Makefile.PL
[root@localhost DBI-1.601]# make
[root@localhost DBI-1.601]# make test
[root@localhost DBI-1.601]# make install
安装Data-ShowTable
[root@localhost src]# cd Data-ShowTable-3.3
[root@localhost Data-ShowTable-3.3]# perl Makefile.PL
[root@localhost Data-ShowTable-3.3]# make (注:第一次make出错,再make多几次)[root@localhost Data-ShowTable-3.3]# make install (注:无需make test)
安装DBD-mysql
[root@localhost src]# cd DBD-mysql-3.0007_1
[root@localhost DBD-mysql-3.0007_1]# perl Makefile.PL --libs="-L/usr/local/mysql-6.0.9-alhpa/lib/mysql -lmysqlclient -lz -lrt -lcrypt -lnsl -lm" --cflags=" -I/usr/local/mysql-6.0.9-alpha/include/mysql -g -DUNIV_LINUX" --testuser=root --testsocket=/home/cserken/mysql/tmp/mysql.sock
[root@localhost DBD-mysql-3.0007_1]# make
[root@localhost DBD-mysql-3.0007_1]# make test
[root@localhost DBD-mysql-3.0007_1]# make install
安装完毕
注意:make test之前mysql server要启动,并且要知道server的socket。本文在调试模式下启动mysql server,可获取到socket。
[root@localhost src]# cd /usr/local/mysql-6.0.9-alpha (mysql 安装路径)
[root@localhost mysql-6.0.9-alpha]# gdb libexec/mysqld
(gdb) r --user=root
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /usr/local/mysql-6.0.9-alpha/libexec/mysqld --user=root
[Thread debugging using libthread_db enabled]
[New Thread -1208408368 (LWP 3545)]
[New Thread -1208411248 (LWP 3546)]
[Thread -1208411248 (LWP 3546) exited]
[New Thread -1235683440 (LWP 3547)]
091012 8:47:30 [Note] Event Scheduler: Loaded 0 events
091012 8:47:30 [Note] /usr/local/mysql-6.0.9-alpha/libexec/mysqld: ready for connections.
Version: '6.0.9-alpha-debug-log' socket: '/home/cserken/mysql/tmp/mysql.sock' (这个就是socket)
另外,在启动测试脚本的时候,需要指定soket路径
[root@localhost sql-bench]# ./test-insert-using-btree-short --socket='/home/cserken/mysql/tmp/mysql.sock'
Testing server 'MySQL 6.0.9 alpha debug log' at 2009-10-12 9:54:04
Testing the speed of inserting data into 1 table and do some selects on it.
The tests are done with a table that has 100000 rows.
Generating random keys
Creating tables
Inserting 100000 rows in order
Inserting 100000 rows in reverse order
Inserting 100000 rows in random order
Time for insert (300000): 180 wallclock secs (11.30 usr 8.12 sys + 0.00 cusr 0.00 csys = 19.42 CPU)
本机配置环境:RHL + Intel(8核) + mysql-6.0.9-alpha。以上过程在本机上配置通过。
阅读(8124) | 评论(1) | 转发(0) |