mycat 双主 热切换

为什么80%的码农都做不了架构师?>>>   hot3.png

 

Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz

 

schema.xml

<?xml version="1.0"?>
<!DOCTYPE mycat:schema SYSTEM "schema.dtd">
<mycat:schema xmlns:mycat="http://io.mycat/"><schema name="musingtec" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn1"></schema><schema name="jeecg" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn1"></schema><schema name="testdb" checkSQLschema="false" sqlMaxLimit="100" dataNode="dn1"> </schema><!-- auto sharding by id (long) --><!--		<table name="travelrecord" dataNode="dn1" rule="auto-sharding-long" /> --><!--	<table name="travelrecord" dataNode="dn1"/><table name="test1" dataNode="dn1"/>
--><!-- global table is auto cloned to all defined data nodes ,so can joinwith 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"/> --><!-- <dataNode name="dn1$0-743" dataHost="localhost1" database="db$0-743"/> --><dataNode name="dn1" dataHost="zqdd" database="musingtec" /> <dataNode name="dn2" dataHost="zqdd" database="jeecg" /> <dataNode name="dn3" dataHost="zqdd" database="testdb" /> <!--<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="zqdd" maxCon="1000" minCon="10" balance="2"writeType="0" dbType="mysql" dbDriver="native" switchType="1"  slaveThreshold="100"><heartbeat>select user()</heartbeat><!-- can have multi write hosts --><writeHost host="hostM1" url="192.168.0.171:3306" user="root"password="redhat1"> </writeHost><!-- can have multi read hosts --><!--	<readHost host="hostS2" url="192.168.0.181:3306" user="root" password="redhat1" /> --><writeHost host="hostS2" url="192.168.0.181:3306" user="root" password="redhat1" /><!-- <writeHost host="hostS3" url="192.168.0.85:3306" user="root" password="redhat1" /> --><!--  <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>

server.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -->
<!DOCTYPE mycat:server SYSTEM "server.dtd">
<mycat:server xmlns:mycat="http://io.mycat/"><system><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压缩协议--><!--  <property name="fakeMySQLVersion">5.6.20</property>--> <!--设置模拟的MySQL版本号--><!-- <property name="processorBufferChunk">40960</property> --><!-- <property name="processors">1</property> <property name="processorExecutor">32</property> --><!--默认为type 0: DirectByteBufferPool | type 1 ByteBufferArena--><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="memoryPageSize">1m</property><!--单位为k--><property name="spillsFileBufferSize">1k</property><property name="useStreamOutput">0</property><!--单位为m--><property name="systemReserveMemorySize">384m</property><!--是否采用zookeeper协调切换  --><property name="useZKSwitch">true</property></system><!-- 全局SQL防火墙设置 --><!-- <firewall> <whitehost><host host="127.0.0.1" user="mycat"/><host host="127.0.0.2" user="mycat"/></whitehost><blacklist check="false"></blacklist></firewall>--><user name="root"><property name="password">redhat1</property><property name="schemas">musingtec,jeecg,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">redhat1</property><property name="schemas">musingtec,jeecg,testdb</property><property name="readOnly">true</property></user></mycat:server>

 

转载于:https://my.oschina.net/kcw/blog/1514335

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/288324.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Web程序员的Mysql进阶序三之sql多表数据删除、子查询、联合查询

假设表结构如下&#xff1a; create table test(name varchar(10),sex varchar(10) ); create table test1(name varchar(10),sex varchar(10) );假设多条数据同时插入&#xff1a; insert into test (name,sex) values(xiao,nan),(xiao1,nan1),(xiao2,nan2); insert into te…

android 传感器 balance filter,Android 传感器 API.doc

Android 传感器 API1.1 序言 ? ?【Android蛋蛋网】在这一章我们主要针对Android的传感器(Sensor)进行说明。如果说Java的程序和硬件有些远的感觉&#xff0c;那么可以说传感器距离硬件很近。传感器(Sensor)听起来似乎感觉很难&#xff0c;其实它并不是很难。做起来并很有意思…

6 四大组件之Service

6-1 Servie概述 组件篇——Service 定义:  1.后台运行,不可见,没有界面  2.优先级高于Activity Service是Android系统的后台服务组件&#xff0c;适用于开发无界面、长时间运行的应用功能。 Service特点如下&#xff1a; 没有用户界面 不会轻易被Android系统终止 在系统…

WCF服务寄宿IIS时.SVC文件无法浏览的解决办法

在IIS中托管服务和经典的ASMX Web服务托管相似,需要在IIS下创建虚拟目录,并提供一个.svc文件和Web.config配置文件。另外,托管时,服务的基地址必须与.svc文件的地址相同。 一、操作步骤: (1)打开IIS,新建网站,选择物理路径 (2)打开IIS,在默认网站下添加应用程序,…

python自动生成鸡汤文_用20行Python代码生成鸡汤,打造AI咪蒙指日可待。

作者&#xff1a;Ramtin Alami“Don’t think of the overwhelming majority of the impossible.” “不要去想不可能之事” “Grew up your bliss and the world.” “努力赢得自己的幸福和世界” “what we would end create, creates the ground and you are the one to war…

他毕业两年,博客一年,时间

这是2014年10个月。时光匆匆&#xff0c;看到该公司的新鲜新的一年。有时&#xff0c;一个想法。其实&#xff0c;我在这个城市工作了两年多&#xff0c;总是觉得自己老了。从一般再聘请两名现在厂家机构和学校&#xff0c;懵懵懂懂从校园到完成社区&#xff0c;来写个总结&…

