MySQL(MMM架构使用)
本案例要求基于普通版的MySQL服务器改造MMM架构,完成以下任务操作:
启动MMM集群架构
设置集群中服务器为online状态
MySQL-MMM架构部署完成后需要启动,数据库端启动mmm-agent进程,管理端启动mmm-monitor进程,启动完成后设置所有数据库主机状态为online。
实现此案例需要按照如下步骤进行。
步骤一:启动MMM集群架构
1)启动mmm-agent进程
master1操作:
[root@master1 ~]# /etc/init.d/mysql-mmm-agent start
Daemon bin: '/usr/sbin/mmm_agentd'
Daemon pid: '/var/run/mmm_agentd.pid'
Starting MMM Agent daemon... Ok
master2操作:
[root@master2 ~]# /etc/init.d/mysql-mmm-agent start
Daemon bin: '/usr/sbin/mmm_agentd'
Daemon pid: '/var/run/mmm_agentd.pid'
Starting MMM Agent daemon... Ok
slave1操作:
[root@master2 ~]# /etc/init.d/mysql-mmm-agent start
Daemon bin: '/usr/sbin/mmm_agentd'
Daemon pid: '/var/run/mmm_agentd.pid'
Starting MMM Agent daemon... Ok
slave2操作:
[root@slave2 ~]# /etc/init.d/mysql-mmm-agent start
Daemon bin: '/usr/sbin/mmm_agentd'
Daemon pid: '/var/run/mmm_agentd.pid'
Starting MMM Agent daemon... Ok
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2)启动mmm-monitor进程
monitor主机操作:
[root@monitor ~]# /etc/init.d/mysql-mmm-monitor start
Daemon bin: '/usr/sbin/mmm_mond'
Daemon pid: '/var/run/mmm_mond.pid'
Starting MMM Monitor daemon: Ok
1
2
3
4
5
步骤二:设置集群中服务器为online状态
控制命令只能在管理端monitor服务器上执行。
查看当前集群中各服务器状态:
[root@monitor ~]# mmm_control show
master1(192.168.4.10) master/AWAITING_RECOVERY. Roles:
master2(192.168.4.11) master/AWAITING_RECOVERY. Roles:
slave1(192.168.4.12) slave/AWAITING_RECOVERY. Roles:
slave2(192.168.4.13) slave/AWAITING_RECOVERY. Roles:
设置4台数据库主机状态为online:
[root@monitor ~]# mmm_control set_online master1
OK: State of 'master1' changed to ONLINE. Now you can wait some time and check its new roles!
[root@monitor ~]# mmm_control set_online master2
OK: State of 'master2' changed to ONLINE. Now you can wait some time and check its new roles!
[root@monitor ~]# mmm_control set_online slave1
OK: State of 'slave1' changed to ONLINE. Now you can wait some time and check its new roles!
[root@monitor ~]# mmm_control set_online slave2
OK: State of 'slave2' changed to ONLINE. Now you can wait some time and check its new roles!
[root@monitor ~]#
再次查看当前集群中各服务器状态:
[root@monitor ~]# mmm_control show
master1(192.168.4.10) master/ONLINE. Roles: writer(192.168.4.200)
master2(192.168.4.11) master/ONLINE. Roles:
slave1(192.168.4.12) slave/ONLINE. Roles: reader(192.168.4.201)
slave2(192.168.4.13) slave/ONLINE. Roles: reader(192.168.4.202)
[root@monitor ~]#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
步骤三:测试MySQL-MMM架构
1)客户机安装MySQL-client软件包
[root@client ~]# tar xvf MySQL-5.6.15-1.el6.x86_64.rpm-bundle.tar
.. ..
[root@client ~]# rpm -ivh MySQL-client-5.6.15-1.el6.x86_64.rpm
.. ..
1
2
3
4
2)MySQL-MMM虚拟IP访问测试
[root@client ~]# mysql -h192.168.4.200 -uroot -ppwd123 -e "show databases"
Warning: Using a password on the command line interface can be insecure.
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| tarena |
| test |
+--------------------+
[root@client ~]#
[root@client ~]# mysql -h192.168.4.200 -uroot -ppwd123 -e "show databases"
Warning: Using a password on the command line interface can be insecure.
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| tarena |
| test |
+--------------------+
[root@client ~]#
[root@client ~]# mysql -h192.168.4.202 -uroot -ppwd123 -e "show databases"
Warning: Using a password on the command line interface can be insecure.
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| tarena |
| test |
+--------------------+
[root@client ~]#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
3)主数据库宕机测试
[
root@master1 ~]# service mysql stop //停止master1上服务
Shutting down MySQL.... [确定]
[root@master1 ~]#
[root@monitor ~]# mmm_control show //查看集群内服务器状态
通过输出信息可以看到虚拟IP从master1切换到master2:
master1(192.168.4.10) master/HARD_OFFLINE. Roles:
master2(192.168.4.11) master/ONLINE. Roles: writer(192.168.4.200)
slave1(192.168.4.12) slave/ONLINE. Roles: reader(192.168.4.201)
slave2(192.168.4.13) slave/ONLINE. Roles: reader(192.168.4.202)
[root@monitor ~]#
[root@client ~]# mysql -h192.168.4.200 -uroot -ppwd123 -e "show databases" //访问虚拟IP测试
Warning: Using a password on the command line interface can be insecure.
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| tarena |
| test |
+--------------------+
[root@client ~]#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
MySQL(MMM架构使用)的更多相关文章
- CENTOS6.6下mysql MMM架构搭建
本文来自我的github pages博客http://galengao.github.io/ 即www.gaohuirong.cn MMM(Master-Master replication mana ...
- MySQL 半同步复制+MMM架构
200 ? "200px" : this.width)!important;} --> 介绍 上篇文章介绍了MMM架构的实现方法,但是上篇文章的MMM方案的复制是异步复制,异 ...
- MySQL MMM高可用方案
200 ? "200px" : this.width)!important;} --> 介绍 本篇文章主要介绍搭建MMM方案以及MMM架构的原理.这里不介绍主从.主主的搭建方 ...
- Mysql MMM 高可用
一.Mysql MMM 高可用概况: mmm_mond 负责所有的监控工作的监控守护进程,决定节点的移除等: mmm_agentd 运行在mysql服务器上的代理守护进程,通过简单远程服务集提供给 ...
- MySQL高级知识- MySQL的架构介绍
[TOC] 1.MySQL 简介 概述 MySQL是一个关系型数据库管理系统,由瑞典MySQL AB公司开发,目前属于Oracle公司. MySQL是一种关联数据库管理系统,将数据保存在不同的表中,而 ...
- 从 MySQL+MMM 到 MariaDB+Galera Cluster : 一个高可用性系统改造
很少有事情比推出高可用性(HA)系统之后便经常看到的系统崩溃更糟糕.对于我们这个Rails运行机的团队来说,这个失效的HA系统是MySQL多主复制管理器(MMM). 我们已经找寻MMM的替代品有一段时 ...
- MySQL 体系架构
MySQL 体系架构 本篇文章是对mysql体系结构进行了详细的分析介绍,需要的朋友参考下 上面一图是mysql的概览图,我们从上往下看, 我们把上面一图一分为二,我们可以吧它分为两个部分, 1,是c ...
- MySQL 主从架构配置详解
无论是哪一种数据库,数据的安全都是至关重要的,因此熟练掌握数据库的安全备份功能,是作为开发人员,特别是后端开发人员的一项必备技能.MySQL 数据库内建的复制功能,可以帮助我们对数据进行异地备份,读写 ...
- 高性能mysql主存架构
原文:高性能mysql主存架构 MySQL Replication(Master与Slave基本原理及配置) 主从mysql工作原理: 1:过程: (1)Mysql的复制(replication)是一 ...
随机推荐
- ubuntu安装ibus-goolepinyin通用方法
1:获取安装包 http://code.google.com/p/libgooglepinyin/downloads/list
- 【T^T 1736】【FJUTOJ 1077】排座位
http://59.77.139.92/problem.php?id=1077 水题,小心PE // <1736.cpp> - 11/12/16 17:17:52 // This file ...
- plink 与 ssh 远程登录问题
plink 是一种 putty-tools,ubuntu 环境下,如果没有安装 plink,可通过如下方法进行安装: $ echo y | sudo apt-get install plink 1. ...
- git 一次删除所有删除的文件
/*********************************************************************************** * git 一次删除所有删除的 ...
- AutoIT: 处理GridView控件的一些折中方法
一般情况下,Gridview是无法通过AutoIT Window Info来获取控件信息的,但是可以有折中的办法对Gridview中的字段赋值. #include<array.au3> $ ...
- 逆向分析一个完整的C++程序包含寄存器与参数传递详解
最近在分析C++ dump 文件的时候觉得有必要将一些必要的反汇编东西总结一下以备别人参考,自己有时间的时候也可以进行更多的改进.下面通过一个简单的C++代码转成汇编代码后的详细解释说明一下C++和汇 ...
- appium学习【五】【转】appium实现屏幕向左滑动
转自http://www.cnblogs.com/testhub/p/5949668.html 前些日子写一个滑动手机页面的小脚本,看到大家给的内容都是swipe方法,这里对swipe方法做一个小介绍 ...
- artemplate include
include用于嵌入字模板 {{include 'template_name'}} 子模板 默认共享当前的数据 也可以自己指定数据 {{include 'template_name' templat ...
- python 面向对象九 定制类
一.定制类,实质就是我们自己重写特殊函数 看到类似__slots__这种形如__xxx__的变量或者函数名就要注意,这些在Python中是有特殊用途的. __slots__我们已经知道怎么用了,__l ...
- java多线程模拟龟兔赛跑
让乌龟和兔子在同一个赛道从1开始跑到100,看看谁更快. public class Racer implements Runnable{ private static String winner;// ...