技术改变世界 阅读塑造人生! - shaogx.com

This string was altered by TechBlog\Plugins\Example.; This is an example to show the potential of an offcanvas layout pattern in Bootstrap. Try some responsive-range viewport sizes to see it in action.

MySQL读写分离及MMM高可用架构测试

架构组件简介MySQL-Proxy简介MySQL-Proxy是处在你的MySQL数据库客户和服务端之间的程序,它还支持嵌入性脚本语言Lua。这个代理可以用来分析、监控和变换(transform)通信数据,它支持非常广泛的使用场景:负载平衡和故障转移处理查询分析和日志SQL宏(SQL macros)查询重写(query rewriting)执行shell命令... 全文

mysql mysql mmm HA mysql-proxy mysql主从

mysql+mmm+proxy实现mysql读写分离及HA

Mysql+mmm+proxy测试2008年9月8日16:38动机:proxy实现读写分离MMM使Replication方案具有HA下面先看从网上摘抄的一段说明。引言 Master-Slave的数据库机构解决了很多问题,特别是read/write比较高的web2.0应用:1、写操作全部在Master结点执行,并由Slave数据库结点定时(默认60s)读取Master的bin-log2、将众多的用户读请求分散到更多的数据库节点,从而减轻了单点的压力 ... 全文

mysql proxy ha 数据库 mmm

mysql+mmm+proxy实现mysql读写分离及HA

Mysql+mmm+proxy测试2008年9月8日16:38动机:proxy实现读写分离MMM使Replication方案具有HA下面先看从网上摘抄的一段说明。引言Master-Slave的数据库机构解决了很多问题,特别是read/write比较高的web2.0应用:1、写操作全部在Master结点执行,并由Slave数据库结点定时(默认60s)读取Master的bin-log2、将众多的用户读请求分散到更多的数据库节点,从而减轻了单点的压力... 全文

mmm proxy mysql 数据库 休闲

体验MySQL MMM

    今天试验了一把MySQL MMM.(MySQL Master-Master Replication Manager)一个主主复制的管理工具,它提供了主机监控,MySQL服务监控,复制线程等多个方位的监控,使用VIP自动漂移,可以对应用程序实现透明。    下面是试验步骤:... 全文

MySQL MMM

MariaDB (MySQL DB) MMM复制

 一:简介  MMM 即Master-Master Replication Manager for MySQL(mysql主主复制管理器)关于mysql主主复制配置的监控、故障转移和管理的一套可伸缩的脚本套件(在任何时候只有一个节点可以被写 入),这个套件也能对居于标准的主从配置的任意数量的从服务器进行读负载均衡,所以你可以用它来在一组居于复制的服务器启动虚拟ip,除此之外,它还有实 现数据备份、节点之间重新同步功能的脚本。MySQL本身没有提供replication failover的解决方案,通过MMM方案能实现服务器的故障转移,从而实现mysql的高可用。MMM不仅能提供浮动IP的功能,更可贵的是如果当前 的主服务器挂掉后,会将你后端的从服务器自动转向新的主服务器进行同步复制,不用手工更改同步配置。这个方案是目前比较成熟的解决方案.... 全文

MMM.Mysql 3M模型

mysql高可用方案之mmm架构

环境规划:monitor  IP:192.168.1.247   host:tong1db1       IP:192.168.1.248   host:tong2db2       IP:192.168.1.249   host:tong3数据库:mysql-5.6.21 1.网络环境布置tong1监控节点:... 全文

mysql 高可用方案 mmm架构

基于Multi Master MySQL(MMM)实现Mariadb10读写分离

----本文大纲简介资源配置拓扑图实现过程====================一、简介... 全文

mysql-mmm mariadb 多主高可用

2台主机极致实现双主复制架构及MMM

简介MySQL复制中较常见的复制架构有“一主一从”、“一主多从”、“双主”、“多级复制”和“多主环形机构”等,见下图;最常用,也最灵活的就要数“一主多从”复制架构了,其能满足多种需求,如:为不同的角色使用不同的备库(例如添加不同的索引或使用不同的存储引擎);把一台备库当做待用的主库,除了复制没有其它数据传输;将一台备库放在远程数据中心,用作灾难恢复;延迟一个或多个备库,以备灾难恢复;... 全文

