Authored by xuhongyun

增加各环境下配置文件

... ... @@ -459,28 +459,28 @@
<extraArgument>-Dcom.sun.management.jmxremote.authenticate=false </extraArgument>
<extraArgument>-Dcom.sun.management.jmxremote.ssl=false </extraArgument>
<extraArgument>-Xmx4G</extraArgument>
<extraArgument>-Xms1G</extraArgument>
<extraArgument>-Xms2G</extraArgument>
</extraArguments>
</jvmSettings>
<generatorConfigurations>
<generatorConfiguration>
<generator>jsw</generator>
<includes>
<include>aix-ppc-32</include>
<include>aix-ppc-64</include>
<include>hpux-parisc-64</include>
<include>linux-x86-32</include>
<!--<include>aix-ppc-32</include>-->
<!--<include>aix-ppc-64</include>-->
<!--<include>hpux-parisc-64</include>-->
<!--<include>linux-x86-32</include>-->
<include>linux-x86-64</include>
<include>linux-ppc-64</include>
<include>macosx-ppc-32</include>
<include>macosx-x86-universal-32</include>
<include>macosx-universal-32</include>
<include>macosx-universal-64</include>
<include>solaris-sparc-32</include>
<include>solaris-sparc-64</include>
<include>solaris-x86-32</include>
<include>windows-x86-32</include>
<include>windows-x86-64</include>
<!--<include>linux-ppc-64</include>-->
<!--<include>macosx-ppc-32</include>-->
<!--<include>macosx-x86-universal-32</include>-->
<!--<include>macosx-universal-32</include>-->
<!--<include>macosx-universal-64</include>-->
<!--<include>solaris-sparc-32</include>-->
<!--<include>solaris-sparc-64</include>-->
<!--<include>solaris-x86-32</include>-->
<!--<include>windows-x86-32</include>-->
<!--<include>windows-x86-64</include>-->
</includes>
<configuration>
... ... @@ -608,6 +608,37 @@
</plugin>
<plugin>
<!-- 默认使用本地的docker,远程时需要配置DOCKER_HOST环境变量-->
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>1.2.0</version>
<!--<executions>-->
<!--<execution>-->
<!--<id>build-image</id>-->
<!--<phase>package</phase>-->
<!--<goals>-->
<!--<goal>build</goal>-->
<!--</goals>-->
<!--</execution>-->
<!--</executions>-->
<configuration>
<imageName>mycat-server</imageName>
<imageTags>
<!--<imageTag>${project.version}-${timestamp}</imageTag>-->
<imageTag>latest</imageTag>
</imageTags>
<forceTags>true</forceTags>
<dockerDirectory>${project.basedir}/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.artifactId}-${project.version}-${timestamp}-linux.tar.gz</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
... ...
... ... @@ -65,8 +65,26 @@ RUN_CMD="\"$JAVA_HOME/bin/java\""
RUN_CMD="$RUN_CMD -DMYCAT_HOME=\"$MYCAT_HOME\""
RUN_CMD="$RUN_CMD -classpath \"$MYCAT_CLASSPATH\""
RUN_CMD="$RUN_CMD $JAVA_OPTS"
RUN_CMD="$RUN_CMD io.mycat.MycatStartup $@"
RUN_CMD="$RUN_CMD io.mycat.MycatShutdown $@"
RUN_CMD="$RUN_CMD >> \"$MYCAT_HOME/logs/console.log\" 2>&1 &"
echo $RUN_CMD
eval $RUN_CMD
#==============================================================================
### check all client connection closed
while true
do
CONN_NUM=`netstat -an|grep 8066|grep ESTA|wc -l`
if [ $CONN_NUM == "0" ]; then
echo "MYCAT Server has no connections."
break
fi
echo "MYCAT Server has ($CONN_NUM) connections waiting closed."
sleep 10
done
### stop server
PID=`${JAVA_HOME}/bin/jps -v|grep MycatStartup|grep MYCAT_HOME="$MYCAT_HOME"|awk -F' ' '{print $1}'`
eval "kill -9 ${PID}"
echo "MYCAT Server shutdown successfully."
\ No newline at end of file
... ...
#!/bin/sh
#check JAVA_HOME & java
noJavaHome=false
if [ -z "$JAVA_HOME" ] ; then
noJavaHome=true
fi
if [ ! -e "$JAVA_HOME/bin/java" ] ; then
noJavaHome=true
fi
if $noJavaHome ; then
echo
echo "Error: JAVA_HOME environment variable is not set."
echo
exit 1
fi
#==============================================================================
#set JAVA_OPTS
JAVA_OPTS="-server -Xms2G -Xmx2G -XX:MaxPermSize=64M -XX:+AggressiveOpts -XX:MaxDirectMemorySize=2G"
#JAVA_OPTS="-server -Xms4G -Xmx4G -XX:MaxPermSize=64M -XX:+AggressiveOpts -XX:MaxDirectMemorySize=6G"
#performance Options
JAVA_OPTS="$JAVA_OPTS -Xss256k"
JAVA_OPTS="$JAVA_OPTS -XX:+AggressiveOpts"
JAVA_OPTS="$JAVA_OPTS -XX:+UseBiasedLocking"
JAVA_OPTS="$JAVA_OPTS -XX:+UseFastAccessorMethods"
JAVA_OPTS="$JAVA_OPTS -XX:+DisableExplicitGC"
JAVA_OPTS="$JAVA_OPTS -XX:+UseParNewGC"
JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC"
JAVA_OPTS="$JAVA_OPTS -XX:+CMSParallelRemarkEnabled"
JAVA_OPTS="$JAVA_OPTS -XX:+UseCMSCompactAtFullCollection"
JAVA_OPTS="$JAVA_OPTS -XX:+UseCMSInitiatingOccupancyOnly"
JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=75"
JAVA_OPTS="$JAVA_OPTS -XX:CMSInitiatingOccupancyFraction=75"
#GC Log Options
#JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCApplicationStoppedTime"
#JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCTimeStamps"
#JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDetails"
#debug Options
#JAVA_OPTS="$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8065,server=y,suspend=n"
#==============================================================================
#set HOME
CURR_DIR=`pwd`
cd `dirname "$0"`/..
MYCAT_HOME=`pwd`
cd $CURR_DIR
if [ -z "$MYCAT_HOME" ] ; then
echo
echo "Error: MYCAT_HOME environment variable is not defined correctly."
echo
exit 1
fi
#==============================================================================
#set CLASSPATH
MYCAT_CLASSPATH="$MYCAT_HOME/conf:$MYCAT_HOME/lib/classes"
for i in "$MYCAT_HOME"/lib/*.jar
do
MYCAT_CLASSPATH="$MYCAT_CLASSPATH:$i"
done
#==============================================================================
#startup Server
RUN_CMD="\"$JAVA_HOME/bin/java\""
RUN_CMD="$RUN_CMD -DMYCAT_HOME=\"$MYCAT_HOME\""
RUN_CMD="$RUN_CMD -classpath \"$MYCAT_CLASSPATH\""
RUN_CMD="$RUN_CMD $JAVA_OPTS"
RUN_CMD="$RUN_CMD io.mycat.MycatStartup $@"
RUN_CMD="$RUN_CMD >> \"$MYCAT_HOME/logs/console.log\" 2>&1 &"
echo $RUN_CMD
eval $RUN_CMD
#==============================================================================
... ...
... ... @@ -23,6 +23,8 @@
*/
package io.mycat;
import io.mycat.zkcluster.MycatZkCluster;
import java.util.Date;
/**
... ... @@ -31,6 +33,12 @@ import java.util.Date;
public final class MycatShutdown {
public static void main(String[] args) {
// added by xuhongyun for zookeeper cluster
if (MycatZkCluster.getInstance().isCluster()) {
MycatZkCluster.getInstance().stop();
System.out.println("MyCAT Server stop cluster successfully.");
}
System.out.println(new Date() + ",server shutdown!");
}
... ...
... ... @@ -28,6 +28,7 @@ package io.mycat;
import java.text.SimpleDateFormat;
import java.util.Date;
import io.mycat.zkcluster.MycatZkCluster;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
... ... @@ -55,6 +56,13 @@ public final class MycatStartup {
// startup
server.startup();
// added by xuhongyun for: zookeeper cluster
if ( MycatZkCluster.getInstance().isCluster() ) {
MycatZkCluster.getInstance().start();
System.out.println("MyCAT Server start cluster mode successfully.");
}
System.out.println("MyCAT Server startup successfully. see logs in logs/mycat.log");
} catch (Exception e) {
... ...
... ... @@ -32,7 +32,7 @@ public abstract class Versions {
public static final byte PROTOCOL_VERSION = 10;
/**服务器版本**/
public static byte[] SERVER_VERSION = "5.6.29-mycat-1.6.5-release-20181127165636".getBytes();
public static byte[] SERVER_VERSION = "5.6.29-mycat-1.6.5-release-20190313140641".getBytes();
public static void setServerVersion(String version) {
byte[] mysqlVersionPart = version.getBytes();
... ...
... ... @@ -116,10 +116,13 @@ public class XMLSchemaLoader implements SchemaLoader {
Element root = ConfigUtil.getDocument(dtd, xml).getDocumentElement();
//先加载所有的DataHost
loadDataHosts(root);
LOGGER.info("load data hosts success.");
//再加载所有的DataNode
loadDataNodes(root);
LOGGER.info("load data nodes success.");
//最后加载所有的Schema
loadSchemas(root);
LOGGER.info("load schemas success.");
} catch (ConfigException e) {
throw e;
} catch (Exception e) {
... ...
package io.mycat.util;
import java.net.*;
import java.util.Enumeration;
/**
* Created by xueyin on 2018/11/29.
*/
public class IPUtil {
/**
* 注意本方法不支持多网卡时获取IP地址
*/
public static String fetchLocalIP() {
String localIP = "127.0.0.1";
DatagramSocket sock = null;
try {
SocketAddress socket_addr = new InetSocketAddress(InetAddress.getByName("1.2.3.4"), 1);
sock = new DatagramSocket();
sock.connect(socket_addr);
localIP = sock.getLocalAddress().getHostAddress();
} catch (Exception e) {
e.printStackTrace();
} finally {
sock.disconnect();
sock.close();
sock = null;
}
return localIP;
}
public static String fetchIpByHost(String host) {
try {
InetAddress address = InetAddress.getByName(host);
return address.getHostAddress();
} catch (UnknownHostException e) {
e.printStackTrace();
}
return "";
}
public static void main(String[] args) {
// String ip = IPUtil.fetchIpByHost("www.baidu.com");
String ip = IPUtil.fetchLocalIP();
System.out.println(ip);
}
}
... ...
package io.mycat.zkcluster;
import com.alibaba.fastjson.JSON;
import io.mycat.MycatServer;
import io.mycat.util.IPUtil;
import io.mycat.util.StringUtil;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.zookeeper.CreateMode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.TimeUnit;
/**
* Created by xueyin on 2018/11/27.
* yoho集群实现方式: mycat通过向zk注册自己的方式加入到cluster
* 应用层通过多数据源方式来实现集群
*/
public class MycatZkCluster {
private static final Logger LOGGER = LoggerFactory.getLogger(MycatZkCluster.class);
private static final String CLUSTER_PATH_BASE = "/yoho-cobar";
private static MycatZkCluster ZK_CLUSTER_INSTANCE = new MycatZkCluster();
private CuratorFramework curatorFramework = null;
private class MycatClusterNode {
String serverIP;
int serverPort;
int type;
private MycatClusterNode(String serverIP, int serverPort, int type) {
this.serverIP = serverIP;
this.serverPort = serverPort;
this.type = type;
}
}
private MycatClusterNode mycatClusterNode;
private MycatZkCluster() {
mycatClusterNode = new MycatClusterNode(IPUtil.fetchLocalIP(),
MycatServer.getInstance().getConfig().getSystem().getServerPort(),
0);
}
public static MycatZkCluster getInstance() {
return ZK_CLUSTER_INSTANCE;
}
public boolean isCluster() {
return ZkClusterConfig.getInstance().getClusterMode();
}
public void start() {
LOGGER.info("begin start mycat cluster success.");
if (!ZkClusterConfig.getInstance().getClusterMode()) {
LOGGER.warn("mycat running on standalone mode.");
return;
}
regitClusterNode(mycatClusterNode);
LOGGER.info("start mycat cluster success.");
}
public void stop() {
LOGGER.info("begin stop mycat cluster success.");
// 从zk上删除注册信息
unregitClusterNode(mycatClusterNode);
// 检查客户端检查数是否全部关闭
LOGGER.info("start mycat cluster success.");
}
private void regitClusterNode(MycatClusterNode node) {
// 创建zk连接
curatorFramework = createZKConnect();
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
if (curatorFramework != null) {
curatorFramework.close();
}
}
}));
// 创建cluster node
String nodePath = buildClusterNodePath(node);
String nodeData = buildClusterNodeData(node);
try {
if (curatorFramework.checkExists().forPath(nodePath) != null) {
curatorFramework.delete().deletingChildrenIfNeeded().forPath(nodePath);
}
curatorFramework.create()
.creatingParentsIfNeeded()
.withMode(CreateMode.EPHEMERAL)
.forPath(nodePath, StringUtil.encode(nodeData, "uft-8"));
} catch (Exception e) {
LOGGER.error("cluster registe to zookeeper fail. ", e);
throw new RuntimeException("cluster registe to zookeeper fail.");
}
}
private CuratorFramework createZKConnect() {
String zkUrl = ZkClusterConfig.getInstance().getZkUrl();
CuratorFramework curatorFramework = CuratorFrameworkFactory.builder()
.connectString(zkUrl)
.connectionTimeoutMs(3000)
.sessionTimeoutMs(5000)
.retryPolicy(new ExponentialBackoffRetry(100, 6))
.build();
curatorFramework.start();
try {
curatorFramework.blockUntilConnected(5, TimeUnit.SECONDS);
if (curatorFramework.getZookeeperClient().isConnected()) {
return curatorFramework;
}
}
catch (InterruptedException e) {
LOGGER.error("cluser connect zk exception.", e);
}
curatorFramework.close();
throw new RuntimeException("mycat zkcluster create connect fail.");
}
private void unregitClusterNode(MycatClusterNode node) {
if (curatorFramework == null) {
return;
}
String clusterPath = buildClusterNodePath(node);
try {
if (curatorFramework.checkExists().forPath(clusterPath) != null) {
curatorFramework.delete().deletingChildrenIfNeeded().forPath(clusterPath);
}
curatorFramework.close();
curatorFramework = null;
} catch (Exception e) {
LOGGER.error("cluster unregist to zookeeper fail.", e);
}
}
private String buildClusterNodePath(MycatClusterNode node) {
return CLUSTER_PATH_BASE + "/" + ZkClusterConfig.getInstance().getClusterName() +"/" + node.serverIP + ":" + node.serverPort;
}
private String buildClusterNodeData(MycatClusterNode node) {
return JSON.toJSONString(node);
}
}
... ...
package io.mycat.zkcluster;
import com.google.common.base.Strings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.Properties;
/**
* Created by xueyin on 2018/11/29.
* 集群配置, 对应文件cluster.properties
*/
public class ZkClusterConfig {
private static final Logger LOGGER = LoggerFactory.getLogger(ZkClusterConfig.class);
private static final String CONIFG_FILE = "/cluster.properties";
private static final String CLUSTER_MODE = "clusterMode";
private static final String CLUSTER_NAME = "clusterName";
private static final String ZK_URL = "zkUrl";
// 默认不开启集群模式
public static final boolean DEFAULT_CLUSTER_MODE = false;
// 默认集群名称为front
public static final String DEFAULT_CLUSTER_NAME = "front";
private Boolean clusterMode = false;
private String clusterName = "front";
private String zkUrl = "";
private static ZkClusterConfig CFG_INSTANCE = new ZkClusterConfig();
public ZkClusterConfig() {
loadConfig();
}
public static ZkClusterConfig getInstance() {
return CFG_INSTANCE;
}
public Boolean getClusterMode() {
return clusterMode;
}
public String getClusterName() {
return clusterName;
}
public String getZkUrl() {
return zkUrl;
}
private void loadConfig() {
Properties properties = new Properties();
try {
properties.load(ZkClusterConfig.class.getResourceAsStream(CONIFG_FILE));
} catch (IOException e) {
LOGGER.error("clusterConfig load fail: ", e);
throw new RuntimeException("load cluster config file fail.");
}
String mode = properties.getProperty(CLUSTER_MODE);
String name = properties.getProperty(CLUSTER_NAME);
String url = properties.getProperty(ZK_URL);
if ( Strings.isNullOrEmpty(mode) || Boolean.valueOf(mode) == null) {
LOGGER.error("invalid cluster mode config: ", mode);
throw new RuntimeException("invalid cluster mode config.");
}
Boolean bMode = Boolean.valueOf(mode);
if (bMode == true
&& (Strings.isNullOrEmpty(name)
|| Strings.isNullOrEmpty(url))) {
LOGGER.error("invalid cluster name or zkurl config.");
throw new RuntimeException("invalid cluster name or zkurl config.");
}
this.clusterMode = bMode;
this.clusterName = name;
this.zkUrl = url;
}
}
... ...
clusterMode=false
clusterName=front
#zkUrl=zk01.yohoops.org:2181,zk02.yohoops.org:2181,zk03.yohoops.org:2181,zk04.yohoops.org:2181,zk05.yohoops.org:2181
zkUrl=zk01.yohoops.org:2181
\ No newline at end of file
... ...
... ... @@ -9,17 +9,17 @@
under the License. -->
<!DOCTYPE mycat:rule SYSTEM "rule.dtd">
<mycat:rule xmlns:mycat="http://io.mycat/">
<tableRule name="rule1">
<tableRule name="rule_promt">
<rule>
<columns>id</columns>
<algorithm>func1</algorithm>
<columns>uid</columns>
<algorithm>rule_func1</algorithm>
</rule>
</tableRule>
<tableRule name="rule2">
<tableRule name="rule_order">
<rule>
<columns>user_id</columns>
<algorithm>func1</algorithm>
<columns>uid</columns>
<algorithm>rule_func1</algorithm>
</rule>
</tableRule>
... ... @@ -65,14 +65,12 @@
<algorithm>latestMonth</algorithm>
</rule>
</tableRule>
<tableRule name="auto-sharding-rang-mod">
<rule>
<columns>id</columns>
<algorithm>rang-mod</algorithm>
</rule>
</tableRule>
<tableRule name="jch">
<rule>
<columns>id</columns>
... ... @@ -107,9 +105,9 @@
<property name="count">3</property>
</function>
<function name="func1" class="io.mycat.route.function.PartitionByLong">
<property name="partitionCount">8</property>
<property name="partitionLength">128</property>
<function name="rule_func1" class="io.mycat.route.function.PartitionByLong">
<property name="partitionCount">4</property>
<property name="partitionLength">256</property>
</function>
<function name="latestMonth"
class="io.mycat.route.function.LatestMonthPartion">
... ...
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">
<schema name="TESTDB" checkSQLschema="false" sqlMaxLimit="100">
<!-- auto sharding by id (long) -->
<table name="travelrecord" dataNode="dn1,dn2,dn3" rule="auto-sharding-long" />
<!-- global table is auto cloned to all defined data nodes ,so can join
with any table whose sharding node is in the same data node -->
<table name="company" primaryKey="ID" type="global" dataNode="dn1,dn2,dn3" />
<table name="goods" primaryKey="ID" type="global" dataNode="dn1,dn2" />
<!-- random sharding using mod sharind rule -->
<table name="hotnews" primaryKey="ID" autoIncrement="true" dataNode="dn1,dn2,dn3"
rule="mod-long" />
<!-- <table name="dual" primaryKey="ID" dataNode="dnx,dnoracle2" type="global"
needAddLimit="false"/> <table name="worker" primaryKey="ID" dataNode="jdbc_dn1,jdbc_dn2,jdbc_dn3"
rule="mod-long" /> -->
<table name="employee" primaryKey="ID" dataNode="dn1,dn2"
rule="sharding-by-intfile" />
<table name="customer" primaryKey="ID" dataNode="dn1,dn2"
rule="sharding-by-intfile">
<childTable name="orders" primaryKey="ID" joinKey="customer_id"
parentKey="id">
<childTable name="order_items" joinKey="order_id"
parentKey="id" />
</childTable>
<childTable name="customer_addr" primaryKey="ID" joinKey="customer_id"
parentKey="id" />
</table>
<!-- <table name="oc_call" primaryKey="ID" dataNode="dn1$0-743" rule="latest-month-calldate"
/> -->
</schema>
<!-- <dataNode name="dn1$0-743" dataHost="localhost1" database="db$0-743"
/> -->
<dataNode name="dn1" dataHost="localhost1" database="db1" />
<dataNode name="dn2" dataHost="localhost1" database="db2" />
<dataNode name="dn3" dataHost="localhost1" database="db3" />
<!--<dataNode name="dn4" dataHost="sequoiadb1" database="SAMPLE" />
<dataNode name="jdbc_dn1" dataHost="jdbchost" database="db1" />
<dataNode name="jdbc_dn2" dataHost="jdbchost" database="db2" />
<dataNode name="jdbc_dn3" dataHost="jdbchost" database="db3" /> -->
<dataHost name="localhost1" maxCon="1000" minCon="10" balance="0"
writeType="0" dbType="mysql" dbDriver="native" switchType="1" slaveThreshold="100">
<heartbeat>select user()</heartbeat>
<!-- can have multi write hosts -->
<writeHost host="hostM1" url="localhost:3306" user="root"
password="123456">
<!-- can have multi read hosts -->
<readHost host="hostS2" url="192.168.1.200:3306" user="root" password="xxx" />
</writeHost>
<writeHost host="hostS1" url="localhost:3316" user="root"
password="123456" />
<!-- <writeHost host="hostM2" url="localhost:3316" user="root" password="123456"/> -->
</dataHost>
<!--
<dataHost name="sequoiadb1" maxCon="1000" minCon="1" balance="0" dbType="sequoiadb" dbDriver="jdbc">
<heartbeat> </heartbeat>
<writeHost host="hostM1" url="sequoiadb://1426587161.dbaas.sequoialab.net:11920/SAMPLE" user="jifeng" password="jifeng"></writeHost>
</dataHost>
<dataHost name="oracle1" maxCon="1000" minCon="1" balance="0" writeType="0" dbType="oracle" dbDriver="jdbc"> <heartbeat>select 1 from dual</heartbeat>
<connectionInitSql>alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss'</connectionInitSql>
<writeHost host="hostM1" url="jdbc:oracle:thin:@127.0.0.1:1521:nange" user="base" password="123456" > </writeHost> </dataHost>
<dataHost name="jdbchost" maxCon="1000" minCon="1" balance="0" writeType="0" dbType="mongodb" dbDriver="jdbc">
<heartbeat>select user()</heartbeat>
<writeHost host="hostM" url="mongodb://192.168.0.99/test" user="admin" password="123456" ></writeHost> </dataHost>
<dataHost name="sparksql" maxCon="1000" minCon="1" balance="0" dbType="spark" dbDriver="jdbc">
<heartbeat> </heartbeat>
<writeHost host="hostM1" url="jdbc:hive2://feng01:10000" user="jifeng" password="jifeng"></writeHost> </dataHost> -->
<!-- <dataHost name="jdbchost" maxCon="1000" minCon="10" balance="0" dbType="mysql"
dbDriver="jdbc"> <heartbeat>select user()</heartbeat> <writeHost host="hostM1"
url="jdbc:mysql://localhost:3306" user="root" password="123456"> </writeHost>
</dataHost> -->
</mycat:schema>
\ No newline at end of file
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">
<!-- schema定义 -->
<schema name="yhb_promotion_split" checkSQLschema="false" sqlMaxLimit="100">
<table name="coupons_logs" dataNode="dn_promt_split$1-4" rule="rule_promt" />
<table name="coupons_logs_third_info" dataNode="dn_promt_split$1-4" rule="rule_promt" />
<table name="coupons_personal" dataNode="dn_promt_split$1-4" rule="rule_promt" />
<table name="coupons" dataNode="dn_promt_split$1-4" type="global" />
<table name="coupons_logs_custom_type" dataNode="dn_promt_split$1-4" rule="rule_promt" />
<table name="coupons_bag" dataNode="dn_promt_split$1-4" rule="rule_promt" />
</schema>
<schema name="yh_orders_split" checkSQLschema="false" sqlMaxLimit="100">
<table name="shopping_cart" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="shopping_cart_items" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="orders" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="orders_goods" dataNode="dn_order_split$1-4" rule="rule_order" ruleRequired="true" />
<table name="orders_coupons" dataNode="dn_order_split$1-4" rule="rule_order" ruleRequired="true" />
<table name="order_promotion_info" dataNode="dn_order_split$1-4" rule="rule_order" ruleRequired="true" />
<table name="order_ext_attribute" dataNode="dn_order_split$1-4" rule="rule_order" ruleRequired="true" />
<table name="orders_meta" dataNode="dn_order_split$1-4" rule="rule_order" ruleRequired="true" />
<table name="crf_pay_log" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="cmb_netpay_bind" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="order_code_sequence" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="free_shipping_times" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="orders_pay" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="wx_pay_action" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="order_message" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="order_profile" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="orders_pre_pay" dataNode="dn_order_nosplit" />
<table name="order_pay" dataNode="dn_order_nosplit" />
<table name="order_default_preferences" dataNode="dn_order_nosplit" />
<table name="order_cancel" dataNode="dn_order_nosplit" />
</schema>
<!-- cms -->
<schema name="yh_resource" dataNode="dn_yh_resource" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_operations" dataNode="dn_yh_operations" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_setting" dataNode="dn_yh_setting" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_helper" dataNode="dn_yh_helper" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yoho_activity" dataNode="dn_yoho_activity" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_events" dataNode="dn_yh_events" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yhb_operations" dataNode="dn_yhb_operations" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_guang" dataNode="dn_yh_guang" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_wechat" dataNode="dn_yh_wechat" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_lottery" dataNode="dn_yh_lottery" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="q_msg_system" dataNode="dn_q_msg_system" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_consult" dataNode="dn_yh_consult" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_comment" dataNode="dn_yh_comment" checkSQLschema="false" sqlMaxLimit="100" />
<!-- passport -->
<schema name="yh_passport" dataNode="dn_yh_passport" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yoho_passport" dataNode="dn_yoho_passport" checkSQLschema="false" sqlMaxLimit="100" />
<!-- order -->
<schema name="yh_coupons" dataNode="dn_yh_coupons" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_orders" dataNode="dn_yh_orders" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yhb_promotion" dataNode="dn_yhb_promotion" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yoho_pay" dataNode="dn_yoho_pay" checkSQLschema="false" sqlMaxLimit="100" />
<!-- shops -->
<schema name="yh_shops" dataNode="dn_yh_shops" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yhb_shops" dataNode="dn_yhb_shops" checkSQLschema="false" sqlMaxLimit="100" />
<!-- yohood -->
<schema name="yohood" dataNode="dn_yohood" checkSQLschema="false" sqlMaxLimit="100" />
<!-- store -->
<schema name="yh_extendstore" dataNode="dn_yh_extendstore" checkSQLschema="false" sqlMaxLimit="100" />
<!-- unions -->
<schema name="yh_unions" dataNode="dn_yh_unions" checkSQLschema="false" sqlMaxLimit="100" />
<!-- uic -->
<schema name="yh_community" dataNode="dn_yh_community" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_inbox" dataNode="dn_yh_inbox" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yoho_sms" dataNode="dn_yoho_sms" checkSQLschema="false" sqlMaxLimit="100" />
<!-- yohobuylogs -->
<schema name="yohobuy_logs" dataNode="dn_yohobuy_logs" checkSQLschema="false" sqlMaxLimit="100" />
<dataNode name="dn_promt_split1" dataHost="dh_promt_split1" database="yhb_promotion" />
<dataNode name="dn_promt_split2" dataHost="dh_promt_split2" database="yhb_promotion" />
<dataNode name="dn_promt_split3" dataHost="dh_promt_split3" database="yhb_promotion" />
<dataNode name="dn_promt_split4" dataHost="dh_promt_split4" database="yhb_promotion" />
<dataNode name="dn_order_split1" dataHost="dh_orders_split1" database="yh_orders" />
<dataNode name="dn_order_split2" dataHost="dh_orders_split2" database="yh_orders" />
<dataNode name="dn_order_split3" dataHost="dh_orders_split3" database="yh_orders" />
<dataNode name="dn_order_split4" dataHost="dh_orders_split4" database="yh_orders" />
<dataNode name="dn_order_nosplit" dataHost="dh_order_nosplit" database="yh_orders" />
<dataNode name="dn_yh_coupons" dataHost="dh_order_nosplit" database="yh_coupons" />
<dataNode name="dn_yh_orders" dataHost="dh_order_nosplit" database="yh_orders" />
<dataNode name="dn_yhb_promotion" dataHost="dh_order_nosplit" database="yhb_promotion" />
<dataNode name="dn_yoho_pay" dataHost="dh_order_nosplit" database="yoho_pay" />
<dataNode name="dn_yh_resource" dataHost="dh_cms" database="yh_resource" />
<dataNode name="dn_yh_operations" dataHost="dh_cms" database="yh_operations" />
<dataNode name="dn_yh_setting" dataHost="dh_cms" database="yh_setting" />
<dataNode name="dn_yh_helper" dataHost="dh_cms" database="yh_helper" />
<dataNode name="dn_yoho_activity" dataHost="dh_cms" database="yoho_activity" />
<dataNode name="dn_yh_events" dataHost="dh_cms" database="yh_events" />
<dataNode name="dn_yhb_operations" dataHost="dh_cms" database="yhb_operations" />
<dataNode name="dn_yh_guang" dataHost="dh_cms" database="yh_guang" />
<dataNode name="dn_yh_wechat" dataHost="dh_cms" database="yh_wechat" />
<dataNode name="dn_yh_lottery" dataHost="dh_cms" database="yh_lottery" />
<dataNode name="dn_q_msg_system" dataHost="dh_cms" database="q_msg_system" />
<dataNode name="dn_yh_consult" dataHost="dh_cms" database="yh_consult" />
<dataNode name="dn_yh_comment" dataHost="dh_cms" database="yh_comment" />
<dataNode name="dn_yh_passport" dataHost="dh_passport" database="yh_passport" />
<dataNode name="dn_yoho_passport" dataHost="dh_passport" database="yoho_passport" />
<dataNode name="dn_yh_shops" dataHost="dh_shops" database="yh_shops" />
<dataNode name="dn_yhb_shops" dataHost="dh_shops" database="yhb_shops" />
<dataNode name="dn_yohood" dataHost="dh_yohood" database="yohood" />
<dataNode name="dn_yh_extendstore" dataHost="dh_yh_extendstore" database="yh_extendstore" />
<dataNode name="dn_yh_unions" dataHost="dh_yh_unions" database="yh_unions" />
<dataNode name="dn_yh_community" dataHost="dh_uic" database="yh_community" />
<dataNode name="dn_yh_inbox" dataHost="dh_message" database="yh_inbox" />
<dataNode name="dn_yoho_sms" dataHost="dh_message" database="yoho_sms" />
<dataNode name="dn_yohobuy_logs" dataHost="dh_yohobuy_logs" database="yohobuy_logs" />
<!-- balance=0 不开启读写分离 balance=1读操作在主备和读库上执行 balance=2 读操作在写库和读库随机分布 blance=3 读操作只在读库上分布 -->
<!-- promotion 分库分表-->
<dataHost name="dh_promt_split1" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="promotW1" url="write1.promotion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="promotR1" url="read1.promotion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_promt_split2" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="promotW2" url="write2.promotion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="promotR2" url="read2.promotion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_promt_split3" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="promotW3" url="write3.promotion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="promotR3" url="read3.promotion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_promt_split4" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="promotW4" url="write4.promotion.yohoops.org:3307" password="yh_test" user="yh_vpc_bak">
<readHost host="promotR4" url="read4.promotion.yohoops.org:3307" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<!-- orders分库分表-->
<dataHost name="dh_orders_split1" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="ordersSplitW1" url="write1.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="ordersSplitR1" url="read1.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_orders_split2" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="ordersSplitW2" url="write2.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="ordersSplitR2" url="read2.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_orders_split3" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="ordersSplitW3" url="write3.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="ordersSplitR3" url="read3.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_orders_split4" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="ordersSplitW4" url="write4.orders.yohoops.org:3307" password="yh_test" user="yh_vpc_bak">
<readHost host="ordersSplitR4" url="read4.orders.yohoops.org:3307" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<!-- orders 未拆分库 -->
<dataHost name="dh_order_nosplit" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="ordersNosplitW1" url="write.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="ordersNosplitR1" url="read.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_cms" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="cmsW1" url="write.cms.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="cmsR1" url="read.cms.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_passport" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="passportW1" url="write.passport.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="passportR1" url="read.passport.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_shops" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="shopsW1" url="write.shops.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="shopsR1" url="read.shops.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_yohood" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="yohoodW1" url="write.yohood.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="yohoodR1" url="read.yohood.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_yh_extendstore" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="yhExtendstoreW1" url="write.store.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="yhExtendstoreR1" url="read.store.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_yh_unions" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="unionsW1" url="write.yhUnion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="unionsR1" url="read.yhUnion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_uic" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="uicW1" url="write.uic.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="uicR1" url="read.uic.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_message" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="messageW1" url="write.message.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="messageR1" url="read.message.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_yohobuy_logs" maxCon="50" minCon="10" balance="3" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="yohobuyLogsW1" url="yohologs.yohoops:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="yohobuyLogsR1" url="yohologs.yohoops:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
</mycat:schema>
\ No newline at end of file
... ...
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">
<!-- schema定义 -->
<schema name="yhb_promotion_split" checkSQLschema="false" sqlMaxLimit="100">
<table name="coupons_logs" dataNode="dn_promt_split$1-4" rule="rule_promt" />
<table name="coupons_logs_third_info" dataNode="dn_promt_split$1-4" rule="rule_promt" />
<table name="coupons_personal" dataNode="dn_promt_split$1-4" rule="rule_promt" />
<table name="coupons" dataNode="dn_promt_split$1-4" type="global" />
<table name="coupons_logs_custom_type" dataNode="dn_promt_split$1-4" rule="rule_promt" />
<table name="coupons_bag" dataNode="dn_promt_split$1-4" rule="rule_promt" />
</schema>
<schema name="yh_orders_split" checkSQLschema="false" sqlMaxLimit="100">
<table name="shopping_cart" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="shopping_cart_items" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="orders" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="orders_goods" dataNode="dn_order_split$1-4" rule="rule_order" ruleRequired="true" />
<table name="orders_coupons" dataNode="dn_order_split$1-4" rule="rule_order" ruleRequired="true" />
<table name="order_promotion_info" dataNode="dn_order_split$1-4" rule="rule_order" ruleRequired="true" />
<table name="order_ext_attribute" dataNode="dn_order_split$1-4" rule="rule_order" ruleRequired="true" />
<table name="orders_meta" dataNode="dn_order_split$1-4" rule="rule_order" ruleRequired="true" />
<table name="crf_pay_log" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="cmb_netpay_bind" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="order_code_sequence" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="free_shipping_times" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="orders_pay" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="wx_pay_action" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="order_message" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="order_profile" dataNode="dn_order_split$1-4" rule="rule_order" />
<table name="orders_pre_pay" dataNode="dn_order_nosplit" />
<table name="order_pay" dataNode="dn_order_nosplit" />
<table name="order_default_preferences" dataNode="dn_order_nosplit" />
<table name="order_cancel" dataNode="dn_order_nosplit" />
</schema>
<!-- cms -->
<schema name="yh_resource" dataNode="dn_yh_resource" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_operations" dataNode="dn_yh_operations" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_setting" dataNode="dn_yh_setting" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_helper" dataNode="dn_yh_helper" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yoho_activity" dataNode="dn_yoho_activity" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_events" dataNode="dn_yh_events" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yhb_operations" dataNode="dn_yhb_operations" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_guang" dataNode="dn_yh_guang" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_wechat" dataNode="dn_yh_wechat" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_lottery" dataNode="dn_yh_lottery" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="q_msg_system" dataNode="dn_q_msg_system" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_consult" dataNode="dn_yh_consult" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_comment" dataNode="dn_yh_comment" checkSQLschema="false" sqlMaxLimit="100" />
<!-- passport -->
<schema name="yh_passport" dataNode="dn_yh_passport" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yoho_passport" dataNode="dn_yoho_passport" checkSQLschema="false" sqlMaxLimit="100" />
<!-- order -->
<schema name="yh_coupons" dataNode="dn_yh_coupons" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_orders" dataNode="dn_yh_orders" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yhb_promotion" dataNode="dn_yhb_promotion" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yoho_pay" dataNode="dn_yoho_pay" checkSQLschema="false" sqlMaxLimit="100" />
<!-- shops -->
<schema name="yh_shops" dataNode="dn_yh_shops" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yhb_shops" dataNode="dn_yhb_shops" checkSQLschema="false" sqlMaxLimit="100" />
<!-- yohood -->
<schema name="yohood" dataNode="dn_yohood" checkSQLschema="false" sqlMaxLimit="100" />
<!-- store -->
<schema name="yh_extendstore" dataNode="dn_yh_extendstore" checkSQLschema="false" sqlMaxLimit="100" />
<!-- unions -->
<schema name="yh_unions" dataNode="dn_yh_unions" checkSQLschema="false" sqlMaxLimit="100" />
<!-- uic -->
<schema name="yh_community" dataNode="dn_yh_community" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_inbox" dataNode="dn_yh_inbox" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yoho_sms" dataNode="dn_yoho_sms" checkSQLschema="false" sqlMaxLimit="100" />
<!-- yohobuylogs -->
<schema name="yohobuy_logs" dataNode="dn_yohobuy_logs" checkSQLschema="false" sqlMaxLimit="100" />
<dataNode name="dn_promt_split1" dataHost="dh_promt_split1" database="yhb_promotion" />
<dataNode name="dn_promt_split2" dataHost="dh_promt_split2" database="yhb_promotion" />
<dataNode name="dn_promt_split3" dataHost="dh_promt_split3" database="yhb_promotion" />
<dataNode name="dn_promt_split4" dataHost="dh_promt_split4" database="yhb_promotion" />
<dataNode name="dn_order_split1" dataHost="dh_orders_split1" database="yh_orders" />
<dataNode name="dn_order_split2" dataHost="dh_orders_split2" database="yh_orders" />
<dataNode name="dn_order_split3" dataHost="dh_orders_split3" database="yh_orders" />
<dataNode name="dn_order_split4" dataHost="dh_orders_split4" database="yh_orders" />
<dataNode name="dn_order_nosplit" dataHost="dh_order_nosplit" database="yh_orders" />
<dataNode name="dn_yh_coupons" dataHost="dh_order_nosplit" database="yh_coupons" />
<dataNode name="dn_yh_orders" dataHost="dh_order_nosplit" database="yh_orders" />
<dataNode name="dn_yhb_promotion" dataHost="dh_order_nosplit" database="yhb_promotion" />
<dataNode name="dn_yoho_pay" dataHost="dh_order_nosplit" database="yoho_pay" />
<dataNode name="dn_yh_resource" dataHost="dh_cms" database="yh_resource" />
<dataNode name="dn_yh_operations" dataHost="dh_cms" database="yh_operations" />
<dataNode name="dn_yh_setting" dataHost="dh_cms" database="yh_setting" />
<dataNode name="dn_yh_helper" dataHost="dh_cms" database="yh_helper" />
<dataNode name="dn_yoho_activity" dataHost="dh_cms" database="yoho_activity" />
<dataNode name="dn_yh_events" dataHost="dh_cms" database="yh_events" />
<dataNode name="dn_yhb_operations" dataHost="dh_cms" database="yhb_operations" />
<dataNode name="dn_yh_guang" dataHost="dh_cms" database="yh_guang" />
<dataNode name="dn_yh_wechat" dataHost="dh_cms" database="yh_wechat" />
<dataNode name="dn_yh_lottery" dataHost="dh_cms" database="yh_lottery" />
<dataNode name="dn_q_msg_system" dataHost="dh_cms" database="q_msg_system" />
<dataNode name="dn_yh_consult" dataHost="dh_cms" database="yh_consult" />
<dataNode name="dn_yh_comment" dataHost="dh_cms" database="yh_comment" />
<dataNode name="dn_yh_passport" dataHost="dh_passport" database="yh_passport" />
<dataNode name="dn_yoho_passport" dataHost="dh_passport" database="yoho_passport" />
<dataNode name="dn_yh_shops" dataHost="dh_shops" database="yh_shops" />
<dataNode name="dn_yhb_shops" dataHost="dh_shops" database="yhb_shops" />
<dataNode name="dn_yohood" dataHost="dh_yohood" database="yohood" />
<dataNode name="dn_yh_extendstore" dataHost="dh_yh_extendstore" database="yh_extendstore" />
<dataNode name="dn_yh_unions" dataHost="dh_yh_unions" database="yh_unions" />
<dataNode name="dn_yh_community" dataHost="dh_uic" database="yh_community" />
<dataNode name="dn_yh_inbox" dataHost="dh_message" database="yh_inbox" />
<dataNode name="dn_yoho_sms" dataHost="dh_message" database="yoho_sms" />
<dataNode name="dn_yohobuy_logs" dataHost="dh_yohobuy_logs" database="yohobuy_logs" />
<!-- balance=0 不开启读写分离 balance=1读操作在主备和读库上执行 balance=2 读操作在写库和读库随机分布 blance=3 读操作只在读库上分布 -->
<!-- promotion 分库分表-->
<dataHost name="dh_promt_split1" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="promotW1" url="write1.promotion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="promotR1" url="read1.promotion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_promt_split2" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="promotW2" url="write2.promotion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="promotR2" url="read2.promotion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_promt_split3" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="promotW3" url="write3.promotion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="promotR3" url="read3.promotion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_promt_split4" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="promotW4" url="write4.promotion.yohoops.org:3307" password="yh_test" user="yh_vpc_bak">
<readHost host="promotR4" url="read4.promotion.yohoops.org:3307" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<!-- orders分库分表-->
<dataHost name="dh_orders_split1" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="ordersSplitW1" url="write1.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="ordersSplitR1" url="read1.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_orders_split2" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="ordersSplitW2" url="write2.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="ordersSplitR2" url="read2.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_orders_split3" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="ordersSplitW3" url="write3.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="ordersSplitR3" url="read3.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_orders_split4" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="ordersSplitW4" url="write4.orders.yohoops.org:3307" password="yh_test" user="yh_vpc_bak">
<readHost host="ordersSplitR4" url="read4.orders.yohoops.org:3307" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<!-- orders 未拆分库 -->
<dataHost name="dh_order_nosplit" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="ordersNosplitW1" url="write.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="ordersNosplitR1" url="read.orders.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_cms" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="cmsW1" url="write.cms.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="cmsR1" url="read.cms.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_passport" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="passportW1" url="write.passport.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="passportR1" url="read.passport.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_shops" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="shopsW1" url="write.shops.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="shopsR1" url="read.shops.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_yohood" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="yohoodW1" url="write.yohood.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="yohoodR1" url="read.yohood.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_yh_extendstore" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="yhExtendstoreW1" url="write.store.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="yhExtendstoreR1" url="read.store.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_yh_unions" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="unionsW1" url="write.yhUnion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="unionsR1" url="read.yhUnion.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_uic" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="uicW1" url="write.uic.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="uicR1" url="read.uic.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_message" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="messageW1" url="write.message.yohoops.org:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="messageR1" url="read.message.yohoops.org:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
<dataHost name="dh_yohobuy_logs" maxCon="50" minCon="10" balance="2" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost host="yohobuyLogsW1" url="yohologs.yohoops:3306" password="yh_test" user="yh_vpc_bak">
<readHost host="yohobuyLogsR1" url="yohologs.yohoops:3306" password="yh_test" user="yh_vpc_bak" />
</writeHost>
</dataHost>
</mycat:schema>
\ No newline at end of file
... ...
<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/">
<!-- schema定义 -->
<schema name="yhb_promotion_split" checkSQLschema="false" sqlMaxLimit="100">
<table name="coupons_logs" dataNode="dn_promt_split$0-3" rule="rule_promt" />
<table name="coupons_logs_third_info" dataNode="dn_promt_split$0-3" rule="rule_promt" />
<table name="coupons_personal" dataNode="dn_promt_split$0-3" rule="rule_promt" />
<table name="coupons" dataNode="dn_promt_split$0-3" type="global" />
<table name="coupons_logs_custom_type" dataNode="dn_promt_split$0-3" rule="rule_promt" />
<table name="coupons_bag" dataNode="dn_promt_split$0-3" rule="rule_promt" />
</schema>
<schema name="yh_orders_split" checkSQLschema="false" sqlMaxLimit="100">
<table name="shopping_cart" dataNode="dn_order_split$0-3" rule="rule_order" />
<table name="shopping_cart_items" dataNode="dn_order_split$0-3" rule="rule_order" />
<table name="orders" dataNode="dn_order_split$0-3" rule="rule_order" />
<table name="orders_goods" dataNode="dn_order_split$0-3" rule="rule_order" ruleRequired="true" />
<table name="orders_coupons" dataNode="dn_order_split$0-3" rule="rule_order" ruleRequired="true" />
<table name="order_promotion_info" dataNode="dn_order_split$0-3" rule="rule_order" ruleRequired="true" />
<table name="order_ext_attribute" dataNode="dn_order_split$0-3" rule="rule_order" ruleRequired="true" />
<table name="orders_meta" dataNode="dn_order_split$0-3" rule="rule_order" ruleRequired="true" />
<table name="crf_pay_log" dataNode="dn_order_split$0-3" rule="rule_order" />
<table name="cmb_netpay_bind" dataNode="dn_order_split$0-3" rule="rule_order" />
<table name="order_code_sequence" dataNode="dn_order_split$0-3" rule="rule_order" />
<table name="free_shipping_times" dataNode="dn_order_split$0-3" rule="rule_order" />
<table name="orders_pay" dataNode="dn_order_split$0-3" rule="rule_order" />
<table name="wx_pay_action" dataNode="dn_order_split$0-3" rule="rule_order" />
<table name="order_message" dataNode="dn_order_split$0-3" rule="rule_order" />
<table name="order_profile" dataNode="dn_order_split$0-3" rule="rule_order" />
<table name="orders_pre_pay" dataNode="dn_order_current" rule="rule_order" />
<table name="order_pay" dataNode="dn_order_current" rule="rule_order" />
<table name="order_default_preferences" dataNode="dn_order_current" rule="rule_order" />
<table name="order_cancel" dataNode="dn_order_current" rule="rule_order" />
</schema>
<!-- cms -->
<schema name="yh_resource" dataNode="dn_yh_resource" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_operations" dataNode="dn_yh_operations" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_setting" dataNode="dn_yh_setting" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_helper" dataNode="dn_yh_helper" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yoho_activity" dataNode="dn_yoho_activity" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_events" dataNode="dn_yh_events" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yhb_operations" dataNode="dn_yhb_operations" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_guang" dataNode="dn_yh_guang" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_wechat" dataNode="dn_yh_wechat" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_lottery" dataNode="dn_yh_lottery" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="q_msg_system" dataNode="dn_q_msg_system" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_consult" dataNode="dn_yh_consult" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_comment" dataNode="dn_yh_comment" checkSQLschema="false" sqlMaxLimit="100" />
<!-- passport -->
<schema name="yh_passport" dataNode="dn_yh_passport" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yoho_passport" dataNode="dn_yoho_passport" checkSQLschema="false" sqlMaxLimit="100" />
<!-- order -->
<schema name="yh_coupons" dataNode="dn_yh_coupons" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_orders" dataNode="dn_yh_orders" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yhb_promotion" dataNode="dn_yhb_promotion" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yoho_pay" dataNode="dn_yoho_pay" checkSQLschema="false" sqlMaxLimit="100" />
<!-- shops -->
<schema name="yh_shops" dataNode="dn_yh_shops" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yhb_shops" dataNode="dn_yhb_shops" checkSQLschema="false" sqlMaxLimit="100" />
<!-- yohood -->
<schema name="yohood" dataNode="dn_yohood" checkSQLschema="false" sqlMaxLimit="100" />
<!-- store -->
<schema name="yh_extendstore" dataNode="dn_yh_extendstore" checkSQLschema="false" sqlMaxLimit="100" />
<!-- unions -->
<schema name="yh_unions" dataNode="dn_yh_unions" checkSQLschema="false" sqlMaxLimit="100" />
<!-- uic -->
<schema name="yh_community" dataNode="dn_yh_community" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yh_inbox" dataNode="dn_yh_inbox" checkSQLschema="false" sqlMaxLimit="100" />
<schema name="yoho_sms" dataNode="dn_yoho_sms" checkSQLschema="false" sqlMaxLimit="100" />
<!-- yohobuylogs -->
<schema name="yohobuy_logs" dataNode="dn_yohobuy_logs" checkSQLschema="false" sqlMaxLimit="100" />
<dataNode name="dn_promt_split0" dataHost="dh_promt_split" database="yhb_promotion_01" />
<dataNode name="dn_promt_split1" dataHost="dh_promt_split" database="yhb_promotion_02" />
<dataNode name="dn_promt_split2" dataHost="dh_promt_split" database="yhb_promotion_03" />
<dataNode name="dn_promt_split3" dataHost="dh_promt_split" database="yhb_promotion_04" />
<dataNode name="dn_order_split0" dataHost="dh_orders_split" database="yh_orders_01" />
<dataNode name="dn_order_split1" dataHost="dh_orders_split" database="yh_orders_02" />
<dataNode name="dn_order_split2" dataHost="dh_orders_split" database="yh_orders_03" />
<dataNode name="dn_order_split3" dataHost="dh_orders_split" database="yh_orders_04" />
<dataNode name="dn_order_current" dataHost="dh_order_nosplit" database="yh_orders" />
<dataNode name="dn_yh_coupons" dataHost="dh_order_nosplit" database="yh_coupons" />
<dataNode name="dn_yh_orders" dataHost="dh_order_nosplit" database="yh_orders" />
<dataNode name="dn_yhb_promotion" dataHost="dh_order_nosplit" database="yhb_promotion" />
<dataNode name="dn_yoho_pay" dataHost="dh_order_nosplit" database="yoho_pay" />
<dataNode name="dn_yh_resource" dataHost="dh_cms" database="yh_resource" />
<dataNode name="dn_yh_operations" dataHost="dh_cms" database="yh_operations" />
<dataNode name="dn_yh_setting" dataHost="dh_cms" database="yh_setting" />
<dataNode name="dn_yh_helper" dataHost="dh_cms" database="yh_helper" />
<dataNode name="dn_yoho_activity" dataHost="dh_cms" database="yoho_activity" />
<dataNode name="dn_yh_events" dataHost="dh_cms" database="yh_events" />
<dataNode name="dn_yhb_operations" dataHost="dh_cms" database="yhb_operations" />
<dataNode name="dn_yh_guang" dataHost="dh_cms" database="yh_guang" />
<dataNode name="dn_yh_wechat" dataHost="dh_cms" database="yh_wechat" />
<dataNode name="dn_yh_lottery" dataHost="dh_cms" database="yh_lottery" />
<dataNode name="dn_q_msg_system" dataHost="dh_cms" database="q_msg_system" />
<dataNode name="dn_yh_consult" dataHost="dh_cms" database="yh_consult" />
<dataNode name="dn_yh_comment" dataHost="dh_cms" database="yh_comment" />
<dataNode name="dn_yh_passport" dataHost="dh_passport" database="yh_passport" />
<dataNode name="dn_yoho_passport" dataHost="dh_passport" database="yoho_passport" />
<dataNode name="dn_yh_shops" dataHost="dh_shops" database="yh_shops" />
<dataNode name="dn_yhb_shops" dataHost="dh_shops" database="yhb_shops" />
<dataNode name="dn_yohood" dataHost="dh_yohood" database="yohood" />
<dataNode name="dn_yh_extendstore" dataHost="dh_yh_extendstore" database="yh_extendstore" />
<dataNode name="dn_yh_unions" dataHost="dh_yh_unions" database="yh_unions" />
<dataNode name="dn_yh_community" dataHost="dh_uic" database="yh_community" />
<dataNode name="dn_yh_inbox" dataHost="dh_message" database="yh_inbox" />
<dataNode name="dn_yoho_sms" dataHost="dh_message" database="yoho_sms" />
<dataNode name="dn_yohobuy_logs" dataHost="dh_yohobuy_logs" database="yohobuy_logs" />
<!-- balance=0 不开启读写分离 balance=1读操作在主备和读库上执行 balance=2 读操作在写库和读库随机分布 blance=3 读操作只在读库上分布 -->
<dataHost name="dh_promt_split" maxCon="50" minCon="10" balance="0" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost url="192.168.102.219:3306" host="yhTest" password="yh_test" user="yh_test"></writeHost>
</dataHost>
<dataHost name="dh_orders_split" maxCon="50" minCon="10" balance="0" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost url="192.168.102.219:3306" host="yhTest" password="yh_test" user="yh_test"></writeHost>
</dataHost>
<dataHost name="dh_order_nosplit" maxCon="50" minCon="10" balance="0" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost url="192.168.102.219:3306" host="yhTest" password="yh_test" user="yh_test"></writeHost>
</dataHost>
<dataHost name="dh_cms" maxCon="50" minCon="10" balance="0" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost url="192.168.102.219:3306" host="yhTest" password="yh_test" user="yh_test"></writeHost>
</dataHost>
<dataHost name="dh_passport" maxCon="50" minCon="10" balance="0" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost url="192.168.102.219:3306" host="yhTest" password="yh_test" user="yh_test"></writeHost>
</dataHost>
<dataHost name="dh_shops" maxCon="50" minCon="10" balance="0" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost url="192.168.102.219:3306" host="yhTest" password="yh_test" user="yh_test"></writeHost>
</dataHost>
<dataHost name="dh_yohood" maxCon="50" minCon="10" balance="0" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost url="192.168.102.219:3306" host="yhTest" password="yh_test" user="yh_test"></writeHost>
</dataHost>
<dataHost name="dh_yh_extendstore" maxCon="50" minCon="10" balance="0" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost url="192.168.102.219:3306" host="yhTest" password="yh_test" user="yh_test"></writeHost>
</dataHost>
<dataHost name="dh_yh_unions" maxCon="50" minCon="10" balance="0" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost url="192.168.102.219:3306" host="yhTest" password="yh_test" user="yh_test"></writeHost>
</dataHost>
<dataHost name="dh_uic" maxCon="50" minCon="10" balance="0" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost url="192.168.102.219:3306" host="yhTest" password="yh_test" user="yh_test"></writeHost>
</dataHost>
<dataHost name="dh_message" maxCon="50" minCon="10" balance="0" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost url="192.168.102.219:3306" host="yhTest" password="yh_test" user="yh_test"></writeHost>
</dataHost>
<dataHost name="dh_yohobuy_logs" maxCon="50" minCon="10" balance="0" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost url="192.168.102.219:3306" host="yhTest" password="yh_test" user="yh_test"></writeHost>
</dataHost>
</mycat:schema>
\ No newline at end of file
... ...
... ... @@ -9,105 +9,104 @@
under the License. -->
<!DOCTYPE mycat:server SYSTEM "server.dtd">
<mycat:server xmlns:mycat="http://io.mycat/">
<system>
<property name="nonePasswordLogin">0</property> <!-- 0为需要密码登陆、1为不需要密码登陆 ,默认为0,设置为1则需要指定默认账户-->
<property name="useHandshakeV10">1</property>
<property name="useSqlStat">0</property> <!-- 1为开启实时统计、0为关闭 -->
<property name="useGlobleTableCheck">0</property> <!-- 1为开启全加班一致性检测、0为关闭 -->
<property name="sequnceHandlerType">2</property>
<!-- <property name="useCompression">1</property>--> <!--1为开启mysql压缩协议-->
<system>
<property name="nonePasswordLogin">0</property> <!-- 0为需要密码登陆、1为不需要密码登陆 ,默认为0,设置为1则需要指定默认账户-->
<property name="useHandshakeV10">1</property>
<property name="useSqlStat">1</property> <!-- 1为开启实时统计、0为关闭 -->
<property name="useGlobleTableCheck">0</property> <!-- 1为开启全加班一致性检测、0为关闭 -->
<property name="sequnceHandlerType">2</property>
<!-- <property name="useCompression">1</property>--> <!--1为开启mysql压缩协议-->
<!-- <property name="fakeMySQLVersion">5.6.20</property>--> <!--设置模拟的MySQL版本号-->
<!-- <property name="processorBufferChunk">40960</property> -->
<!--
<property name="processors">1</property>
<property name="processorExecutor">32</property>
-->
<!-- <property name="processorBufferChunk">40960</property> -->
<property name="processors">4</property>
<property name="processorExecutor">32</property>
<!--默认为type 0: DirectByteBufferPool | type 1 ByteBufferArena | type 2 NettyBufferPool -->
<property name="processorBufferPoolType">0</property>
<!--默认是65535 64K 用于sql解析时最大文本长度 -->
<!--<property name="maxStringLiteralLength">65535</property>-->
<!--<property name="sequnceHandlerType">0</property>-->
<!--<property name="backSocketNoDelay">1</property>-->
<!--<property name="frontSocketNoDelay">1</property>-->
<!--<property name="processorExecutor">16</property>-->
<!--
<property name="serverPort">8066</property> <property name="managerPort">9066</property>
<property name="idleTimeout">300000</property> <property name="bindIp">0.0.0.0</property>
<property name="frontWriteQueueSize">4096</property> <property name="processors">32</property> -->
<!--分布式事务开关,0为不过滤分布式事务,1为过滤分布式事务(如果分布式事务内只涉及全局表,则不过滤),2为不过滤分布式事务,但是记录分布式事务日志-->
<property name="handleDistributedTransactions">0</property>
<!--
off heap for merge/order/group/limit 1开启 0关闭
-->
<property name="useOffHeapForMerge">1</property>
<!--
单位为m
-->
<property name="processorBufferPoolType">0</property>
<!--默认是65535 64K 用于sql解析时最大文本长度 -->
<!--<property name="maxStringLiteralLength">65535</property>-->
<!--<property name="sequnceHandlerType">0</property>-->
<!--<property name="backSocketNoDelay">1</property>-->
<!--<property name="frontSocketNoDelay">1</property>-->
<!--<property name="processorExecutor">16</property>-->
<property name="serverPort">8066</property>
<property name="managerPort">9066</property>
<property name="idleTimeout">300000</property>
<!--<property name="bindIp">0.0.0.0</property>-->
<property name="frontWriteQueueSize">4096</property>
<!--分布式事务开关,0为不过滤分布式事务,1为过滤分布式事务(如果分布式事务内只涉及全局表,则不过滤),2为不过滤分布式事务,但是记录分布式事务日志-->
<property name="handleDistributedTransactions">0</property>
<!-- off heap for merge/order/group/limit 1开启 0关闭 -->
<property name="useOffHeapForMerge">1</property>
<!-- 单位为m -->
<property name="memoryPageSize">64k</property>
<!--
单位为k
-->
<property name="spillsFileBufferSize">1k</property>
<property name="useStreamOutput">0</property>
<!--
单位为m
-->
<property name="systemReserveMemorySize">384m</property>
<!--是否采用zookeeper协调切换 -->
<property name="useZKSwitch">false</property>
<!-- XA Recovery Log日志路径 -->
<!--<property name="XARecoveryLogBaseDir">./</property>-->
<!-- XA Recovery Log日志名称 -->
<!--<property name="XARecoveryLogBaseName">tmlog</property>-->
</system>
<!-- 全局SQL防火墙设置 -->
<!--白名单可以使用通配符%或着*-->
<!--例如<host host="127.0.0.*" user="root"/>-->
<!--例如<host host="127.0.*" user="root"/>-->
<!--例如<host host="127.*" user="root"/>-->
<!--例如<host host="1*7.*" user="root"/>-->
<!--这些配置情况下对于127.0.0.1都能以root账户登录-->
<!--
<firewall>
<whitehost>
<host host="1*7.0.0.*" user="root"/>
</whitehost>
<!-- 单位为k -->
<property name="spillsFileBufferSize">1k</property>
<property name="useStreamOutput">0</property>
<!-- 单位为m -->
<property name="systemReserveMemorySize">384m</property>
<!--是否采用zookeeper协调切换 -->
<property name="useZKSwitch">false</property>
<!-- XA Recovery Log日志路径 -->
<!--<property name="XARecoveryLogBaseDir">./</property>-->
<!-- XA Recovery Log日志名称 -->
<!--<property name="XARecoveryLogBaseName">tmlog</property>-->
</system>
<!-- 全局SQL防火墙设置 -->
<!--白名单可以使用通配符%或着*-->
<!--例如<host host="127.0.0.*" user="root"/>-->
<!--例如<host host="127.0.*" user="root"/>-->
<!--例如<host host="127.*" user="root"/>-->
<!--例如<host host="1*7.*" user="root"/>-->
<!--这些配置情况下对于127.0.0.1都能以root账户登录-->
<!--
<firewall>
<whitehost>
<host host="1*7.0.0.*" user="root"/>
</whitehost>
<blacklist check="false">
</blacklist>
</firewall>
-->
<user name="root" defaultAccount="true">
<property name="password">123456</property>
<property name="schemas">TESTDB</property>
<!-- 表级 DML 权限设置 -->
<!--
<privileges check="false">
<schema name="TESTDB" dml="0110" >
<table name="tb01" dml="0000"></table>
<table name="tb02" dml="1111"></table>
</schema>
</privileges>
-->
</user>
<user name="user">
<property name="password">user</property>
<property name="schemas">TESTDB</property>
<property name="readOnly">true</property>
</user>
</firewall>
-->
<user name="yh_vpc_bak" defaultAccount="true">
<property name="password">yoho@2Y$^YpNb7hp</property>
<property name="schemas">yhb_promotion_split,yh_orders_split,yh_resource,yh_operations,yh_setting,
yh_helper,yoho_activity,yh_events,yhb_operations,yh_guang,yh_wechat,yh_lottery,q_msg_system,
yh_consult,yh_comment,yh_passport,yoho_passport,yh_coupons,yh_orders,yhb_promotion,yoho_pay,
yh_shops,yhb_shops,yohood,yh_extendstore,yh_unions,yh_community,yh_inbox,yoho_sms,yohobuy_logs
</property>
<!-- 表级 DML 权限设置 -->
<!--
<privileges check="false">
<schema name="TESTDB" dml="0110" >
<table name="tb01" dml="0000"></table>
<table name="tb02" dml="1111"></table>
</schema>
</privileges>
-->
</user>
<user name="yh_test">
<property name="password">yh_test</property>
<property name="schemas">yhb_promotion_split,yh_orders_split,yh_resource,yh_operations,yh_setting,
yh_helper,yoho_activity,yh_events,yhb_operations,yh_guang,yh_wechat,yh_lottery,q_msg_system,
yh_consult,yh_comment,yh_passport,yoho_passport,yh_coupons,yh_orders,yhb_promotion,yoho_pay,
yh_shops,yhb_shops,yohood,yh_extendstore,yh_unions,yh_community,yh_inbox,yoho_sms,yohobuy_logs
</property>
</user>
</mycat:server>
... ...
... ... @@ -43,7 +43,13 @@ public class ConfigTest {
this.dataHosts = initDataHosts(configLoader);
}
@Test
public void testYohoConfigAvailable() {
SchemaConfig sc = this.schemas.get("yhb_promotion_split");
System.out.println(sc.getTables());
}
/**
* 测试 临时读可用 配置
*/
... ...
package io.mycat.zkcluster;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Created by xueyin on 2018/11/29.
*/
public class MycatZkClusterTest {
@Test
public void testCluster() throws Exception {
MycatZkCluster.getInstance().start();
Thread.sleep(15000);
MycatZkCluster.getInstance().stop();
}
}
\ No newline at end of file
... ...
package io.mycat.zkcluster;
import org.junit.Test;
/**
* Created by xueyin on 2018/11/29.
*/
public class ZkClusterConfigTest {
@Test
public void getClusterConfig() throws Exception {
System.out.println("cluster mode:" + ZkClusterConfig.getInstance().getClusterMode());
System.out.println("cluster name:" + ZkClusterConfig.getInstance().getClusterName());
System.out.println("zk url:" + ZkClusterConfig.getInstance().getZkUrl());
}
}
\ No newline at end of file
... ...
clusterMode=true
clusterName=platform
zkUrl=10.211.55.7:2181
\ No newline at end of file
... ...
... ... @@ -24,6 +24,19 @@
</rule>
</tableRule>
<tableRule name="rule_promt">
<rule>
<columns>uid</columns>
<algorithm>func1</algorithm>
</rule>
</tableRule>
<tableRule name="rule_order">
<rule>
<columns>uid</columns>
<algorithm>func1</algorithm>
</rule>
</tableRule>
<!-- 路由函数定义 -->
<function name="func1"
class="io.mycat.route.function.PartitionByLong">
... ...
... ... @@ -30,6 +30,25 @@
<schema name="dbtest2" checkSQLschema="false" sqlMaxLimit="100" dataNode="dnTest4"></schema>
<schema name="yhb_promotion_split" checkSQLschema="false" sqlMaxLimit="100">
<table name="coupons_logs" dataNode="dn_promt_split$1-4" rule="rule_promt" />
<table name="coupons_logs_third_info" dataNode="dn_promt_split$1-4" rule="rule_promt" />
<table name="coupons_personal" dataNode="dn_promt_split$1-4" rule="rule_promt" />
<table name="coupons" dataNode="dn_promt_split$1-4" type="global" />
<table name="coupons_logs_custom_type" dataNode="dn_promt_split$1-4" rule="rule_promt" />
<table name="coupons_bag" dataNode="dn_promt_split$1-4" rule="rule_promt" />
</schema>
<dataNode name="dn_promt_split1" dataHost="test219" database="yhb_promotion_01" />
<dataNode name="dn_promt_split2" dataHost="test219" database="yhb_promotion_02" />
<dataNode name="dn_promt_split3" dataHost="test219" database="yhb_promotion_03" />
<dataNode name="dn_promt_split4" dataHost="test219" database="yhb_promotion_04" />
<dataNode name="dn_orders_split1" dataHost="test219" database="yh_orders_01" />
<dataNode name="dn_orders_split2" dataHost="test219" database="yh_orders_02" />
<dataNode name="dn_orders_split3" dataHost="test219" database="yh_orders_03" />
<dataNode name="dn_orders_split4" dataHost="test219" database="yh_orders_04" />
<dataNode name="dn_order_current" dataHost="test219" database="yh_orders" />
<!-- 数据节点定义,数据节点由数据源和其他一些参数组织而成。 -->
<dataNode name="dnTest1" dataHost="localhost1" database="db1" />
... ... @@ -61,5 +80,10 @@
<readHost host="readS3" url="192.168.1.13:3306" user="root" password="123456" weight="3"/>
</writeHost>
</dataHost>
<!-- balance=0 不开启读写分离 balance=1读操作在主备和读库上执行 balance=2 读操作在写库和读库随机分布 blance=3 读操作只在读库上分布 -->
<dataHost name="test219" maxCon="50" minCon="10" balance="0" dbType="mysql" dbDriver="native">
<heartbeat>select 1</heartbeat>
<writeHost url="192.168.102.219:3306" host="yhTest" password="yh_test" user="yh_test"></writeHost>
</dataHost>
</mycat:schema>
... ...
... ... @@ -25,7 +25,7 @@
<dataNode name="dnTest1" dataHost="localhost1" database="db1" />
<dataNode name="dnTest2" dataHost="localhost1" database="db2" />
<dataNode name="dnTest3" dataHost="localhost1" database="db3" />
<dataHost name="localhost1" maxCon="500" minCon="10" balance="0"
<dataHost name="localhost1" maxCon="500" minCon="10" balance="0"
dbType="mysql" dbDriver="native" >
<heartbeat>select user()</heartbeat>
<!-- can have multi write hosts -->
... ... @@ -36,6 +36,4 @@
/> -->
</writeHost>
</dataHost>
</mycat:schema>
... ...
BuildTime 2018-11-27 08:56:35
GitVersion f9e2b6634206e06317478e1dffb9b75f8673ecf0
BuildTime 2019-03-13 06:06:40
GitVersion 45d828efee99c6d5821081e389082ec5fac4b6d3
MavenVersion 1.6.5-release
GitUrl https://github.com/MyCATApache/Mycat-Server.git
MyCatSite http://www.mycat.org.cn
... ...