<?xml version="1.0"?>
<instances>

        <!-- This instance maintains connections to the "master" MySQL database
                on the masterdb machine.  This instance only listens on the
                unix socket /tmp/master.socket and thus cannot be connected to
                by clients from another machine. -->
        <instance id="master" socket="/tmp/master.socket" dbase="mysql" connections="10">
                <users>
                        <user user="masteruser" password="masterpassword"/>
                </users>
                <connections>
                        <connection string="user=masteruser;password=masterpassword;host=masterdb;db=master;"/>
                </connections>
        </instance>


        <!-- This instance maintains connections to 4 "slave" MySQL databases
                on 4 slave machines.  This instance only listens on the unix
                socket /tmp/slave.socket and thus cannot be connected to by
                clients from another machine. -->
        <instance id="slave" socket="/tmp/slave.socket" dbase="mysql" connections="10">
                <users>
                        <user user="slaveuser" password="slavepassword"/>
                </users>
                <connections>
                        <connection string="user=slaveuser;password=slavepassword;host=slavedb1;db=slave;"/>
                        <connection string="user=slaveuser;password=slavepassword;host=slavedb2;db=slave;"/>
                        <connection string="user=slaveuser;password=slavepassword;host=slavedb3;db=slave;"/>
                        <connection string="user=slaveuser;password=slavepassword;host=slavedb3;db=slave;"/>
                </connections>
        </instance>


        <!-- This instance sends DML (insert,update,delete) and
                DDL (create/delete) queries to the "master" SQL Relay instance
                which, in turn, sends them to the "master" database.
                This instance sends any other queries to the "slave" SQL Relay
                instance which, in turn, distributes them over the "slave"
                databases. -->
        <instance id="router" dbase="router" connections="10">
                <users>
                        <user user="routeruser" password="routerpassword"/>
                </users>
                <router>
                        <!-- send all DML/DDL queries to "master"  -->
                        <route host="" port="" socket="/tmp/master.socket"
                                user="masteruser" password="masterpassword">
                                <query pattern="^drop "/>
                                <query pattern="^create "/>
                                <query pattern="^insert "/>
                                <query pattern="^update "/>
                                <query pattern="^delete "/>
                        </route>
                        <!-- send all other queries to "slave" -->
                        <route host="" port="" socket="/tmp/slave.socket"
                                user="slaveuser" password="slavepassword">
                                <query pattern=".*"/>
                        </route>
                </router>
        </instance>

</instances>