Install database Proxy on both CKS boxes - ACS - Reference Guides

ACS Installation and Administration Guide

Product
ACS
Platform
7.12
Category
Reference Guides
Language
English
Target Audience
public

To install database Proxy


1. Download the linux-generic version of mysql-proxy: MySQL Proxy Download Page


2. Extract the content of the downloaded archive in /usr/local/afs7/mysql-proxy/


3. Copy the init.d script provided by the CKS package:

cp /usr/local/afs7/share/templates/mysql-proxy/mysql-proxy /etc/init.d/


4. Copy the lua script provided by the CKS package:

cp /usr/local/afs7/share/templates/mysql-proxy/rw-balance.lua /usr/local/afs7/mysql-proxy/share/doc/mysql-proxy/


5. Create the configuration file /etc/sysconfig/database-proxy:

PROXY_OPTIONS="--proxy-address=127.0.0.1:4040
--proxy-backend-addresses=cks-database1-box:3306
--proxy-backend-addresses=cks-database2-box:3306
--proxy-lua-script=/usr/local/afs7/database-proxy/share/doc/database-proxy/rw-balance.lua
--log-file=/usr/local/afs7/database-proxy/database-proxy.log
--log-level=debug
--admin-username=admin
--admin-password=admin-password
--admin-lua-script=/usr/local/afs7/database-proxy/lib/database-proxy/lua/admin.lua"

This sample is for a proxy on the first CKS server (cks1-box) with the first database on cks-database1-box, and the second on cks-database2-box.

The proxy-address option is for the ip address of the proxy. The proxy-backend-addresses are the ip addresses of the database servers. Proxy-backend-addresses must be declared in the same order on both boxes.


6. Start database-proxy:

/etc/init.d/database-proxy start


7. Have database-proxy starting automatically at boot:

/sbin/chkconfig --add database-proxy
/sbin/chkconfig database-proxy on


8. Check the connections on both boxes through the database proxy.