Mysql 基于 Amoeba 的 读写分离(2)
<?xml version="1.0" encoding="gbk"?>
<!DOCTYPE amoeba:configuration SYSTEM "amoeba.dtd">
<amoeba:configuration xmlns:amoeba="http://amoeba.meidusa.com/"><proxy><!-- service class must implements com.meidusa.amoeba.service.Service --><service name="Amoeba for Mysql" class="com.meidusa.amoeba.net.ServerableConnectionManager"><!-- Amoeba 端口号 --><property name="port">8066</property><!-- bind ipAddress --><!-- <property name="ipAddress">127.0.0.1</property>--><property name="manager">${clientConnectioneManager}</property><property name="connectionFactory"><bean class="com.meidusa.amoeba.mysql.net.MysqlClientConnectionFactory"><property name="sendBufferSize">128</property><property name="receiveBufferSize">64</property></bean></property><property name="authenticator"><bean class="com.meidusa.amoeba.mysql.server.MysqlClientAuthenticator"><!-- Amoeba 账号,密码 --><property name="user">root</property><property name="password">root</property><property name="filter"><bean class="com.meidusa.amoeba.server.IPAccessController"><property name="ipFile">${amoeba.home}/conf/access_list.conf</property></bean></property></bean></property></service><!-- server class must implements com.meidusa.amoeba.service.Service --><service name="Amoeba Monitor Server" class="com.meidusa.amoeba.monitor.MonitorServer"><!-- port --><!-- default value: random number<property name="port">9066</property>--><!-- bind ipAddress --><property name="ipAddress">127.0.0.1</property><property name="daemon">true</property><property name="manager">${clientConnectioneManager}</property><property name="connectionFactory"><bean class="com.meidusa.amoeba.monitor.net.MonitorClientConnectionFactory"></bean></property></service><runtime class="com.meidusa.amoeba.mysql.context.MysqlRuntimeContext"><!-- proxy server net IO Read thread size --><property name="readThreadPoolSize">20</property><!-- proxy server client process thread size --><property name="clientSideThreadPoolSize">30</property><!-- mysql server data packet process thread size --><property name="serverSideThreadPoolSize">30</property><!-- per connection cache prepared statement size --><property name="statementCacheSize">500</property><!-- query timeout( default: 60 second , TimeUnit:second) --><property name="queryTimeout">60</property></runtime></proxy><!-- Each ConnectionManager will start as threadmanager responsible for the Connection IO read , Death Detection--><connectionManagerList><connectionManager name="clientConnectioneManager" class="com.meidusa.amoeba.net.MultiConnectionManagerWrapper"><property name="subManagerClassName">com.meidusa.amoeba.net.ConnectionManager</property><!-- default value is avaliable Processors <property name="processors">5</property>--></connectionManager><connectionManager name="defaultManager" class="com.meidusa.amoeba.net.MultiConnectionManagerWrapper"><property name="subManagerClassName">com.meidusa.amoeba.net.AuthingableConnectionManager</property><!-- default value is avaliable Processors <property name="processors">5</property>--></connectionManager></connectionManagerList><!-- default using file loader --><dbServerLoader class="com.meidusa.amoeba.context.DBServerConfigFileLoader"><property name="configFile">${amoeba.home}/conf/dbServers.xml</property></dbServerLoader><queryRouter class="com.meidusa.amoeba.mysql.parser.MysqlQueryRouter"><property name="ruleLoader"><bean class="com.meidusa.amoeba.route.TableRuleFileLoader"><property name="ruleFile">${amoeba.home}/conf/rule.xml</property><property name="functionFile">${amoeba.home}/conf/ruleFunctionMap.xml</property></bean></property><property name="sqlFunctionFile">${amoeba.home}/conf/functionMap.xml</property><property name="LRUMapSize">1500</property><!-- 默认数据库,主数据库 --><property name="defaultPool">master</property><!-- 写数据库 --><property name="writePool">master</property><!-- 读数据库,dbServer.xml 中配置的 虚拟数据库,数据库池 --><property name="readPool">slaves</property><property name="needParse">true</property></queryRouter>
</amoeba:configuration>
- <?xml version="1.0" encoding="gbk"?>
- <!DOCTYPE amoeba:rule SYSTEM "rule.dtd">
- <amoeba:rule xmlns:amoeba="http://amoeba.meidusa.com/">
- <tableRule name="message" schema="test" defaultPools="server1">
- </tableRule>
- </amoeba:rule>
<?xml version="1.0" encoding="gbk"?>
<!DOCTYPE amoeba:rule SYSTEM "rule.dtd">
<amoeba:rule xmlns:amoeba="http://amoeba.meidusa.com/"><tableRule name="message" schema="test" defaultPools="server1"></tableRule>
</amoeba:rule>
- tail -f ./log/mysql.log
tail -f ./log/mysql.log


