Environment: centos 5.6, MySQL 5.5, sqlite-3.3.6-5 (problem critical ).
Steps:
1. Download the installation package from the official website: sqlrelay-0.42.tar.gzand rudiments-0.33.tar.gz.
2. Install rudiments smoothly
# tar vxzf rudiments-0.33.tar.gz# cd rudiments-0.33# ./configure --prefix=/usr/local/rudiments# make# make install
3. Install 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
The above make step has an error, and the entire stuck process is here, the prompt is as follows:
Sqliteconnection. c: In member function 'int sqlitecursor: runquery (const char *) ': sqliteconnection. c: 260: Error: sqliteconnection is invalid for the conversion from 'void * 'of type to 'Char *' of type. c: 260: Error: Initialize real parameter 1, which belongs to 'void sqlite3_free (char *) 'sqliteconnection. c: In member function 'Char * sqliteconnection: duplicate (const char *) ': sqliteconnection. c: 418: Error: 'sqlite3 _ malloc 'has not been declared in this scope make [3]: *** [sqliteconnection. lo] Error 1 make [3]: Leaving directory '/root/sqlrelay-0.42/src/connections/SQLite 'make [2]: * ** [all] Error 2 make [2]: Leaving directory '/root/sqlrelay-0.42/src/connections' make [1]: * ** [all] Error 2 make [1]: Leaving directory '/root/sqlrelay-0.42/src 'make: *** [all] Error 2
Make install again after the error occurs. The result is/usr/local/failure.
Then there was a fierce search + attempt, and the results were defeated.
In desperation, I had a bold idea: Modify the sqliteconnection. C source file and compile it again! Because only SQLite is involved in the error message, and I am not planning to use sqlrelay on SQLite, please feel free to change it ~
The file is under src/connections/SQLite. Two changes are made:
Row 260: changed from sqlite3_free (void *) sqliteconn-> errmesg); To sqlite3_free (char *) sqliteconn-> errmesg); // The system is quite congested. I wonder if it is an environmental problem? Row 418: changed from char * buffer = (char *) sqlite3_malloc (Length + 1) To char * buffer = (char *) malloc (Length + 1 ); // This hidden danger is quite large. At present, there is only no solution
After modification, make -- OK, and then make install -- OK.
4. Configure sqlrelay
Configuration File Path:/usr/local/sqlrelay/etc/sqlrelay. conf. The content is as follows:
<?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. Start sqlrelay
# Export Path = $ path:/usr/local/sqlrelay/bin
# Sqlr-start-ID mypool
6. Service Testing
# Sqlrsh-ID mypool
The SQL query can be executed.
7. Performance and other requirements Testing
To be continued...
Refer:
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/