schema.xml
<?xml version="1.0"?> <!DOCTYPE mycat:schema SYSTEM "schema.dtd"> <mycat:schema xmlns:mycat="http://io.mycat/"> <schema name="dsideal" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn1"></schema> <!--配置数据库节点--> <dataNode name="dn1" dataHost="localhost1" database="dsideal_db" /> <dataHost name="localhost1" maxCon="1000" minCon="10" balance="3" writeType="0" dbType="mysql" dbDriver="native" switchType="1" slaveThreshold="100"> <heartbeat>select user()</heartbeat> <writeHost host="hostM1" url="10.10.6.171:22066" user="root" password="123456"> <readHost host="hostS2" url="10.10.6.172:22066" user="root" password="123456" /> </writeHost> <!--主故障,顶替写节点,主正常是分担都读压力--> <!--<writeHost host="hostS1" url="localhost:3316" user="root" password="123456" />--> </dataHost> </mycat:schema>
server.xml(一部份)
<user name="root"> <property name="password">123456</property> <property name="schemas">dsideal</property> </user>