- [mysql@prx1 mysql]$ tail -f log/mysql.log
- 370 Query SET SESSION sql_mode=''
- 370 Query SET NAMES utf8
- 370 Query SHOW FULL TABLES
- 370 Query SHOW COLUMNS FROM `t_message`
- 370 Query SHOW COLUMNS FROM `t_user`
- 370 Query SHOW PROCEDURE STATUS
- 370 Query SHOW FUNCTION STATUS
- 110813 15:21:11 370 Query SHOW VARIABLES LIKE 'character_set_server'
- 370 Query SHOW FULL COLUMNS FROM `test`.`t_message`
- 110813 15:21:12 370 Query SHOW CREATE TABLE `test`.`t_message`
- 110813 15:22:40 374 Connect test_user@192.168.14.129 on test
- 375 Connect test_user@192.168.14.129 on test
- 376 Connect test_user@192.168.14.129 on test
- 110813 15:23:40 370 Query insert into t_message values(1, 'c1')
- 110813 15:24:07 377 Connect test_user@192.168.14.129 on test
- 378 Connect test_user@192.168.14.129 on test
- 379 Connect test_user@192.168.14.129 on test
- 110813 15:24:15 370 Query insert into t_user values(8, 'n8', 'p8')
- 110813 15:24:24 370 Query SHOW FULL COLUMNS FROM `test`.`t_user`
- 370 Query SHOW CREATE TABLE `test`.`t_user`
- 110813 15:24:35 370 Query SHOW FULL COLUMNS FROM `test`.`t_message`
- 370 Query SHOW CREATE TABLE `test`.`t_message`
[mysql@prx1 mysql]$ tail -f log/mysql.log370 Query SET SESSION sql_mode=''370 Query SET NAMES utf8370 Query SHOW FULL TABLES370 Query SHOW COLUMNS FROM `t_message`370 Query SHOW COLUMNS FROM `t_user`370 Query SHOW PROCEDURE STATUS370 Query SHOW FUNCTION STATUS
110813 15:21:11 370 Query SHOW VARIABLES LIKE 'character_set_server'370 Query SHOW FULL COLUMNS FROM `test`.`t_message`
110813 15:21:12 370 Query SHOW CREATE TABLE `test`.`t_message`
110813 15:22:40 374 Connect test_user@192.168.14.129 on test375 Connect test_user@192.168.14.129 on test376 Connect test_user@192.168.14.129 on test
110813 15:23:40 370 Query insert into t_message values(1, 'c1')
110813 15:24:07 377 Connect test_user@192.168.14.129 on test378 Connect test_user@192.168.14.129 on test379 Connect test_user@192.168.14.129 on test
110813 15:24:15 370 Query insert into t_user values(8, 'n8', 'p8')
110813 15:24:24 370 Query SHOW FULL COLUMNS FROM `test`.`t_user`370 Query SHOW CREATE TABLE `test`.`t_user`
110813 15:24:35 370 Query SHOW FULL COLUMNS FROM `test`.`t_message`370 Query SHOW CREATE TABLE `test`.`t_message`
- [mysql@prx2 mysql]$ tail -f log/mysql.log
- 317 Connect test_user@192.168.14.129 on test
- 318 Connect test_user@192.168.14.129 on test
- 110813 15:35:30 315 Query SELECT @@sql_mode
- 110813 15:35:32 315 Query SELECT @@sql_mode
- 110813 15:35:44 315 Query SELECT @@SQL_MODE
- 110813 15:35:46 315 Query SELECT @@SQL_MODE
- 110813 15:37:18 319 Connect test_user@192.168.14.129 on test
- 320 Connect test_user@192.168.14.129 on test
- 110813 15:37:19 321 Connect test_user@192.168.14.129 on test
- 110813 15:37:26 246 Quit
- 110813 15:38:21 315 Query SELECT @@SQL_MODE
- 110813 15:38:22 42 Query BEGIN
- 42 Query insert into t_message values(1, 'c1')
- 42 Query COMMIT /* implicit, from Xid_log_event */
- 110813 15:38:50 322 Connect test_user@192.168.14.129 on test
- 323 Connect test_user@192.168.14.129 on test
- 324 Connect test_user@192.168.14.129 on test
- 110813 15:38:58 42 Query BEGIN
- 42 Query insert into t_user values(8, 'n8', 'p8')
- 42 Query COMMIT /* implicit, from Xid_log_event */
- 110813 15:39:08 315 Query SELECT @@SQL_MODE
- 110813 15:39:19 315 Query SELECT @@SQL_MODE
- 110813 15:44:08 325 Connect test_user@192.168.14.129 on test
- 326 Connect test_user@192.168.14.129 on test
- 327 Connect test_user@192.168.14.129 on test
[mysql@prx2 mysql]$ tail -f log/mysql.log317 Connect test_user@192.168.14.129 on test318 Connect test_user@192.168.14.129 on test
110813 15:35:30 315 Query SELECT @@sql_mode
110813 15:35:32 315 Query SELECT @@sql_mode
110813 15:35:44 315 Query SELECT @@SQL_MODE
110813 15:35:46 315 Query SELECT @@SQL_MODE
110813 15:37:18 319 Connect test_user@192.168.14.129 on test320 Connect test_user@192.168.14.129 on test
110813 15:37:19 321 Connect test_user@192.168.14.129 on test
110813 15:37:26 246 Quit
110813 15:38:21 315 Query SELECT @@SQL_MODE
110813 15:38:22 42 Query BEGIN42 Query insert into t_message values(1, 'c1')42 Query COMMIT /* implicit, from Xid_log_event */
110813 15:38:50 322 Connect test_user@192.168.14.129 on test323 Connect test_user@192.168.14.129 on test324 Connect test_user@192.168.14.129 on test
110813 15:38:58 42 Query BEGIN42 Query insert into t_user values(8, 'n8', 'p8')42 Query COMMIT /* implicit, from Xid_log_event */
110813 15:39:08 315 Query SELECT @@SQL_MODE
110813 15:39:19 315 Query SELECT @@SQL_MODE
110813 15:44:08 325 Connect test_user@192.168.14.129 on test326 Connect test_user@192.168.14.129 on test327 Connect test_user@192.168.14.129 on test
- [mysql@prx3 mysql]$ tail -f log/mysql.log
- 110813 15:35:08 305 Connect test_user@192.168.14.129 on test
- 306 Connect test_user@192.168.14.129 on test
- 307 Connect test_user@192.168.14.129 on test
- 110813 15:35:31 304 Query SELECT @@sql_mode
- 304 Query SELECT @@sql_mode
- 110813 15:35:44 304 Query SELECT @@SQL_MODE
- 110813 15:35:46 304 Query SELECT * FROM t_message t
- 110813 15:37:18 308 Connect test_user@192.168.14.129 on test
- 309 Connect test_user@192.168.14.129 on test
- 310 Connect test_user@192.168.14.129 on test
- 110813 15:38:21 8 Query BEGIN
- 8 Query insert into t_message values(1, 'c1')
- 8 Query COMMIT /* implicit, from Xid_log_event */
- 110813 15:38:50 311 Connect test_user@192.168.14.129 on test
- 312 Connect test_user@192.168.14.129 on test
- 313 Connect test_user@192.168.14.129 on test
- 110813 15:38:58 304 Query SELECT @@SQL_MODE
- 8 Query BEGIN
- 8 Query insert into t_user values(8, 'n8', 'p8')
- 8 Query COMMIT /* implicit, from Xid_log_event */
- 110813 15:39:08 304 Query select * from t_user
- 110813 15:39:19 304 Query select * from t_message
- 110813 15:44:08 314 Connect test_user@192.168.14.129 on test
- 315 Connect test_user@192.168.14.129 on test
- 316 Connect test_user@192.168.14.129 on test
[mysql@prx3 mysql]$ tail -f log/mysql.log
110813 15:35:08 305 Connect test_user@192.168.14.129 on test306 Connect test_user@192.168.14.129 on test307 Connect test_user@192.168.14.129 on test
110813 15:35:31 304 Query SELECT @@sql_mode304 Query SELECT @@sql_mode
110813 15:35:44 304 Query SELECT @@SQL_MODE
110813 15:35:46 304 Query SELECT * FROM t_message t
110813 15:37:18 308 Connect test_user@192.168.14.129 on test309 Connect test_user@192.168.14.129 on test310 Connect test_user@192.168.14.129 on test
110813 15:38:21 8 Query BEGIN8 Query insert into t_message values(1, 'c1')8 Query COMMIT /* implicit, from Xid_log_event */
110813 15:38:50 311 Connect test_user@192.168.14.129 on test312 Connect test_user@192.168.14.129 on test313 Connect test_user@192.168.14.129 on test
110813 15:38:58 304 Query SELECT @@SQL_MODE8 Query BEGIN8 Query insert into t_user values(8, 'n8', 'p8')8 Query COMMIT /* implicit, from Xid_log_event */
110813 15:39:08 304 Query select * from t_user
110813 15:39:19 304 Query select * from t_message
110813 15:44:08 314 Connect test_user@192.168.14.129 on test315 Connect test_user@192.168.14.129 on test316 Connect test_user@192.168.14.129 on test
转载于:https://blog.51cto.com/zhyuxuan/911742
相关文章:

