Sqlrelay-0.42安装失败的曲折过程

环境: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"?>
<!DOCTYPE instances SYSTEM "sqlrelay.dtd">

<instances>

    <!-- Regular SQL Relay Instance -->
    <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://www.linuxsir.org/main/?q=node/144

http://blog.csdn.net/jiying87/article/details/4722147

http://blog.163.com/e4lich@126/blog/static/848106502011014103645812/

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值