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

前端之家收集整理的这篇文章主要介绍了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/

猜你在找的Sqlite相关文章