MySQL5.7服务器IP是192.168.31.209及192.168.31.210
vi /usr/local/mycat/conf/schema.xml
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">
<schema name="TESTDB" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn1">
<table name="t6" primaryKey="id" type="global" dataNode="dn1,dn2"/>
</schema>
<dataNode name="dn1" dataHost="localhost1" database="test" />
<dataNode name="dn2" dataHost="localhost2" database="test" />
<dataHost name="localhost1" maxCon="1000" minCon="10" balance="1" writeType="0" dbType="mysql" dbDriver="native" switchType="1">
<heartbeat>select user()</heartbeat>
<writeHost host="db1" url="192.168.31.209:3306" user="root" password="123456">
<readHost host="db2" url="192.168.31.209:3308" user="root" password="123456" />
</writeHost>
<writeHost host="db3" url="192.168.31.210:3306" user="root" password="123456">
<readHost host="db4" url="192.168.31.210:3308" user="root" password="123456" />
</writeHost>
</dataHost>
<dataHost name="localhost2" maxCon="1000" minCon="10" balance="1" writeType="0" dbType="mysql" dbDriver="native" switchType="1">
<heartbeat>select user()</heartbeat>
<writeHost host="db1" url="192.168.31.210:3307" user="root" password="123456">
<readHost host="db2" url="192.168.31.210:3309" user="root" password="123456" />
</writeHost>
<writeHost host="db3" url="192.168.31.209:3307" user="root" password="123456">
<readHost host="db4" url="192.168.31.209:3309" user="root" password="123456" />
</writeHost>
</dataHost>
</mycat:schema>