MMM mysqld_multi mysql-mmm 双主复制

MySQL HA by using Mysql

MySQL-mmm-two nodes(master)架构... 全文

mysql mysql-mmm

【MySQL运维】目前主流的 MySQL 集群架构

MySQL双主 + Keepalived主备自动切换方案一MySQL双主 + Keepalived主备自动切换方案二MySQL主从 + Keepalived主从自动切换方案MySQL双主 + 多从高可用方案---MMMMySQL + Pecemaker(Heartbeat) + DRBD主高可用MySQL + RHCS 高可用方案... 全文

mysql mmm mysql架构

mysql

mysql-mmm 安装配置过程系统:centos 6.2 x86_64192.168.101.77 mysql-mmm-agent,mysql-master,vip:192.168.101.7192.168.101.88 mysql-mmm-agent,mysql-master,vip:192.168.101.8192.168.101.33 mysql-mmm monitor192.168.101.77 与192.168.101.88 安装mysql主主同步一、mysql 安装配置过程略二、mysql主主配置192.168.101.77添加主备账号grant replication slave on *.* to 'slave-user'@'192.168.101.88' identified by 'slave';192.168.101.88添加主备账号grant replication slave on *.* to 'slave-user'@'192.168.101.77' identified by 'slave';192.168.101.77 my.cnf增加下面配置文件server-id=1log-bin=mysql-binbinlog_format=ROWlog-slave-updatessync_binlog=1auto_increment_increment=2auto_increment_offset=1skip_slave_start 192.168.101.88 my.cnf 添加下面配置文件server-id=2log-bin=mysql-binbinlog_format=ROWlog-slave-updatessync_binlog=1auto_increment_increment=2auto_increment_offset=1skip_slave_start 注意:192.168.101.77和192.168.101.88里面的server-id 不能重复我是新安装的数据库,所以数据库拷贝就略过了192.168.101.77和88上执行stop slave;flush logs; #关闭当前的二进制日志文件并创建一个新文件,新的二进制日志文件的名字在当前的二进制文件的编号上加1。FLUSH TABLES WITH READ LOCK;  #服务器锁表mysql> show master status;  #主要获取binlog文件名和pos值+---------------+----------+--------------+------------------+-------------------+| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |+---------------+----------+--------------+------------------+-------------------+| binlog.000001 |      120 |              |                  |                   |+---------------+----------+--------------+------------------+-------------------+1 row in set (0.00 sec)192.168.101.77上执行mysql> change master to-> master_host='192.168.101.88',-> master_user='slave-user',-> master_password='slave',-> master_log_file='binlog.000001',-> master_log_pos=120,-> master_connect_retry=10;192.168.101.88执行mysql> change master to-> master_host='192.168.101.77',-> master_user='slave-user',-> master_password='slave',-> master_log_file='mysql-bin.000002',-> master_log_pos=120,-> master_connect_retry=10;start slave;show slave status\G; 查看状态下面两项为Yes说明主备成功Slave_IO_Running: YesSlave_SQL_Running: Yes解锁77和88 服务器UNLOCK TABLES;三、安装过程中的报错情况1.提示连接不上,可能网络原因,账户权限问题,密码错误等 Last_IO_Error: error connecting to master 'slave-user@192.168.11.77:3306' - retry-time: 10  retries: 143 主从连接不上一般是账号密码输入有问题 2.找不到binlog文件 Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: 'Could not find first log file name in binary log index file' 一开始在网上查找是binlog的pos的问题,可是自己试了很多方法,可是不行,后来才发现自己binlog日志文件写错了四、mysql-mmm配置# yum -y install perl perl-develwget http://search.cpan.org/CPAN/authors/id/A/AN/ANDK/CPAN-1.9205.tar.gz[root@centos6 MMM]# tar  zxvf CPAN-1.9205.tar.gz[root@centos6 MMM]# cd CPAN-1.9205[root@open-source CPAN-1.94]# perl Makefile.PL[root@open-source CPAN-1.94]# make[root@open-source CPAN-1.94]# make install报错# perl -MCPAN -e shellTerminal does not support AddHistory.cpan shell -- CPAN exploration and modules installation (v1.9205)ReadLine support available (maybe install Bundle::CPAN or Bundle::CPANxxl?)解决cpan[1]> o conf urllist unshift http://mirrors.sohu.com/CPAN/Please use 'o conf commit' to make the config permanent!cpan[2]> o conf commitcommit: wrote '/usr/lib/perl5/5.10.0/CPAN/Config.pm'cpan[3]> install Bundle::CPANCPAN: Storable loaded ok (v2.18)Going to read /root/.cpan/sources/authors/01mailrc.txt.gz# perl -MCPAN -e shellcpan> install Algorithm::Diffcpan> install DBIcpan>install Log::Dispatchcpan> install Log::Log4perlcpan> install Mail::Sendcpan> install Net::ARPcpan> install Proc::Daemoncpan> install Time::HiRescpan>install DBD::mysqlcpan>install File::statcpan>install File:basename安装mysql-mmm# tar -zxvf mysql-mmm-2.2.1.tar.gz# cd mysql-mmm-2.2.1# make install192.168.101.77和88修改配置文件两个配置文件一样[root@open-source ~]# cat /etc/mysql-mmm/mmm_common.conf active_master_role      writer<host default>    cluster_interface       eth0    pid_path                /var/run/mysql-mmm/mmm_agentd.pid    bin_path                /usr/lib/mysql-mmm/    replication_user        slave-user    replication_password    slave    agent_user              mmm_agent    agent_password          agentpass</host><host open77>    ip      192.168.101.77    mode    master    peer    open77</host><host open88>    ip      192.168.0.88    mode    master    peer    open88</host><role writer>    hosts   open77, open88    ips     192.168.101.7    mode    exclusive</role><role reader>    hosts   open77,open88    ips     192.168.101.8    mode    balanced</role>192.168.101.77# cat /etc/mysql-mmm/mmm_agent.conf   include mmm_common.confthis open77192.168.101.88# cat /etc/mysql-mmm/mmm_agent.conf   include mmm_common.confthis open88192.168.101.77和88启动mysql-mmm-agent[root@open-source ~]# /etc/init.d/mysql-mmm-agent start192.168.101.33[root@open ~]# cat /etc/mysql-mmm/mmm_mon.conf include mmm_common.conf<monitor>    ip                  192.168.101.33    pid_path            /var/run/mysql-mmm/mmm_mond.pid    bin_path            /usr/libexec/mysql-mmm    status_path         /var/lib/mysql-mmm/mmm_mond.status    ping_ips            192.168.101.77, 192.168.101.88    auto_set_online     60</monitor><host default>    monitor_user        mmm_agent    monitor_password    agentpass</host>debug 01.报错mysql ERROR: Can't connect to monitor daemon!将mmm_mon.conf的debug模式开启设为1open2: exec of /usr/libexec/mysql-mmm/monitor/checker  ping_ip failed at /usr/lib/perl5/vendor_perl/5.8.8/MMM/Monitor/Checker.pm line 143是自己的check路径写错了修改该mmm_mon.confbin_path            /usr/lib/mysql-mmm2.错误[root@open-source mysql-mmm]# mmm_control checksopen88  ping         [last change: 2013/12/04 23:33:34]  OKopen88  mysql        [last change: 2013/12/04 23:33:34]  UNKNOWN: Error occurred: install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 16) line 3, <STDIN> line 1.open88  rep_threads  [last change: 2013/12/04 23:33:34]  UNKNOWN: Error occurred: install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 16) line 3, <STDIN> line 1.open88  rep_backlog  [last change: 2013/12/04 23:33:34]  UNKNOWN: Error occurred: install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at (eval 16) line 3, <STDIN> line 1.open77  ping         [last change: 2013/12/04 23:33:34]  OKopen77  mysql        [last change: 2013/12/04 23:33:34]  Perhaps the DBD::mysql perl module hasn't been fully installed,open77  rep_threads  [last change: 2013/12/04 23:33:34]  Perhaps the DBD::mysql perl module hasn't been fully installed,open77  rep_backlog  [last change: 2013/12/04 23:33:34]  Perhaps the DBD::mysql perl module hasn't been fully installed,解决DBD::mysql没有安装好,我下载源码安装[root@open-source DBD-mysql-4.023]# perl Makefile.PL[root@open-source DBD-mysql-4.023]#make[root@open-source DBD-mysql-4.023]#make install[root@open-source ~]# mmm_control checksopen88  ping         [last change: 2013/12/04 23:33:34]  OKopen88  mysql        [last change: 2013/12/05 00:33:32]  OKopen88  rep_threads  [last change: 2013/12/05 00:33:35]  OKopen88  rep_backlog  [last change: 2013/12/05 00:33:35]  OK: Backlog is nullopen77  ping         [last change: 2013/12/04 23:33:34]  OKopen77  mysql        [last change: 2013/12/05 00:33:35]  OKopen77  rep_threads  [last change: 2013/12/05 00:33:35]  OKopen77  rep_backlog  [last change: 2013/12/05 00:33:35]  OK: Backlog is null[root@open-source ~]# mmm_control show  open77(192.168.101.77) master/ONLINE. Roles: reader(192.168.101.8)  open88(192.168.101.88) master/ONLINE. Roles: writer(192.168.101.7)测试停掉192.168.101.88 mysql[root@open2 mysql-mmm]# /etc/init.d/mysqld stopShutting down MySQL......... SUCCESS! [root@open-source ~]# mmm_control show  open77(192.168.101.77) master/ONLINE. Roles: reader(192.168.101.8), writer(192.168.101.7)  open88(192.168.101.88) master/AWAITING_RECOVERY. Roles: [root@open2 mysql-mmm]# /etc/init.d/mysqld start 启动mysqlStarting MySQL............................................... SUCCESS! [root@open-source ~]# mmm_control show  open77(192.168.101.77) master/ONLINE. Roles: writer(192.168.101.7)  open88(192.168.101.88) master/ONLINE. Roles: reader(192.168.101.8)至此mysql-mmm安装完成本文出自 “吾心” 博客,请务必保留此出处http://leeforget.blog.51cto.com/6950397/1338408... 全文