Linux驱动之LCD驱动编写
在Linux驱动之内核自带的S3C2440的LCD驱动分析这篇博客中已经分析了编写LCD驱动的步骤,接下来就按照这个步骤来字尝试字节编写LCD驱动。用的LCD屏幕为tft屏,每个像素点为16bit。对应与红绿蓝分别为565。 1、分配一个fb_info结构 2、设置fb_info结构 3、硬…

《C++primer》第二章--变量和基本内置类型
基本内置类型 如何选择类型的几点建议 当明确知晓数值不能为负数时,选用无符号类型使用int进行整数运算。因为short一般表示的范围比较小,而long一般和int有相同的范围。如果表示的范围超过了int就使用long long算术运算时尽量不要使用char和bool&…

【入门】等差素数组
题目描述 如果两个素数之和的一半仍然是一个素数,则这三个素数可以组成一个等差素数组,如(37)/25,则(3,5,7)为一个等差素数组,编程求100以内的所有等差素数组…

flutter和webapp_Flutter全平台!迁移现有Flutter项目到WEB端
写在前面Flutter 是 Google推出并开源的移动应用开发框架,主打跨平台、高保真、高性能。开发者可以通过 Dart语言开发 App,一套代码同时运行在 iOS 、Android、web和桌面端。Flutter_web是Flutter代码兼容web的实现,可以将使用Dart编写的现有…

