Install the latest Mysql Proxy LUA in Centos 5.2

Source: Internet
Author: User

InCentos 1, 5.2Install the latestMysql Proxy LUAThe tutorial is the content to be introduced in this article.Mysql Proxy LUAThe installation process is described in detail in this article.

Mysql proxyThe code tree has been migrated to lauchpad, and bazaar is used for version management. For more information, seeCentos 1, 5.2Latest compilation and InstallationMysql proxySuccessful. The procedure record should also be applicable in centos 5 as follows ):

First let the EPEL (Extra Packages for Enterprise Linux) repository take effect

 
 
  1. #rpm -Uvhhttp://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm  

Make sure these packages have been installed: GNU Autotools, flex, pkg-config, bazaar, MySQL client libraries

 
 
  1. yum install autoconf automake libtool flex pkgconfig bzr mysql-devel  

The libevent version that comes with centos is too old. There is no other way to compile it by yourself. The version must be later than 1.4.0. The higher the version, the better.

 
 
  1. wget http://monkey.org/~provos/libevent-1.4.9-stable.tar.gz  
  2. tar zvfx libevent-1.4.9-stable.tar.gz  
  3. cd libevent-1.4.9-stable  
  4. /configure  
  5. make  
  6. make install  

The glib version that comes with centos is also relatively old. mysql proxy 0.7.0 or above requires glib2 later than .0 to be compiled successfully, so you have to re-compile glib

 
 
  1. wget http://ftp.gnome.org/pub/gnome/sources/glib/2.18/glib-2.18.4.tar.gz  
  2. tar zvfx glib-2.18.4.tar.gz  
  3. cd glib-2.18.4  
  4. /configure  
  5. make  
  6. make install  

Compile and install lua 5.1

 
 
  1. wget http://www.lua.org/ftp/lua-5.1.4.tar.gz  
  2. tar zvfx lua-5.1.4.tar.gz  
  3. cd lua-5.1.4  
  4. vi src/Makefile  

Add-fPIC to CFLAGS because the "relocations" error occurs during compilation on 64-bit machines.

 
 
  1. make linux  
  2. make install  
  3. cp etc/lua.pc /usr/local/lib/pkgconfig/  

Important: Let pkg-config find the library you have compiled

 
 
  1. $exportPKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig  

Finally, check out the latest mysql-proxy source file from bazaar for compilation:

 
 
  1. bzr branch lp:mysql-proxy  
  2. cd mysql-proxy  
  3. /autogen.sh 

Error message:

 
 
  1. configure.in:10: require Automake 1.10, but have 1.9 

No solution found

 
 
  1. /configure  
  2. make  
  3. make install 

Install mysql-proxy using source code

 
 
  1. wget http://launchpad.net/mysql-proxy/0.8/0.8.0/+download/mysql-proxy-0.8.0.tar.gz  
  2.  
  3. tar zxvf mysql-proxy-0.8.0.tar.gz  
  4. cd mysql-proxy-0.8.0  
  5. /configure  
  6. make  
  7. make install 

After compilation is complete, check the final result:

 
 
  1. mysql-proxy -V  
  2. mysql-proxy 0.8.0  
  3.   glib2: 2.18.4  
  4.   libevent: 2.0.10-stable  
  5.   lua: Lua 5.1.4  
  6.  LUA_PATH: /usr/local/lib/mysql-proxy/lua/?.lua  
  7.  LUA_CPATH: /usr/local/lib/mysql-proxy/lua/?.so 
  8.   == plugins ==  
  9.   admin: 0.7.0  
  10.  
  11.   proxy: 0.7.0 

Configure the startup script to run mysql-proxycd/etc/init. d at system startup.

 
 
  1. wget http://customcode.googlecode.com/files/mysql-proxy  
  2.  
  3. chmod0755/etc/init.d/mysql-proxy  
  4. chkconfig mysql-proxy on  

Add Operation Parameters

 
 
  1. cat>/etc/sysconfig/mysql-proxyOptions to mysql-proxy  
  2. do not remove --daemon  
  3. PROXY_OPTIONS="--daemon"  

CTRL + D save, then you can start | stop mysql-proxy

 
 
  1. /etc/init.d/mysql-proxy start|stop 

Troubleshooting

1,

 
 
  1. /etc/init.d/mysql-proxy  
  2. bash: /etc/init.d/mysql-proxy: /bin/bash^M: bad interpreter: No such file or directory 

Execute any command to convert mysql-proxy to unxi format

 
 
  1. #dos2unxi /etc/init.d/mysql-proxy   
  2. #vi /etc/init.d/mysql-proxy  
  3. set ff=unix 

2,

 
 
  1. make[2]: *** [lua.o] Error 1  
  2. make[2]: Leaving directory `/software/lua-5.1.4/src'  
  3. make[1]: *** [linux] Error 2  
  4. make[1]: Leaving directory `/software/lua-5.1.4/src'  
  5. make: *** [linux] Error 2 

Solution:

 
 
  1. #yum -y  install libtermcap-devel  ncurses-devel ncurses-devel ncurses-devel   

3,

 
 
  1. gconvert.c:55:2: error: #error GNU libiconv not in use but included iconv.h is from libiconv 

Summary:Centos 1, 5.2Install the latestMysql Proxy LUAThe content of this tutorial has been introduced. I hope this article will help you!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.