linux shell之替换目录下包含关键字所有文本里面的内容

1 问题 替换目录下包含关键字所有文本里面的内容 比如在目录 /root/chenyu/cy/下&#xff0c;把包含文本/A/B C替换成文本EF 2 解决办法 命令如下 grep -Rl /A/B\ C /root/chenyu/c* | xargs sed -i s#/A/B\ C#EF#g 我们也可以这样 grep -Rl /A/B\ C /root/chenyu/c/ | x…

C#语法糖系列 —— 第一篇:聊聊 params 参数底层玩法

首先说说为什么要写这个系列&#xff0c;大概有两点原因。这种文章阅读量确实高...对 IL 和 汇编代码 的学习巩固所以就决定写一下这个系列&#xff0c;如果大家能从中有所收获&#xff0c;那就更好啦&#xff01;一&#xff1a;params 应用层玩法 首先上一段 测试代码。class …

nginx 修改配置文件使之支持pathinfo,且隐藏index.php

声明环境&#xff1a; nginx centos6.8 使用lnmp一键包搭建环境&#xff08;2019年2月19日 &#xff09;以前使用过别的办法去修改配置文件&#xff0c;但是过于繁琐&#xff0c;最近发现新版本中&#xff0c;在nginx 的 conf目录下发现了文件“enable-php-pathinfo.conf”&am…

Android开发经典笔试面试题汇总(持续更新中)

1.我们都知道Handler是线程与Activity通信的桥梁&#xff0c;假设线程处理不当。你的机器就会变得非常慢&#xff0c;那么线程销毁的方法是&#xff1a;&#xff08;A&#xff09;A. onDestroy()B. onClear()C. onFinish()D. onStop()理解&#xff1a;正确销毁线程的方法应该是…

WCF服务自托管(Self-Hosting)

WCF寄宿方式是一种非常灵活的操作,可以寄宿在各种进程之中,常见的寄宿有:IIS服务、Windows服务、Winform程序、控制台程序中进行寄宿,从而实现WCF服务的运行,为调用者方便、高效提供服务调用。 当客户端和服务端之间的进程有明确的边界时,使用自托管,需要注意的…

学习进度04

第五周所花时间&#xff08;分钟&#xff09;100代码量&#xff08;行&#xff09;50博客量&#xff08;篇&#xff09;2了解到的知识点作为合作的团队要制定统一的标准转载于:https://www.cnblogs.com/liguoshuai/p/5352590.html

android 微信分享gif图,android后台动态创建图片并实现微信分享

今天就记录一下。先说明一下&#xff0c;之前没有做过类似的东西&#xff0c;百度了一两天才知道&#xff0c;说来很惭愧、有点笨&#xff0c;只能这样说。在我的脑里只明白&#xff0c;如果要动态创建图片&#xff1a;一、就是new 嘛二、就是LayoutInflater.from()这种。而微信…

python字符串前面去两位_在Python 3中删除字符串文字前面的'b'字符do

I am new in python programming and i am a bit confused. I try to get the bytes from a string to hash and encrypt but i gotb...b character in front of string just like the below example. Is any way avoid this?.Can anyone give a solution? Sorry for this si…

C语言之去掉https链接的默认443端口

1 问题 去掉https链接的默认443端口 2 代码实现 #include <stdio.h> #include <string.h> #include <stdlib.h>#define BOOL int #define TRUE 1 #define FALSE 0/**判断字符串str1是不是str2开头*/ int is_begin_with(const char *str1, char *str2) {if(…

仅需一个参数就可搞定OneProxy的VIP机制

文章转自&#xff1a;http://card.weibo.com/article/h5/s#cid1001603863326047255626&vid&extparam&from&wm0&ip182.50.119.226现在都讲求无单点的架构&#xff0c;OneProxy也不例外&#xff0c;虽然已经有进程级别的自动重起机制&#xff08;--keepalive…

关于在Windows下AndroidStudio.使用React-Native开发android报错红屏“run react-native start”解决

以下是报错&#xff0c;不过他已经给了解决办法&#xff0c;报错提示的大概中文译为“无法加载脚本&#xff0c;请确保你的Metro服务以及那个包正确”&#xff0c;由于我个人并不是专业安卓&#xff0c;公司项目没办法就上了&#xff0c;所以我就不关包了&#xff0c;包肯定是正…

AsyncLocalT在链路追踪中的应用

前言在项目生产中日志的记录是必不可少的&#xff0c;在.net项目中&#xff0c;要说日志组件&#xff0c;log4net绝对可有一席之地&#xff0c;随着公司业务的发展&#xff0c;微服务则必定无可避免。在跨服务中通过日志进行分析性能或者排查故障点&#xff0c;如何快速定位日志…

Windows运行命令大全

要打开Windows XP系统自带的程序,菜鸟一般是用鼠标点开始/程序(或桌面、快速启动)里的快捷方式,老鸟喜欢按下Win+R并输入运行命令。Windows XP的开始运行命令大全,其实都是C:\WINDOWS\system32下面的程序,只要在开始/运行/输入相应的程序名(命令)即可。对于常用运行命令…

【转】js老生常谈之this,constructor ,prototype

前言 javascript中的this,constructor ,prototype&#xff0c;都是老生常谈的问题&#xff0c;深入理解他们的含义至关重要。在这里&#xff0c;我们再来复习一下吧&#xff0c;温故而知新&#xff01; this this表示当前对象&#xff0c;如果在全局作用范围内使用this&#xf…