使用正则表达式构造定制的HTML5输入框
为什么80%的码农都做不了架构师?>>> 正则表达式(点此在线编辑测试)是一个功能强大的灵活而简洁的匹配文本字符串的工具,比如匹配特定的字符、单词等。正则表达式通过一个语言规则来书写,通过正则表达式处理…

idea dubbo jar error:cvc-complex-type.2.4.c: 通配符的匹配很全面, 但无法找到元素 'dubbo:application' 的声明...
声明: 出现这个错误的情形是,在idea开发环境里面运行是没有问题的,使用哦idea自带的打包工具生成jar之后,运行jar的时候报的这个错误,如果不是这个情况,这篇文章可能不适用。 主要的原因是spring.schemas、…

lwip可以用于发udp_LWIPUDP一对多
最近在STM32F767的开发板上移植了LWIP UDP的代码,开发板的资料里面有介绍LWIP移植的文档,介绍了几种网络通信方式,如TCP server,TCP client,UDP,按照文档里面的介绍也很容易实现。这里我选择的是基于ucos2操…

奇淫怪巧之给Delphi的PrintDialog增加一个页码选定范围打印的Edit
在Delphi中使用PrintDialog打印对话框的时候,这个控件有三个选项,就是PrintRang那个属性的三个选项,其中有一个选项三,让我们自定义选择页码范围来打印。但是比较蛋疼的是,这个地方选中了之后啥子效果都没有。无法制定…
进程管理(图文)
进程的图文形象表示 阮一峰–进程与线程的一个简单解释 多进程实质 现在,多核CPU已经非常普及了,但是,即使过去的单核CPU,也可以执行多任务。由于CPU执行代码都是顺序执行的,那么,单核CPU是怎么执行多任…

