MySQL-MMM高可用集群搭建实战(全程可跟做!)

MMM高可用集群案例拓扑图:

环境准备:

主服务器1:192.168.18.146 db1 vip:192.168.18.250

主服务器2:192.168.18.147 db2

从服务器1:192.168.18.128 db3 vip:192.168.18.251

从服务器2:192.168.18.148 db4 vip:192.168.18.252

监控服务器:192.168.18.145

Master1:

[[email protected] ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[[email protected] ~]# yum install epel-release -y
[[email protected] ~]# yum clean all && yum makecache
[[email protected] ~]# vim /etc/my.cnf
//在行首按9dd删除9行
[mysqld]
log_error=/var/lib/mysql/mysql.err
log=/var/lib/mysql/mysql_log.log
log_slow_queries=/var/lib/mysql_slow_queris.log
binlog-ignore-db=mysql,information_schema
character_set_server=utf8
log_bin=mysql_bin
server_id=1
log_slave_updates=true
sync_binlog=1
auto_increment_increment=2
auto_increment_offset=1
//输入:wq保存退出
[[email protected] ~]# systemctl start mariadb.service
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# setenforce 0
[[email protected] ~]# netstat -ntap | grep 3306
tcp        0      0 0.0.0.0:3306            0.0.0.0:*        LISTEN      2989/mysqld
[[email protected] ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]> show master status;
+------------------+----------+--------------+--------------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB         |
+------------------+----------+--------------+--------------------------+
| mysql_bin.000001 |      245 |              | mysql,information_schema |
+------------------+----------+--------------+--------------------------+
1 row in set (0.00 sec)

MariaDB [(none)]> grant replication slave on *.* to ‘replication‘@‘192.168.18.%‘ identified by ‘123456‘;
Query OK, 0 rows affected (0.02 sec)

MariaDB [(none)]> change master to master_host=‘192.168.18.147‘,master_user=‘replication‘,master_password=‘123456‘,master_log_file=‘mysql_bin.000001‘,master_log_pos=245;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.18.147
                  Master_User: replication
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql_bin.000001
          Read_Master_Log_Pos: 575
               Relay_Log_File: mariadb-relay-bin.000002
                Relay_Log_Pos: 694
        Relay_Master_Log_File: mysql_bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
......以下省略多行
//以上两个状态显示为YSE就是正常

MariaDB [(none)]> create database school;
Query OK, 1 row affected (0.00 sec)
//创建school

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)
//因为从master2中删除了数据库中的school,所以master1中同步删除

MariaDB [(none)]> create database myschool;
Query OK, 1 row affected (0.01 sec)
//两台从服务器上开启同步过后,在master1上创建myschool

Master2:

[[email protected] ~]# yum install epel-release -y
[[email protected] ~]# yum clean all && yum makecache
[[email protected] ~]# vim /etc/my.cnf
//在行首按9dd删除9行
[mysqld]
log_error=/var/lib/mysql/mysql.err
log=/var/lib/mysql/mysql_log.log
log_slow_queries=/var/lib/mysql_slow_queris.log
binlog-ignore-db=mysql,information_schema
character_set_server=utf8
log_bin=mysql_bin
server_id=2
log_slave_updates=true
sync_binlog=1
auto_increment_increment=2
auto_increment_offset=1
//输入:wq保存退出
[[email protected] ~]# systemctl start mariadb.service
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# setenforce 0
[[email protected] ~]# netstat -ntap | grep 3306
tcp        0      0 0.0.0.0:3306            0.0.0.0:*        LISTEN      2989/mysqld
[[email protected] ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 3
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]> show master status;
+------------------+----------+--------------+--------------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB         |
+------------------+----------+--------------+--------------------------+
| mysql_bin.000001 |      245 |              | mysql,information_schema |
+------------------+----------+--------------+--------------------------+
1 row in set (0.00 sec)

MariaDB [(none)]> grant replication slave on *.* to ‘replication‘@‘192.168.18.%‘ identified by ‘123456‘;
Query OK, 0 rows affected (0.02 sec)

MariaDB [(none)]> change master to master_host=‘192.168.18.146‘,master_user=‘replication‘,master_password=‘123456‘,master_log_file=‘mysql_bin.000001‘,master_log_pos=245;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 192.168.18.146
                  Master_User: replication
                  Master_Port: 3306
                Connect_Retry: 60
              Master_Log_File: mysql_bin.000001
          Read_Master_Log_Pos: 575
               Relay_Log_File: mariadb-relay-bin.000002
                Relay_Log_Pos: 694
        Relay_Master_Log_File: mysql_bin.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
