MYSQL 高可用方案探究
1 前言........................................................................................................................................... 3
2 Lvs+Keepalived+Mysql 单点写入主主同步高可用方案 ...................................................... 3
2.1 方案简介 ....................................................................................................................... 3
2.2 方案架构图 ................................................................................................................... 3
2.3 方案优缺点 ................................................................................................................... 4
2.4 方案实战 ....................................................................................................................... 4
2.4.1 适用场景 ........................................................................................................... 4
2.4.2 实战环境介绍 ................................................................................................... 4
2.4.3 Mysql 的安装和配置 ........................................................................................ 4
2.4.4 Mysql 的主主同步配置 .................................................................................... 4
2.4.5 Lvs 的安装 ........................................................................................................ 4
2.4.6 Keepalived 的安装 .......................................................................................... 5
2.4.7 Keepalived 的配置 .......................................................................................... 5
2.4.8 Master 和 backup 的 realserver 的配置 ...................................................... 7
2.4.9 Master 和 backup 的启动 ................................................................................ 8
2.4.10 高可用方案测试 .............................................................................................. 9
3 Lvs+Keepalived+Mysql 单点写入读负载均衡主主同步高可用方案 .................................. 9
3.1 方案简介 ....................................................................................................................... 9
3.2 方案架构图 ................................................................................................................... 9
3.3 方案优缺点 ................................................................................................................... 9
3.4 适用场景 ..................................................................................................................... 10
3.5 方案实战 ..................................................................................................................... 10
3.5.1 实战环境介绍 ................................................................................................. 10
3.5.2 Mysql 的安装和配置 ...................................................................................... 10
3.5.3 Mysql 的主主同步配置 .................................................................................. 10
3.5.4 Lvs 的安装 ...................................................................................................... 10
3.5.5 Keepalived 的安装 ........................................................................................ 11
3.5.6 Keepalived 的配置 ........................................................................................ 11
3.5.7 Master 和 backup 的 realserver 的配置 .................................................... 15
3.5.8 Master 和 backup 的启动 .............................................................................. 16
4 Heartbeat 高可用 Mysql 主主同步方案 .............................................................................. 16
4.1 方案简介 ..................................................................................................................... 16
4.2 方案优缺点 ................................................................................................................. 16
4.3 方案架构图 ................................................................................................................. 17
4.4 适用场景 ..................................................................................................................... 17
4.5 方案实战 ..................................................................................................................... 17
4.5.1 实战环境介绍 ................................................................................................. 17
4.5.2 Mysql 的安装和配置 ...................................................................................... 17
4.5.3 Mysql 的主主同步配置 .................................................................................. 17
4.5.4 Heardbeat 的安装 .......................................................................................... 17
4.5.5 Heartbeat 的配置 .......................................................................................... 18
4.5.6 Heartbeat 的启动 .......................................................................................... 19