在Centos 5.2下安装***Mysql Proxy LUA教程是本文要介绍的内容,主要是来了解Mysql Proxy LUA的安装过程,文章中有很详细的讲解,具体内容来看本文详解。
mysql proxy的代码树已经迁移到lauchpad,采用bazaar进行版本管理。参考了一些文档,在centos 5.2下编译安装***mysql proxy成功。步骤记录如下(在centos 5下应该也适用):
首先让EPEL (Extra Packages for Enterprise Linux) repository 生效
- #rpm -Uvhhttp://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
确定这些包已经安装:GNU Autotools, flex, pkg-config, bazaar, MySQL client libraries
- yum install autoconf automake libtool flex pkgconfig bzr mysql-devel
centos下自带的libevent版本超老,这个没有别的办法,只能自己重新编译,版本需要在1.4.0以上,越高越好
- wget http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz
- tar zvfx libevent-1.4.9-stable.tar.gz
- cd libevent-1.4.9-stable
- /configure
- make
- make install
centos自带的glib版本也比较老,mysql proxy 0.7.0以上需要glib2 2.16.0以上才能编译成功,因此不得不重新编译glib
- wget http://ftp.gnome.org/pub/gnome/sources/glib/2.18/glib-2.18.4.tar.gz
- tar zvfx glib-2.18.4.tar.gz
- cd glib-2.18.4
- /configure
- make
- make install
编译安装lua 5.1
- wget http://www.lua.org/ftp/lua-5.1.4.tar.gz
- tar zvfx lua-5.1.4.tar.gz
- cd lua-5.1.4
- vi src/Makefile
在CFLAGS里加上-fPIC,因为我在64位机上编译出现了“relocations”错误
- make linux
- make install
- cp etc/lua.pc /usr/local/lib/pkgconfig/
重要:让pkg-config找到自己编译的库在哪里
- $exportPKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
***,从bazaar中检出***的mysql-proxy源文件进行编译:
- bzr branch lp:mysql-proxy
- cd mysql-proxy
- /autogen.sh
提示错误:
- configure.in:10: require Automake 1.10, but have 1.9
没有找到解决方法
- /configure
- make
- make install
mysql-proxy安装采用源码安装
- wget http://launchpad.net/mysql-proxy/0.8/0.8.0/+download/mysql-proxy-0.8.0.tar.gz
- tar zxvf mysql-proxy-0.8.0.tar.gz
- cd mysql-proxy-0.8.0
- /configure
- make
- make install
编译完成,可以检查一下最终结果:
- mysql-proxy -V
- mysql-proxy 0.8.0
- glib2: 2.18.4
- libevent: 2.0.10-stable
- lua: Lua 5.1.4
- LUA_PATH: /usr/local/lib/mysql-proxy/lua/?.lua
- LUA_CPATH: /usr/local/lib/mysql-proxy/lua/?.so
- == plugins ==
- admin: 0.7.0
- proxy: 0.7.0
配置启动脚本,在系统启动时运行mysql-proxycd/etc/init.d
- wget http://customcode.googlecode.com/files/mysql-proxy
- chmod0755/etc/init.d/mysql-proxy
- chkconfig mysql-proxy on
增加运行参数
- cat>/etc/sysconfig/mysql-proxyOptions to mysql-proxy
- do not remove --daemon
- PROXY_OPTIONS="--daemon"
CTRL+D保存,然后就可以使用以下命令启动|停止mysql-proxy
- /etc/init.d/mysql-proxy start|stop
错误解决
1、
- /etc/init.d/mysql-proxy
- bash: /etc/init.d/mysql-proxy: /bin/bash^M: bad interpreter: No such file or directory
执行一下任意一命令将mysql-proxy转换为unxi格式
- #dos2unxi /etc/init.d/mysql-proxy
- #vi /etc/init.d/mysql-proxy
- set ff=unix
2、
- make[2]: *** [lua.o] Error 1
- make[2]: Leaving directory `/software/lua-5.1.4/src'
- make[1]: *** [linux] Error 2
- make[1]: Leaving directory `/software/lua-5.1.4/src'
- make: *** [linux] Error 2
解决:
- #yum -y install libtermcap-devel ncurses-devel ncurses-devel ncurses-devel
3、
- gconvert.c:55:2: error: #error GNU libiconv not in use but included iconv.h is from libiconv
小结:详解在Centos 5.2下安装***Mysql Proxy LUA教程的内容介绍完了,希望通过本文的学习能对你有所帮助!