mysql proxy 编译安装文档 by CentOS up
完整mysql-proxy 0.6.1 二进制包下载:(包含lua5.1、glib2.7.7、libevent1....
扫描右侧二维码阅读全文
21
2008/05

mysql proxy 编译安装文档 by CentOS up

完整mysql-proxy 0.6.1 二进制包下载:(包含lua5.1、glib2.7.7、libevent1.4、check0.9.3)

mysql-proxy 0.6.1?

请直接解压在根目录下:

tar zxvf mysqlproxy-0.6.1-fullbin-centos4-lua-x86-scripts-32bit.tar.gz -C /

其中/root/mysql-proxy 为启动脚本,请自行修改其中的IP地址。

以下内容是该二进制档的编译过程,供参考:

mysql-proxy install relation tar ball in the CentOS4.4 system:
glib >= 2.6, libevent, libcheck, lua
if the system already has those pkg, no need to install them any more, but on my?CentOS4/RHEL4 box I have to install them all.

1
glib >= 2.7.7
get it from http://www.gtk.org/ (Note: newer version need newer pkg-config 0.15)
here is a short instuction to install glib 2.7.7
./configure --prefix=/opt/glib27
make
make install

2
libevent 1.x or higher (1.4.1 or later is preferred)
you can get lib event from http://monkey.org/~provos/libevent/
./configure --prefix=/opt/libevent
make
make install

3 check
get the lib from http://check.sourceforge.net/
check 0.9.3 successed in CentOS 4.4
./configure --prefix=/opt/check
make
make install

4
lua 5.1.x or higher
"lua" can be found @ http://www.lua.org/
and the latest version of lua is Lua 5.1.3
here is a short instruction to install lua
a) update the Make file change line "INSTALL_TOP= /usr/local" to "INSTALL_TOP= /opt/lua"
b) then "make linux" (you can just type make to get a list of supported platform)
c) "make install"

5
mysql 5.1.23 client version is enough
get the?source ball?from http://www.mysql.com/
tar zxvf mysql-5.1.23-rc-linux-i686-glibc23.tar.gz
ln -s mysql-5.1.23-rc-linux-i686-glibc23 mysql
cd mysql
groupadd mysql
useradd -g mysql mysql -s /sbin/nologin
chown mysql:root . -R
chown mysql:mysql data -R
scripts/mysql_install_db --user=mysql

6
mysql-proxy 0.6.1 the latest version
export LUA_CFLAGS="-I/usr/local/include"
export LUA_LIBS="-L/usr/local/lib -llua -ldl"
export LDFLAGS="-lm"
export GLIB_CFLAGS="-I/opt/glib27/include/glib-2.0 -I/opt/glib27/lib/glib-2.0/include"
export GLIB_LIBS="-L/opt/glib27/lib -lglib-2.0"
export CPPFLAGS="$CPPFLAGS -I/opt/libevent/include"
export CFLAGS="$CFLAGS -I/opt/libevent/include"
export LDFLAGS="$LDFLAGS -L/opt/libevent/lib -lm"
./configure --prefix=/usr/local/mysql-proxy --with-mysql=/usr/local/mysql --with-check=/opt/check

7
running
cp /usr/local/mysql-proxy/sbin/mysql-proxy /usr/sbin/
help command:
mysql-proxy --help-all
configure run:
mysql-proxy \
--proxy-backend-addresses=192.168.3.91:3306 \
--proxy-backend-addresses=192.168.3.92:3306
Note that the default port number of the proxy server is 4040
so you can connect to the proxy server the port 4040

8
testing
mysql -uroot -h 192.168.3.99 -P 4040 -p123456

9
For example, mysql Write/Read splitting configure running:
LUA_PATH="/usr/local/mysql-proxy/share/mysql-proxy/?.lua" \
/usr/sbin/mysql-proxy \
--proxy-address=127.0.0.1:3306 \
--proxy-backend-addresses=192.168.3.91:3306 \
--proxy-read-only-backend-addresses=192.168.3.92:3306 \
--proxy-lua-script=/usr/local/mysql-proxy/share/mysql-proxy/rw-splitting.lua > /var/log/mysql-proxy.log &

具体实施过程请参看blog内其他文档。

相关技术交流请发邮件或msn

field2000@msn.com

Last modification:November 26th, 2018 at 04:16 pm
If you think my article is useful to you, please feel free to appreciate

3 comments

  1. Hi

    2010-11-09 00:06:56: (message) mysql-proxy 0.8.1 started
    2010-11-09 00:06:56: (debug) max open file-descriptors = 1024
    2010-11-09 00:06:56: (critical) admin-plugin.c:569: --admin-username needs to be set
    2010-11-09 00:06:56: (critical) mainloop.c:267: applying config of plugin admin failed
    2010-11-09 00:06:56: (critical) mysql-proxy-cli.c:596: Failure from chassis_mainloop. Shutting down.
    2010-11-09 00:06:56: (message) Initiating shutdown, requested from mysql-proxy-cli.c:597
    2010-11-09 00:06:56: (message) shutting down normally, exit code is: 1

    我也出现这个问题,百思不得其解,google,baidu上也找不到! 谢谢!

  2. test

    2010-10-21 09:27:01: (critical) admin-plugin.c:569: --admin-username needs to be set
    2010-10-21 09:27:01: (critical) mainloop.c:267: applying config of plugin admin failed
    2010-10-21 09:27:01: (critical) mysql-proxy-cli.c:596: Failure from chassis_mainloop. Shutting down.

    请问这个是什么意思?谢谢!

  3. rejw

    你好我在使用读写分离的rw-spliting.lua的时候出现了这个错误
    网页上显示:Lost connection to MySQL server during query
    mysql-proxy上显示:
    file sql-tokenizer.l: line 411 (sql_token_append_last_token): assertion failed: (tokens->len > 0)

    [1]+ 已放弃
    能帮帮忙么?十分感谢!

Leave a Comment