......以下省略多行
//以上两个状态显示为YSE就是正常

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| school             |
| test               |
+--------------------+
5 rows in set (0.00 sec)
//此时可以看到在master1中建的school

MariaDB [(none)]> drop database school;
Query OK, 0 rows affected (0.01 sec)
//删除数据中的school
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| test               |
+--------------------+
4 rows in set (0.00 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| myschool           |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.01 sec)
//此时可以同步到master1上的更新数据

Slave1:

[[email protected] ~]# yum install epel-release -y
[[email protected] ~]# yum clean all && yum makecache
[[email protected] ~]# vim /etc/my.cnf
//在行首按9dd删除9行
[mysqld]
log_error=/var/lib/mysql/mysql.err
log=/var/lib/mysql/mysql_log.log
log_slow_queries=/var/lib/mysql_slow_queris.log
binlog-ignore-db=mysql,information_schema
character_set_server=utf8
log_bin=mysql_bin
server_id=3
log_slave_updates=true
sync_binlog=1
auto_increment_increment=2
auto_increment_offset=1
//输入:wq保存退出
[[email protected] ~]# systemctl start mariadb.service
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# setenforce 0
[[email protected] ~]# netstat -ntap | grep 3306
tcp        0      0 0.0.0.0:3306            0.0.0.0:*        LISTEN      2989/mysqld
[[email protected] ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]> change master to master_host=‘192.168.18.146‘,master_user=‘replication‘,master_password=‘123456‘,master_log_file=‘mysql_bin.000001‘,master_log_pos=245;

MariaDB [(none)]> start slave;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| myschool           |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.01 sec)
//此时可以同步到master1上的更新数据

Slave2:

