---------- Forwarded message ---------- From: Brian Zammit <[email protected]> Date: 2009/6/16 Subject: Re: [Mysql-proxy-discuss] Guide to running multiple proxies on same machine To: Kay Röpke <[email protected]>
2009/6/16 Kay Röpke <[email protected]> > Hi! > > > On Jun 16, 2009, at 4:01 PM, Brian Zammit wrote: > > Hello group, >> >> I need to run two proxies on the same server, one on default port 4040 and >> the other on port 4050 (arbitrarly chosen). One is used for read and the >> other for writes, split at the application level. >> >> Is there a recommended way to startup, run and control two proxies running >> on a machine? >> > > > Not really, as we currently don't supply init.d scripts for example. I've been using an init.d script that looks like the following: #!/bin/sh # # mysql-proxy This script starts and stops the mysql-proxy daemon # # chkconfig: - 78 30 # processname: mysql-proxy # description: mysql-proxy is a proxy daemon to mysql # Source function library. . /etc/rc.d/init.d/functions PROXY_PATH=/opt/mysql-proxy/sbin prog="mysql-proxy" # Source networking configuration. . /etc/sysconfig/network # Check that networking is up. [ ${NETWORKING} = "no" ] && exit 0 # Set default mysql-proxy configuration. PROXY_OPTIONS="--daemon" PROXY_PID=/var/run/mysql-proxy.pid # Source mysql-proxy configuration. if [ -f /etc/sysconfig/mysql-proxy ] ; then . /etc/sysconfig/mysql-proxy fi PATH=$PATH:/usr/bin:/usr/local/bin:$PROXY_PATH # By default it's all good RETVAL=0 # See how we were called. case "$1" in start) # Start daemon. echo -n $"Starting $prog: " daemon $NICELEVEL $PROXY_PATH/mysql-proxy $PROXY_OPTIONS --pid-file $PROXY_PID RETVAL=$? echo if [ $RETVAL = 0 ]; then touch /var/lock/subsys/mysql-proxy fi ;; stop) # Stop daemons. echo -n $"Stopping $prog: " killproc $prog RETVAL=$? echo if [ $RETVAL = 0 ]; then rm -f /var/lock/subsys/mysql-proxy rm -f $PROXY_PID fi ;; restart) $0 stop sleep 3 $0 start ;; condrestart) [ -e /var/lock/subsys/mysql-proxy ] && $0 restart ;; status) status mysql-proxy RETVAL=$? ;; *) echo "Usage: $0 {start|stop|restart|status|condrestart}" RETVAL=1 ;; esac exit $RETVAL And associated /etc/sysconfig/mysql-proxy file that looks like the following: # Options to mysql-proxy # do not remove --daemon PROXY_OPTIONS="--daemon --proxy-skip-profiling --proxy-address=localhost:4040 --admin-address=localhost:4041 --proxy-backend-addresses=10.10.10.10:3306" > > However, the easiest way to do it is to use the --defaults-file option for > the two instances. > Joshua described the format in a blog post: > http://blog.zhuzhaoyuan.com/2009/02/using-mysql-proxys-configuration-file/ > > That way you only have to use one parameter when starting the proxies. Ah, thats a neat idea. I'll try this out. Thanks, Brian
_______________________________________________ Mailing list: https://launchpad.net/~mysql-proxy-discuss Post to : [email protected] Unsubscribe : https://launchpad.net/~mysql-proxy-discuss More help : https://help.launchpad.net/ListHelp

