- Install VirtualBox
- Install Vagrant
- clone repository
- cd mysql-proxy-test
- vagrant up dbmaster
- vagrant up dbslave1
- vagrant up dbslave2
- vagrant up web
- vagrant ssh web
- cd /vagrant/test
- sh create_db.sh
- sh multi_test.sh
- mysql -hdbproxy -uadmin -padmin --port=4041
- select * from backends;
Run #12 multiple times to see the spread across db servers.
You'll see something like this:
mysql> select * from backends;
+-------------+---------------------+-------+------+------+-------------------+
| backend_ndx | address | state | type | uuid | connected_clients |
+-------------+---------------------+-------+------+------+-------------------+
| 1 | 192.168.35.102:3306 | up | rw | NULL | 2 |
| 2 | 192.168.35.103:3306 | up | ro | NULL | 5 |
| 3 | 192.168.35.104:3306 | up | ro | NULL | 5 |
+-------------+---------------------+-------+------+------+-------------------+
3 rows in set (0.01 sec)
More infromation about mysql-proxy read/write balancing can be found here: http://www.networkworld.com/article/2224080/opensource-subnet/simple-database-load-balancing-with-mysql-proxy.html