拿到WP官方主题Twenty Ten就是一顿nofollow伺候
2019独角兽企业重金招聘Python工程师标准>>> 今天2012-07-03,我的个人cn域名申请下来了,于是网站搬迁,暂时没有选择一个好的WordPress主题,只有用默认的Twenty Ten,不过这个主题对SEO方面还有一些欠缺&…

Qt分析:Qt中的两种定时器
QTimer类的定时器 QTimer类定时器是QObject类定时器的扩展版或者说升级版,因为它可以提供更多的功能。比如说,它支持单次触发和多次触发。 使用QTimer类定时器的步骤: (1)创建一个QTimer定时器实例:QTimer …

uestc 1012 饭卡
饭卡(card) Time Limit: 1000 ms Memory Limit: 65535 kB Solved: 253 Tried: 2169 Submit Status Best Solution Back Description 电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等…

wps临时文件不自动删除_win10系统下wps残留文件无法删除如何解决
一位用户反馈自己在win10系统电脑中卸载金山WPS办公软件时,发现根本无法将wps残留的文件夹删除,在删除的时候提示“操作无法完成,因为其中的文件夹或文件已在另一程序打开 请关闭该文件夹文件重试”,这该怎么办呢?接下…

WEB登录H3C模拟器
思路:先将路由器与本地网卡绑定,然后将本地网卡与路由器接口ip设置在同一网段,在路由器上建立本地用户,最后登录就OK了。 1、查看本机网卡的序列号,在CMD里输入systeminfo,输出的最下…

ArcMap 通过DEM获取高程值
第一种方法:Extract values to Points工具,这个网上的资料比较多,就不介绍了。 第二种方法:Interpolate Shape工具 直接用Arc Toolbox->3D Analyst Tools->功能性表面->Interpolate Shape工具就行,可以将DEM的…

Linux进程描述符task_struct结构体简析
进程是处于执行期的程序以及它所管理的资源(如打开的文件、挂起的信号、进程状态、地址空间等等)的总称 Linux内核通过一个被称为进程描述符的task_struct结构体来管理进程,这个结构体包含了一个进程所需的所有信息。它定义在include/linux/…

hdu 1312 Red and Black 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid1312 第二条深搜,题目并不难,但是做了我好久好久,由于一个细节,让我赌上了一个晚上的时间。 题目大意:从图中的标记开始,向四个相邻的方向…