mysql-mmm mysql主主

mysql+mmm实现HA

 引言Master-Slave的数据库机构解决了很多问题,特别是read/write比较高的web2.0应用:1、写操作全部在Master结点执行,并由Slave数据库结点定时(默认60s)读取Master的bin-log2、将众多的用户读请求分散到更多的数据库节点,从而减轻了单点的压力这是对Replication的最基本陈述,这种模式的在系统Scale-out方案中很有引力(如有必要,数据可以先进行Sharding,再使用replication)。它的缺点是:1、Slave实时性的保障,对于实时性很高的场合可能需要做一些处理... 全文

mmm 休闲 职场

使用mysql

背景:之前实现的mysql同步复制功能(见笔者之前文章http://blog.csdn.net/kingofworld/article/details/39210937)只是双机热备功能,还不能做到Mysql链接的自动切换。本配置实现真正的mysql集群,使得在某台机子的mysql应用停止时,能让应用程序自动切换到另外一台机子的mysql连接,实现应用的高稳定性,并且使得扩展Mysql服务成为可能。本配置使用mysql-mmm(master-master Replication Manager for MySQL)组件实现集群功能。本次演示的配置使用三台机器,架构如下:... 全文

集群 架构 mysql mysql-mmm 备份

mysql

mysql-mmm故障解决一例关键字:FATAL Couldn't configure IP 'x.x.x.x' on interface 'eth1': undef... 全文

故障解决 mysql-mmm mysql 数据库 休闲

Mysql

mysql-mmm的作用很简单就是读和写以ip的形式分离出来,并且可以全自动对mysql主从配置进行故障切换。整个架构如下图:操作系统全部为centos5.5 32bitmysql版本为mysql-5.1.59mysql-mmm版本为mysql-mmm-2.2.1另外还需要4个虚拟IP,作用为:192.168.93.141 数据库写入ip192.168.93.142 数据库读取ip192.168.93.143 数据库读取ip192.168.93.144 数据库读取ip一、安装mysql... 全文

mysql 数据库 读写分离 mysql-mmm 故障自动切换

amoeba + mysql

mysql-mmm配置请查看:http://lihuipeng.blog.51cto.com/3064864/689064mysql-mmm只是把数据库的读写功能分离出来,对于web服务器不可能说我要执行读的功能就连接哪个IP,要执行写的功能就连接哪个IP,这是不可能的,解决这一问题我使用amoeba(变形虫)数据库透明代理,根据执行的sql可自动路由至相应的Ip,很好地结合mysql-mmm真正实现读写分离。整个拓扑如下:... 全文

mysql 数据库 读写分离 amoeba mysql-mmm

在搭建mysql

在monitor启动后执行mmm_contorl show时显示下列信息ERROR: Can't connect to monitor daemon!解决思路:修改配置文件将debug=0改为debug=1然后重新启动mysql-mmm-monitor... 全文

mysql-mmm

mysql

mysql-mmm 安装配置过程(两主一备份情况)一、环境说明系统:centos 6.2 x86_64192.168.101.77 mysql-mmm-agent,mysql-master192.168.101.88 mysql-mmm-agent,mysql-master192.168.101.99 mysql-mmm-agent,mysql-slave192.168.101.33 mysql-mmm monitorvip:192.168.101.7 writevip:192.168.101.8 readvip:192.168.101.9 readvip:192.168.101.10 read192.168.101.77 与192.168.101.88 安装mysql主主同步192.168.101.99 配置成192.168.101.77的备二、mysql 安装配置过程略三、mysql主主、主从配置192.168.101.77添加主备账号grant replication slave on *.* to 'slave-user'@'192.168.101.88' identified by 'slave';grant replication slave on *.* to 'slave-user'@'192.168.101.99' identified by 'slave';192.168.101.88添加主备账号grant replication slave on *.* to 'slave-user'@'192.168.101.77' identified by 'slave';grant replication slave on *.* to 'slave-user'@'192.168.101.99' identified by 'slave';192.168.101.99添加主备账号grant replication slave on *.* to 'slave-user'@'192.168.101.77' identified by 'slave';grant replication slave on *.* to 'slave-user'@'192.168.101.88' identified by 'slave';192.168.101.77 my.cnf增加下面配置文件server-id=1log-bin=mysql-binbinlog_format=ROWlog-slave-updatessync_binlog=1auto_increment_increment=2auto_increment_offset=1skip_slave_start 192.168.101.88 my.cnf 添加下面配置文件server-id=2log-bin=mysql-binbinlog_format=ROWlog-slave-updatessync_binlog=1auto_increment_increment=2auto_increment_offset=1skip_slave_start 192.168.101.99 my.cnf 添加下面配置文件server-id=3log-bin=mysql-binlog-slave-updates注意:192.168.101.77,192.168.101.88,192.168.101.99三个里面的server-id 不能重复我是新安装的数据库,所以数据库拷贝就略过了192.168.101.77/88/99上执行stop slave;flush logs; #关闭当前的二进制日志文件并创建一个新文件,新的二进制日志文件的名字在当前的二进制文件的编号上加1。FLUSH TABLES WITH READ LOCK;  #服务器锁表mysql> show master status;  #主要获取binlog文件名和pos值+---------------+----------+--------------+------------------+-------------------+| File          | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |+---------------+----------+--------------+------------------+-------------------+| binlog.000001 |      120 |              |                  |                   |+---------------+----------+--------------+------------------+-------------------+1 row in set (0.00 sec)192.168.101.77上执行mysql> change master to-> master_host='192.168.101.88',-> master_user='slave-user',-> master_password='slave',-> master_log_file='binlog.000001',-> master_log_pos=120,-> master_connect_retry=10;192.168.101.88/99执行mysql> change master to-> master_host='192.168.101.77',-> master_user='slave-user',-> master_password='slave',-> master_log_file='mysql-bin.000002',-> master_log_pos=120,-> master_connect_retry=10;start slave;show slave status\G; 查看状态下面两项为Yes说明主备成功Slave_IO_Running: YesSlave_SQL_Running: Yes解锁77/88/99服务器UNLOCK TABLES;192.168.101.77/88/99三台都要添加权限grant super,replication client,process on *.* to 'mmm_agent'@'192.168.101.%' identified by 'agentpass';四、mysql-mmm配置# yum -y install perl perl-develwget http://search.cpan.org/CPAN/authors/id/A/AN/ANDK/CPAN-1.9205.tar.gz[root@centos6 MMM]# tar  zxvf CPAN-1.9205.tar.gz[root@centos6 MMM]# cd CPAN-1.9205[root@open-source CPAN-1.94]# perl Makefile.PL[root@open-source CPAN-1.94]# make[root@open-source CPAN-1.94]# make install# perl -MCPAN -e shellcpan> install Algorithm::Diffcpan> install DBIcpan>install Log::Dispatchcpan> install Log::Log4perlcpan> install Mail::Sendcpan> install Net::ARPcpan> install Proc::Daemoncpan> install Time::HiRescpan>install DBD::mysqlcpan>install File::statcpan>install File:basename安装mysql-mmm# tar -zxvf mysql-mmm-2.2.1.tar.gz# cd mysql-mmm-2.2.1# make install192.168.101.77/88/99修改配置文件两个配置文件一样[root@open-source ~]# cat /etc/mysql-mmm/mmm_common.conf active_master_role      writer<host default>    cluster_interface       eth0    pid_path                /var/run/mysql-mmm/mmm_agentd.pid    bin_path                /usr/lib/mysql-mmm/    replication_user        slave-user    replication_password    slave    agent_user              mmm_agent    agent_password          agentpass</host><host open77>    ip      192.168.101.77    mode    master    peer    open77</host><host open88>    ip      192.168.101.88    mode    master    peer    open88</host><host open99>    ip      192.168.101.99    mode    slave</host><role writer>    hosts   open77, open88    ips     192.168.101.7    mode    exclusive</role><role reader>    hosts   open77,open88,open99    ips     192.168.101.8,192.168101.9,192.168.101.10    mode    balanced</role>192.168.101.77# cat /etc/mysql-mmm/mmm_agent.conf   include mmm_common.confthis open77192.168.101.88# cat /etc/mysql-mmm/mmm_agent.conf   include mmm_common.confthis open88192.168.101.99# cat /etc/mysql-mmm/mmm_agent.conf   include mmm_common.confthis open99192.168.101.77/88/99启动mysql-mmm-agent[root@open-source ~]# /etc/init.d/mysql-mmm-agent start192.168.101.33[root@open ~]# cat /etc/mysql-mmm/mmm_mon.conf include mmm_common.conf<monitor>    ip                  192.168.101.33    pid_path            /var/run/mysql-mmm/mmm_mond.pid    bin_path            /usr/libexec/mysql-mmm    status_path         /var/lib/mysql-mmm/mmm_mond.status    ping_ips            192.168.101.77, 192.168.101.88,192.168.101.99    auto_set_online     60</monitor><host default>    monitor_user        mmm_agent    monitor_password    agentpass</host>debug 0启动服务(注意修改启动文件,将bin和pid路径指到你自己的配置路径)[root@open-source ~]# /etc/init.d/mysql-mmm-monitor start[root@open-source ~]# /etc/init.d/mysql-mmm-agent start测试1.查看是否所有都正常[root@salt-server ~]# mmm_control show  open77(192.168.101.77) master/ONLINE. Roles: reader(192.168.101.8), writer(192.168.101.7)  open88(192.168.101.88) master/ONLINE. Roles: reader(192.168.101.10)  open99(192.168.101.99) slave/ONLINE. Roles: reader(192.168101.9)[root@salt-server ~]# mmm_control checks allopen88  ping         [last change: 2013/12/04 23:45:12]  OKopen88  mysql        [last change: 2013/12/04 23:45:12]  OKopen88  rep_threads  [last change: 2013/12/04 23:45:12]  OKopen88  rep_backlog  [last change: 2013/12/04 23:48:28]  OK: Backlog is nullopen99  ping         [last change: 2013/12/04 23:45:12]  OKopen99  mysql        [last change: 2013/12/04 23:45:12]  OKopen99  rep_threads  [last change: 2013/12/04 23:45:12]  OKopen99  rep_backlog  [last change: 2013/12/04 23:45:12]  OK: Backlog is nullopen77  ping         [last change: 2013/12/04 23:45:12]  OKopen77  mysql        [last change: 2013/12/04 23:45:12]  OKopen77  rep_threads  [last change: 2013/12/04 23:45:12]  OKopen77  rep_backlog  [last change: 2013/12/04 23:48:28]  OK: Backlog is null2.停掉192.168.101.88 mysql[root@open2 ~]# /etc/init.d/mysqld stopShutting down MySQL. SUCCESS! show可以看到读切换到了99备上[root@salt-server ~]# mmm_control show  open77(192.168.101.77) master/ONLINE. Roles: reader(192.168.101.8), writer(192.168.101.7)  open88(192.168.101.88) master/HARD_OFFLINE. Roles:  open99(192.168.101.99) slave/ONLINE. Roles: reader(192.168.101.10), reader(192.168101.9)[root@salt-server ~]# mmm_control checks allopen88  ping         [last change: 2013/12/04 23:45:12]  OKopen88  mysql        [last change: 2013/12/04 23:51:37]  ERROR: Connect error (host = 192.168.101.88:3306, user = mmm_agent)! Can't connect to MySQL server on '192.168.101.88' (111)open88  rep_threads  [last change: 2013/12/04 23:45:12]  OKopen88  rep_backlog  [last change: 2013/12/04 23:48:28]  OK: Backlog is nullopen99  ping         [last change: 2013/12/04 23:45:12]  OKopen99  mysql        [last change: 2013/12/04 23:45:12]  OKopen99  rep_threads  [last change: 2013/12/04 23:45:12]  OKopen99  rep_backlog  [last change: 2013/12/04 23:45:12]  OK: Backlog is nullopen77  ping         [last change: 2013/12/04 23:45:12]  OKopen77  mysql        [last change: 2013/12/04 23:45:12]  OKopen77  rep_threads  [last change: 2013/12/04 23:45:12]  OKopen77  rep_backlog  [last change: 2013/12/04 23:48:28]  OK: Backlog is null3.启动88上mysql[root@salt-server ~]# mmm_control show  open77(192.168.101.77) master/ONLINE. Roles: reader(192.168.101.8), writer(192.168.101.7)  open88(192.168.101.88) master/AWAITING_RECOVERY. Roles:  open99(192.168.101.99) slave/ONLINE. Roles: reader(192.168.101.10), reader(192.168101.9)等一会儿一切正常[root@salt-server ~]# mmm_control show  open77(192.168.101.77) master/ONLINE. Roles: reader(192.168.101.8), writer(192.168.101.7)  open88(192.168.101.88) master/ONLINE. Roles: reader(192.168.101.10)  open99(192.168.101.99) slave/ONLINE. Roles: reader(192.168101.9)4.停掉77写的数据库,可以看到写自动切换到88上了[root@salt-server ~]# mmm_control show        open77(192.168.101.77) master/HARD_OFFLINE. Roles:  open88(192.168.101.88) master/ONLINE. Roles: reader(192.168.101.10), writer(192.168.101.7)  open99(192.168.101.99) slave/ONLINE. Roles: reader(192.168.101.8), reader(192.168101.9)5.如果看到某一台总是AWAITING_RECOVERY. Roles:自动起不来,可以手动起来  [root@salt-server ~]# mmm_control show  open77(192.168.101.77) master/AWAITING_RECOVERY. Roles:  open88(192.168.101.88) master/ONLINE. Roles: reader(192.168.101.10), writer(192.168.101.7)  open99(192.168.101.99) slave/ONLINE. Roles: reader(192.168.101.8), reader(192.168101.9)[root@salt-server ~]# mmm_control set_online open77OK: State of 'open77' changed to ONLINE. Now you can wait some time and check its new roles![root@salt-server ~]# mmm_control show    open77(192.168.101.77) master/ONLINE. Roles: reader(192.168101.9)  open88(192.168.101.88) master/ONLINE. Roles: reader(192.168.101.10), writer(192.168.101.7)  open99(192.168.101.99) slave/ONLINE. Roles: reader(192.168.101.8)6.如果99备一开始设置的77为master,当77mysql宕掉后,最自动切换到88为master本文出自 “吾心” 博客,请务必保留此出处http://leeforget.blog.51cto.com/6950397/1343110... 全文

mysql-mmm 安装配置

1 2