[[email protected] ~]# yum install epel-release -y
[[email protected] ~]# yum clean all && yum makecache
[[email protected] ~]# vim /etc/my.cnf
//在行首按9dd删除9行
[mysqld]
log_error=/var/lib/mysql/mysql.err
log=/var/lib/mysql/mysql_log.log
log_slow_queries=/var/lib/mysql_slow_queris.log
binlog-ignore-db=mysql,information_schema
character_set_server=utf8
log_bin=mysql_bin
server_id=4
log_slave_updates=true
sync_binlog=1
auto_increment_increment=2
auto_increment_offset=1
//输入:wq保存退出
[[email protected] ~]# systemctl start mariadb.service
[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# setenforce 0
[[email protected] ~]# netstat -ntap | grep 3306
tcp        0      0 0.0.0.0:3306            0.0.0.0:*        LISTEN      2989/mysqld
[[email protected] ~]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.
MariaDB [(none)]> change master to master_host=‘192.168.18.146‘,master_user=‘replication‘,master_password=‘123456‘,master_log_file=‘mysql_bin.000001‘,master_log_pos=245;

MariaDB [(none)]> start slave;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| myschool           |
| mysql              |
| performance_schema |
| test               |
+--------------------+
5 rows in set (0.01 sec)
//此时可以同步到master1上的更新数据

安装高群集可用软件:

[[email protected] ~]# yum install mysql-mmm* -y
//五台服务器都需要安装,包括监控服务器
//此处监控服务器区别于其他服务器,需要先:yum install epel-release -y

//在master1中修改配置文件:
[[email protected] ~]# cd /etc/mysql-mmm/
[[email protected] mysql-mmm]# ls
mmm_agent.conf  mmm_common.conf  mmm_mon.conf  mmm_mon_log.conf  mmm_tools.conf
[[email protected] mysql-mmm]# vim mmm_common.conf
active_master_role      writer

<host default>
    cluster_interface       ens33
    pid_path                /run/mysql-mmm-agent.pid
    bin_path                /usr/libexec/mysql-mmm/
    replication_user        replication
    replication_password    123456
    agent_user              mmm_agent
    agent_password          123456
</host>

<host db1>
    ip      192.168.18.146      //master1的IP地址
    mode    master
    peer    db2
</host>

<host db2>
    ip      192.168.18.147      //master2的IP地址
    mode    master
    peer    db1
</host>

<host db3>
    ip      192.168.18.128      //slave1的IP地址
    mode    slave
</host>

<host db4>
    ip      192.168.18.148      //slave2的IP地址
    mode    slave
</host>

<role writer>
    hosts   db1, db2
    ips     192.168.18.250
    mode    exclusive
</role>

<role reader>
    hosts   db3, db4
    ips     192.168.18.251, 192.168.18.252
    mode    balanced
</role>
~
//修改完成后输入:wq保存退出

//同步此配置文件到另外四台服务器上,需要输yes确定,并输入对应账户的密码
[[email protected] mysql-mmm]# scp mmm_common.conf [email protected]:/etc/mysql-mmm/
Are you sure you want to continue connecting (yes/no)? yes
[email protected]‘s password:
mmm_common.conf                                   100%  837   622.3KB/s   00:00
[[email protected] mysql-mmm]# scp mmm_common.conf [email protected]:/etc/mysql-mmm/
Are you sure you want to continue connecting (yes/no)? yes
[email protected]‘s password:
mmm_common.conf                                   100%  837   941.1KB/s   00:00
[[email protected] mysql-mmm]# scp mmm_common.conf [email protected]:/etc/mysql-mmm/
Are you sure you want to continue connecting (yes/no)? yes
[email protected]‘s password:
mmm_common.conf                                   100%  837   805.6KB/s   00:00
[[email protected] mysql-mmm]# scp mmm_common.conf [email protected]:/etc/mysql-mmm/
Are you sure you want to continue connecting (yes/no)? yes
[email protected]‘s password:
mmm_common.conf                                   100%  837   775.5KB/s   00:00

Monitor监控服务器上的操作:

[[email protected] ~]# systemctl stop firewalld.service
[[email protected] ~]# setenforce 0
[[email protected] ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[[email protected] ~]# yum install mysql-mmm* -y
[[email protected] mysql-mmm]# yum clean all && yum makecache
[[email protected] ~]# yum install mariadb mariadb-server -y

每台数据库服务器中进行授权代理:

[[email protected] mysql-mmm]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MariaDB [(none)]> grant super, replication client, process on *.* to ‘mmm_agent‘@‘192.168.18.%‘ identified by ‘123456‘;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> grant replication client on *.* to ‘mmm_monitor‘@‘192.168.18.%‘ identified by ‘123456‘;
Query OK, 0 rows affected (0.01 sec)

MariaDB [(none)]> flush privileges;         //刷新数据
Query OK, 0 rows affected (0.00 sec)

每台服务器上设定代理名称的操作:

两台主服务器上:
[[email protected] mysql-mmm]# vim mmm_agent.conf
//master1中,this is db1
//master2中,this is db2

两台从服务器上:
[[email protected] ~]# cd /etc/mysql-mmm/
[[email protected] mysql-mmm]# vim mmm_agent.conf
//slave1中,this is db3
//slave2中,this is db4

修改完成后输入:wq保存退出

所有主从服务器上开启代理功能:

[[email protected] mysql-mmm]# systemctl start mysql-mmm-agent.service
[[email protected] mysql-mmm]# systemctl enable mysql-mmm-agent.service 

开启监控服务:

[[email protected] mysql-mmm]# systemctl start mysql-mmm-monitor.service

验证地址是否漂移:

[[email protected] mysql-mmm]# mmm_control show
  db1(192.168.18.146) master/ONLINE. Roles: writer(192.168.18.250)
  db2(192.168.18.147) master/ONLINE. Roles:
  db3(192.168.18.128) slave/ONLINE. Roles: reader(192.168.18.251)
  db4(192.168.18.148) slave/ONLINE. Roles: reader(192.168.18.252)

//利用命令调整虚拟IP切换至master2:
[[email protected] mysql-mmm]# mmm_control move_role writer db2
OK: Role ‘writer‘ has been moved from ‘db1‘ to ‘db2‘. Now you can wait some time and check new roles info!
[[email protected] mysql-mmm]# mmm_control show
  db1(192.168.18.146) master/ONLINE. Roles:
  db2(192.168.18.147) master/ONLINE. Roles: writer(192.168.18.250)
  db3(192.168.18.128) slave/ONLINE. Roles: reader(192.168.18.251)
  db4(192.168.18.148) slave/ONLINE. Roles: reader(192.168.18.252)

//检测所有状态是否都正常:
[[email protected] mysql-mmm]# mmm_control checks all
db4  ping         [last change: 2019/11/25 15:25:54]  OK
db4  mysql        [last change: 2019/11/25 15:25:54]  OK
db4  rep_threads  [last change: 2019/11/25 15:25:54]  OK
db4  rep_backlog  [last change: 2019/11/25 15:25:54]  OK: Backlog is null
db2  ping         [last change: 2019/11/25 15:25:54]  OK
db2  mysql        [last change: 2019/11/25 15:25:54]  OK
db2  rep_threads  [last change: 2019/11/25 15:25:54]  OK
db2  rep_backlog  [last change: 2019/11/25 15:25:54]  OK: Backlog is null
db3  ping         [last change: 2019/11/25 15:25:54]  OK
db3  mysql        [last change: 2019/11/25 15:25:54]  OK
db3  rep_threads  [last change: 2019/11/25 15:25:54]  OK
db3  rep_backlog  [last change: 2019/11/25 15:25:54]  OK: Backlog is null
db1  ping         [last change: 2019/11/25 15:25:54]  OK
db1  mysql        [last change: 2019/11/25 15:25:54]  OK
db1  rep_threads  [last change: 2019/11/25 15:25:54]  OK
db1  rep_backlog  [last change: 2019/11/25 15:25:54]  OK: Backlog is null

以上就是所有的群集功能都完成了!

故障测试:

在监控服务器中把地址切回db1:

[[email protected] mysql-mmm]# mmm_control move_role writer db1
OK: Role ‘writer‘ has been moved from ‘db2‘ to ‘db1‘. Now you can wait some time and check new roles info!
[[email protected] mysql-mmm]# mmm_control show
  db1(192.168.18.146) master/ONLINE. Roles: writer(192.168.18.250)
  db2(192.168.18.147) master/ONLINE. Roles:
  db3(192.168.18.128) slave/ONLINE. Roles: reader(192.168.18.251)
  db4(192.168.18.148) slave/ONLINE. Roles: reader(192.168.18.252)

在master1中关闭服务:

[[email protected] mysql-mmm]# systemctl stop mariadb.service

时再回到监控服务器中看是否会自动进行地址漂移:

[[email protected] mysql-mmm]# mmm_control show
  db1(192.168.18.146) master/HARD_OFFLINE. Roles:
  db2(192.168.18.147) master/ONLINE. Roles: writer(192.168.18.250)
  db3(192.168.18.128) slave/ONLINE. Roles: reader(192.168.18.251)
  db4(192.168.18.148) slave/ONLINE. Roles: reader(192.168.18.252)
//此时因为master1宕机,所以地址自动漂移到master2下

如果此时master1再次上线,不会抢占vip虚拟地址!

如果我们把slave1给宕机,再回到监控服务器,此时两个虚拟IP地址后会给到slave2从服务器:

[[email protected] mysql-mmm]# mmm_control show
  db1(192.168.18.146) master/ONLINE. Roles:
  db2(192.168.18.147) master/ONLINE. Roles: writer(192.168.18.250)
  db3(192.168.18.128) slave/HARD_OFFLINE. Roles:
  db4(192.168.18.148) slave/ONLINE. Roles: reader(192.168.18.251), reader(192.168.18.252)
//两个虚拟IP都会给到slave2(db4)

如果此时恢复slave1上线,那么192.168.18.251这个虚拟地址又重新回到slave1上!

在Master1上为监控服务器地址授权登录:

[[email protected] mysql-mmm]# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 796
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MariaDB [(none)]> grant all on *.* to ‘zzz‘@‘192.168.18.145‘ identified by ‘123456‘;
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)

在监控服务器上验证:

[[email protected] mysql-mmm]# mysql -u zzz -p -h 192.168.18.250
Enter password:         //输入zzz用户的密码
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2376
Server version: 5.5.64-MariaDB MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

MariaDB [(none)]> create database KGC;          //创建KGC的数据库
Query OK, 1 row affected (0.01 sec)

**再回到master1上验证是否可以同步:**
MariaDB [(none)]>  show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| KGC                |
| myschool           |
| mysql              |
| performance_schema |
| test               |
+--------------------+
6 rows in set (0.01 sec)

此时所有主从服务器上均可同步到KGC的数据库!

原文地址:https://blog.51cto.com/14464303/2453313

时间: 2024-10-10 00:07:48

MySQL-MMM高可用集群搭建实战(全程可跟做!)的相关文章

基于keepalived搭建MySQL的高可用集群

http://www.cnblogs.com/ivictor/p/5522383.html 基于keepalived搭建MySQL的高可用集群 MySQL的高可用方案一般有如下几种: keepalived+双主,MHA,MMM,Heartbeat+DRBD,PXC,Galera Cluster 比较常用的是keepalived+双主,MHA和PXC. 对于小公司,一般推荐使用keepalived+双主,简单. 下面来部署一下 配置环境: 角色                          

MySQL主从复制、读写分离、高可用集群搭建

MySQL主从复制.读写分离.高可用集群搭建  一.服务介绍   1.1 Keepalived     Keepalived,见名知意,即保持存活,其目的是解决单点故障,当一台服务器宕机或者故障时自动切换到其他的服务器中.Keepalived是基于VRRP协议实现的.VRRP协议是用于实现路由器冗余的协议,VRRP协议将两台或多台路由器设备虚拟成虚拟设备,可以对外提供虚拟路由器IP(一个或多个),即漂移IP(VIP). 1.2 ProxySQL ProxySQL是一个高性能,高可用性的MySQL

mysql系列之--------mmm高可用集群

mmm高可用集群介绍: 高可用集群介绍:主备模式,当主不能提供服务的时候备用主机接替它提供服务. 这个过程对于客户端是透明的. 一.前期准备工作 1.准备五台linux服务器:主(192.168.4.122),主备(192.168.4.123) 从(192.168.4.126),从(192.168.4.127),管理主机(192.168.4.128) 四台主机做主从的用户名:tongbu,密码:123456 2.主和主备做成相互的主从模式,两台从服务器做成主备的从 3.IP规划,write-vi

MHA 高可用集群搭建(二)

MHA 高可用集群搭建安装scp远程控制http://www.cnblogs.com/kevingrace/p/5662839.html yum install openssh-clients mysql5.7运行环境:centos6.51 主机部署 manager:192.168.133.141test1: 192.168.133.138test2:192.168.133.139 (为master1的备用)test3: 192.168.133.140 test1为主,test2和test3为备

LVS+Keepalived+Nginx+Tomcat高可用集群搭建(转)

LVS+Keepalived+Nginx+Tomcat高可用集群搭建 最近公司重整架构,十几台服务器而且还要尽可能节约成本.我就谷歌了一下在几种集群之前进行比较最终采用了Keepalived+Nginx做负债均衡高可用.虽然之前也研究过集群,看过很多集群方面的原理和架构,但毕竟没有真正操作过以下案例是在虚拟机中完成实验其实对于高可用搭建来说只用给出Keepalived和Nginx的配置即可后面的一些安装搭建完全是本人项目需要可以不用理睬仅供参考. 本文只是实验搭建记录方便以后在服务器中实施搭建.

linux 下heartbeat简单高可用集群搭建

Heartbeat 项目是 Linux-HA 工程的一个组成部分,它实现了一个高可用集群系统.通过Heartbeat我们可以实现双机热备,以实现服务的持续性. linux下基于heartbeat的简单web服务的高可用集群搭建 首先规划好两台主机作为heartbeat的双机热备,命名为node1.lvni.cc(主) ;node2.lvni.cc, node1的eth0IP :192.168.157.148  Vip eth0:0:192.168.157.149 node2的eth0IP :19

CoroSync + Drbd + MySQL 实现MySQL的高可用集群

Corosync + DRBD + MySQL 构建高可用MySQL集群 节点规划: node1.huhu.com172.16.100.103 node2.huhu.com172.16.100.104 资源名称规划 资源名称:可以是除了空白字符外的任意ACSII码字符 DRBD设备:在双节点上,此DRBD设备文件,一般为/dev/drbdN,主设备号147 磁盘:在双方节点上,各自提供存储设备 网络配置:双方数据同步所使用的网络属性 DRBD从Linux内核2.6.33起已经整合进内核 1.配置

使用drbd结合corosync实现mysql的高可用集群服务

DRBD:Distributed Replicated Block Dvice 分布式复制块设备,它可以将两个主机的硬盘或者分区做成镜像设备,类似于RAID1的原理,只不过它会将主节点的数据主动通过网络同步到从节点做成镜像,当主节点发生故障,让从节点成为主节点,因为是镜像设备,所以数据不会丢失.corosync在这里的作用就是将drbd通过pacemaker做成高可用服务的资源,以便于主从节点间的自动切换.drbd由于使用各节点之间自身的硬盘设备,因此对于需要共享存储的场景不失为一种节约成本的解

Flume 学习笔记之 Flume NG高可用集群搭建

Flume NG高可用集群搭建: 架构总图: 架构分配: 角色 Host 端口 agent1 hadoop3 52020 collector1 hadoop1 52020 collector2 hadoop2 52020 agent1配置(flume-client.conf): #agent1 name agent1.channels = c1 agent1.sources = r1 agent1.sinks = k1 k2 #set gruop agent1.sinkgroups = g1 #