easyexcel怎么设置表头宽度_easyexcel 自动设置列宽
com.alibabaeasyexcel2.1.4导出controller层代码RequestMapping("/download")public void download(HttpServletResponse response) throws IOException {response.setContentType("application/vnd.ms-excel");response.setCharacterEncoding("utf-8…

php ImageMagick扩展
linux下安装php ImageMagick扩展模块下载ImageMagick源码包:#wget ftp://ftp.u-aizu.ac.jp/pub/graphics/p_w_picpath/ImageMagick/p_w_picpathmagick.org/ImageMagick.tar.gz 编译安装:#tar -zxvf ImageMagick.tar.gz #cd ImageMagick-xxxx-0#./confi…

调用浏览器的打印方法打印页面内容
2018-08-30 直接调用浏览器的打印方法 1、打印按钮 <a href"#" target"_self" οnclick"printme()">打印</a> 2、js //打印function printme() {$.messager.confirm(确认, 确认打印?, function (r) {if (r) {document.bo…

jsp中九大内置对象
内置组件 JSP共有以下9种基本内置组件(可与ASP的6种内部组件相对应):1.request对象 客户端的请求信息被封装在request对象中,通过它才能了解到客户的需求,然后做出响应。它是HttpServletRequest类的实例。序号 方 法 说…

python数组越界_python 整数越界问题详解
python 内部自带大整数运算能力,整数运算不会溢出,只要内存足够,就oK下面的例子演示了两个32位整数加法的情况(通过位运算实现),为了模拟溢出的效果,必须人工的进行位运算,~运算符除了求反,还是…
Linux虚拟机连不上网
问题:我们在使用Linux虚拟机的时候经常会出现各种各样的问题,其中的一个问题就是Linux虚拟机连不上网,这是我最近经常遇到的问题,下面提供一种方法解决这个问题 Linux网络设置 打开虚拟机依次单击【System】–>【Preferences】…

企业如何利用新闻类软文营销策划
新闻软文营销对企业的推广有哪些优势呢? 一、首先让客户有机会直接在门户网上相关频道看到关于企业产品的新闻,产生直接的点击或者评论,带来直接客户。 二、当潜在客户运用百度等搜索引擎搜索企业的公司名或者产品的关键词,那么就会在一个页…

WPF XAML 资源样式模板属性存放位置
WPF XAML 资源样式模板属性存放位置 原文:WPF XAML 资源样式模板属性存放位置WPF的XAML 资源申明 类似HTML。 整体来说分3种1.行类资源样式属性 1.1 行内属性 <Button Content"按钮" Foreground"White" FontSize"30"></Button>1.2 行…

SQL Server 数据库备份
SQL Server 数据库备份 原文 http://www.cnblogs.com/ynbt/archive/2013/04/04/2999642.html 备份数据库是指对数据库或事务日志进行复制,当系统、磁盘或数据库文件损坏时,可以使用备份文件进行恢复,防止数据丢失。 SQL Server数据库备份支持…

Linux下修改PATH环境变量
Linux下有很多环境变量,PATH就是其中的一种 PATH 可执行文件的搜索路径。ls命令也是一个程序,执行它不需要提供完整的路径名/bin/ls,然 而通常我们执行当前目录下的程序a.out却需要提供完整的路径名./a.out,这是因为PATH 环 境变量的值里面包含了ls命令所在的目…

vscode 终端 进入node_安装了Node.js 从VScode 使用node -v 和 npm -v等命令却无效
前言最近写TypeScript需要安装、配置Node.js环境,楼主是使用的安装包所以环境变量都是自动就配好了(如果是下载的zip压缩包解压后要自己配置到系统环境变量中)。打开系统终端敲入命令 node -v 和 npm -v 也都有显示对应的软件包版本号,但是在VScode(Vis…

display:inline-block的妙用!!列表布局!!
如下图:像这种列表布局我们一般用 float:left; 设置宽度和高度就OK了。 但是,如果高度不同或者文字字数不同呢,再用float:left;布局就全乱了。如下图: 现在,我们可以利用display:inline-block;完美的解决这个问题。如下…

gitlab解决一些问题
一.修改gitlab端口: 打开/etc/gitlab/gitlab.rb文件,修改以下几点: external_url "http://192.168.58.62:9999"unicorn[listen] localhostunicorn[port] 9999 然后 #gitlab-ctl stop #gitlab-ctl reconfugure #gitlab-ctl start …