Parsing MySQL Proxy Lua installation Configuration

Source: Internet
Author: User

MySQL Proxy LuaThe installation configuration is described in this article.MySQL ProxyThe installation of the binary version of is relatively simple. You do not need to talk about it. The following describes how to install the source code:

Install pkg-config:

 
 
  1. tar zxvf pkg-config-0.23.tar.gz  
  2. cd pkg-config-0.23  
  3. ./configure  
  4. make  
  5. make install 

Make sure that the PKG_CONFIG_PATH environment variable contains the relevant pkg-config configuration file path:

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

Install libevent:

 
 
  1. tar zxvf libevent-1.4.10-stable.tar.gz  
  2. cd libevent-1.4.10-stable  
  3. ./configure  
  4. make  
  5. make install 

Install glib:

 
 
  1. tar zxvf glib-2.20.0.tar.gz  
  2. cd glib-2.20.0  
  3. ./configure  
  4. make  
  5. make install 

Install lua:

 
 
  1. tar zxvf lua-5.1.4.tar.gz  
  2. cd lua-5.1.4 

If your server is 64-bit, adjust Makefile: vi src/Makefile and add-fPIC to CFLAGS; otherwise, an error occurs:

 
 
  1. /usr/bin/ld: /usr/local/lib/liblua.a(lapi.o):  
  2. relocation R_X86_64_32 against `luaO_nilobject_' can not be used when making a shared object;  
  3. recompile with -fPIC  
  4. /usr/local/lib/liblua.a: could not read symbols: Bad value 

Next, you do not need to execute common configure, and make directly:

 
 
  1. make linux  
  2. make install 

Install the pkg-config configuration file so that lua can be found during MySQL Proxy Compilation:

 
 
  1. cp etc/lua.pc /usr/local/lib/pkgconfig/lua5.1.pc 

If you do not perform this step, you will get an error message similar to the following when compiling and installing MySQL Proxy later:

 
 
  1. Package lua5.1 was not found in the pkg-config search path.  
  2. Perhaps you should add the directory containing `lua5.1.pc'  
  3. to the PKG_CONFIG_PATH environment variable  
  4. No package 'lua5.1' found 

Install mysql:

Here we will introduce the complete installation of mysql. In fact, you only need to install the mysql development kit.

 
 
  1. tar zxvf mysql-5.1.33.tar.gz  
  2. cd tar zxvf mysql-5.1.33  
  3. ./configure  
  4. make  
  5. make install  
  6. cp support-files/mysql.server /etc/init.d/mysql  
  7. chown +x /etc/init.d/mysql  
  8. cp support-files/my-[small|medium|large|huge|innodb-heavy-4G].cnf /etc/my.cnf 

If the skip-federated option exists in my. cnf, comment it out. Otherwise, an error similar to the following occurs during database installation:

 
 
  1. [ERROR] /usr/local/libexec/mysqld: unknown option '--skip-federated'  
  2.  
  3. /usr/local/bin/mysql_install_db --user=mysql 
  4. /usr/local/bin/mysqld_safe --user=mysql & 

Ensure that the system can find mysql_config, which will be used in MySQL Proxy compilation later:

 
 
  1. export PATH=$PATH:/usr/local/bin 

Make sure that the system can find the mysql database file:

Add vi/etc/ld. so. conf to the/usr/local/lib directory.

Run:/sbin/ldconfig/etc/ld. so. conf

Install MySQL Proxy:

 
 
  1. tar zxvf MySQL Proxy-0.7.0.tar.gz  
  2. cd MySQL Proxy-0.7.0  
  3. ./configure  
  4. make  
  5. make install 

Follow the official introduction to prepare the startup script/etc/init. d/MySQL Proxy and parameter script/etc/sysconfig/MySQL Proxy, and set:

 
 
  1. chmod +x /etc/init.d/MySQL Proxy  
  2. chkconfig --add MySQL Proxy 

Done. Test:/usr/local/sbin/MySQL Proxy-V. There are many discussions in the official forum. For more information, see.

Note: whether your operating system is 32-bit or 64-bit

I use MySQL Proxy on a 32-bit server, and it feels very unstable. Sometimes errors occur:

 
 
  1. Lost connection to server during query,MySQL server has gone away 

At this time, the MySQL Proxy process will often fail and the following error will also be reported:

 
 
  1. network-mysqld-proxy.c.3318: COM_(0x03), packet 4 should not be (NULL|EOF), got: fffffffe 

After switching to a 64-bit server, the stability is greatly improved. Therefore, if you want to use MySQL Proxy in the product environment, we strongly recommend that you use 64-bit.

As for the MySQL Proxy version selection, it is best to install MySQL Proxy in each version. It is not necessarily the higher the version, the more stable it is. If MySQL Proxy is used for read/write splitting, the most stable version is 0.6.X and 0.7.X on a 64-bit server.) Of course, this conclusion does not necessarily apply to you. You 'd better test it yourself.

Supplement: the official website seems to be retained only.MySQL ProxyTo download the latest version.

Summary: About AnalysisMySQL Proxy LuaThe content of the installation configuration is complete. I hope this article will help you!

Related Article

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.