环境:CentOS 5.6,MySQL 5.5,sqlite-3.3.6-5(问题关键)。
步骤:
1、官网下载安装包:sqlrelay-0.42.tar.gz和rudiments-0.33.tar.gz。
2、安装rudiments,顺利
- # tar vxzf rudiments-0.33.tar.gz
- # cd rudiments-0.33
- # ./configure --prefix=/usr/local/rudiments
- # make
- # make install
3、安装sqlrelay:
- # tar zxvf sqlrelay-0.42.tar.gz
- # cd sqlrelay-0.42
- # ./configure --prefix=/usr/local/sqlrelay --with-rudiments-prefix=/usr/local/rudiments --with-mysql-prefix=/usr/share/mysql
- # make
- # make install
上面make这一步出错了,整个卡住的过程也就在此,提示如下:
- sqliteconnection.C: In member function ‘int sqlitecursor::runQuery(const char*)’:
- sqliteconnection.C:260: 错误:从类型 ‘void*’ 到类型 ‘char*’ 的转换无效
- sqliteconnection.C:260: 错误: 初始化实参 1,属于 ‘void sqlite3_free(char*)’
- sqliteconnection.C: In member function ‘char* sqliteconnection::duplicate(const char*)’:
- sqliteconnection.C:418: 错误:‘sqlite3_malloc’ 在此作用域中尚未声明
- make[3]: *** [sqliteconnection.lo] 错误 1
- make[3]: Leaving directory `/root/sqlrelay-0.42/src/connections/sqlite'
- make[2]: *** [all] 错误 2
- make[2]: Leaving directory `/root/sqlrelay-0.42/src/connections'
- make[1]: *** [all] 错误 2
- make[1]: Leaving directory `/root/sqlrelay-0.42/src'
- make: *** [all] 错误 2
出错后再make install,导致的结果是/usr/local/sqlrelay只有四个文件夹,没有etc(放配置文件)和share,而且bin里面的文件也不全,连启动服务的sqlr-start.exe都没有。
然后就是一顿狂搜+尝试,结果一一败下阵来。
百般无奈之下,有了个大胆的想法:修改sqliteconnection.C源文件再编译!因为报错信息中只涉及到SQLite,而我没有打算在SQLite上用sqlrelay,所以放心去改吧~
文件在src/connections/sqlite下。修改了两个地方,分别是:
- 260行:由sqlite3_free((void *)sqliteconn->errmesg);改为sqlite3_free((char *)sqliteconn->errmesg);
- 418行:由char *buffer=(char *)sqlite3_malloc(length+1);改为char *buffer=(char *)malloc(length+1);
修改后,make——OK,然后make install——OK。
4、配置sqlrelay
配置文件路径: /usr/local/sqlrelay/etc/sqlrelay.conf。内容如下:
- xml version="1.0"?>
- >
-
- <instances>
-
-
- <instance id="mypool" port="9000" socket="/tmp/example.socket" dbase="mysql" connections="3" maxconnections="15" maxqueuelength="5" growby="1" ttl="60" maxsessioncount="1000" endofsession="commit" sessiontimeout="600" runasuser="nobody" runasgroup="nobody" cursors="5" authtier="listener" handoff="pass" deniedips="" allowedips="" debug="none" maxquerysize="65536" maxstringbindvaluelength="4000" maxlobbindvaluelength="71680" idleclienttimeout="-1" maxlisteners="-1" listenertimeout="0" reloginatstart="no" timequeriessec="-1" timequeriesusec="-1">
- <users>
- <user user="userpool" password="pwpool"/>
- users>
- <connections>
- <connection connectionid="db1" string="user=root;password=123456;db=yourdb;host=127.0.0.1;port=3306;"metric="1" behindloadbalancer="no"/>
- connections>
- instance>
- instances>
5、启动sqlrelay
# export PATH=$PATH:/usr/local/sqlrelay/bin
# sqlr-start -id mypool
6、服务测试
# sqlrsh -id mypool
接着可执行SQL查询。
7、性能及其他需求测试
待续。。。
参考:
http://blog.csdn.net/jiying87/article/details/4722147
http://blog.163.com/e4lich@126/blog/static/848106502011014103645812/
阅读(1865) | 评论(1) | 转发(0) |