Bug #51440 configuration file option proxy-backend-addresses cannot be set multiple times
Submitted: 24 Feb 2010 1:54 Modified: 26 Feb 2010 16:36
Reporter: Dario Souza Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Proxy: Install/Config Severity:S2 (Serious)
Version:0.8.0 OS:Any
Assigned to: MC Brown CPU Architecture:Any
Tags: configuration config file addresses
Triage: Triaged: D4 (Minor)

[24 Feb 2010 1:54] Dario Souza
Description:
The configuration option proxy-read-only-backend-addresses or proxy-backend-addresses cannot be set multiple times and therefore cannot be used to set more than one backend server.

How to repeat:

1) create a file called /etc/mysql-proxy.cnf:

[mysql-proxy]
proxy-read-only-backend-addresses       = db-slave-1:3306
proxy-read-only-backend-addresses       = db-slave-2:3306
proxy-read-only-backend-addresses       = db-slave-4:3306
proxy-read-only-backend-addresses       = db-slave-3:3306
user                                    = mysql
proxy-address                           = :3306
proxy-pool-no-change-user               = true
log-file                                = /var/log/mysql-proxy.log
log-level                               = message  

2) start the proxy with:
mysql-proxy --defaults-file=/etc/mysql-proxy.cnf --daemon

3) try to connect to the proxy

4) check the log file:
2010-02-23 22:46:18: (message) mysql-proxy 0.8.0 started
2010-02-23 22:46:18: (message) proxy listening on port :3306
2010-02-23 22:46:18: (message) added read/write backend: 127.0.0.1:3306
2010-02-23 22:46:18: (message) added read-only backend: db-slave-3:3306

Note that it inserted the loopback address, creating another serious condition. The proxy loops itself when trying to connect to itself

Suggested fix:
allow configuration file to set multiple backend addresses
do not set loopback address (it was not specified in any way)
do not allow the listening interface:port to be set as a backend address
[24 Feb 2010 12:00] Kay Roepke
Thank you for your report.

The documentation does not mention how the ini file configuration works, which is slightly different to the command line options:
On the command line multiple proxy-backend-addresses can be set by repeating the option.
In the ini file, list the multiple addresses in one proxy(-read-only)-backend-addresses= separated by commas, like:

proxy-read-only-backend-addresses       = db-slave-1:3306, db-slave-2:3306, db-slave-3:3306, db-slave-4:3306

In general, if the option name is the plural, the above applies to it. If not, then that option is misnamed.
Should you find a case like that, we greatly appreciate a bug report.

I'm setting this to documenting because it is just an omission in the documentation.
[26 Feb 2010 16:36] MC Brown
I've added notes to the documentation on the format differences on the command line and config file, including explicit examples for this and read-only-backend-addresses.