1 schema.xml配置文件
Balance属性
负载均称类型
0:不开启读写分离机制,所有读操作都发送到当前可用的writeHost上
1:全部的readHost与stand by writeHost参与select语句的负载均衡,简单的说,当双主双从模式(M1-S1,M2-S2 并且M1 M2互为主备),正常情况下,M2,S1,S2都参与select语句的负载均衡。
2:所有读操作都随机的在writeHost、readHost上分发
3:所有读请求随机的分发到writeHst对应的readHost执行,writeHost不负担读写压力。
SwitchType属性
-1不自动切换
1 默认值 自动切换
2 基于MySql主从同步的状态决定是否切换
心跳语句为 show slave status
3 基于mysql galary cluster 的切换机制(适合集群)1.4.1
心跳语句为 show status like 'wsrep%'
[root@mycat conf]# cat schema.xml
writeType="0" dbType="mysql" dbDriver="native" switchType="3" slaveThreshold="100">
show status like 'wsrep%'