MySQL MHA 典型使用场景

php中文网
发布: 2016-06-07 16:08:06
原创
1452人浏览过

1 管理节点部署位置1.1. Dedicated Manager server and multiple MySQL (master,slaves) servers 使用专用的管理服务

1      管理节点部署位置
1.1.      dedicated manager server and multiple mysql (master,slaves) servers
使用专用的管理服务器管理多组mysql主从服务器

Since MHA Manager uses very little CPU/Memory resources, you can manage lots of (master, slaves) pairs from single MHA Manager. It is even possible to manage 100+ pairs from single manager server.

1.2.      Running MHA Manager on one of MySQL slaves
在一个从库上部署管理节点

If you have only one (master, slaves) pair, you may not like allocating dedicated hardware for MHA Manager because it adds relatively high costs. In such cases, running MHA Manager on one of slaves makes sense. Note that current version of MHA Manager connects to MySQL slave server via SSH even though the MySQL server is located on the same host as MHA Manager, so you need to enable SSH public key authentication from the same host.

2      不同主从配置下的主从切换场景
2.1        Single master, multiple slaves(单主多从)
        M(RW)                            M(RW), promoted from S1        |                                            |  +------+------+        --(master crash)-->    +-----+-----+ S1(R) S2(R)  S3(R)                          S2(R)        S3(R)This is the most common replication settings. MHA works very well here.

 
2.2        Single master, multiple slaves (one on remote datacenter) 单主多从,一个从位于远程数据中心
        M(RW)                                M(RW), promoted from S1        |                                                |  +------+---------+        --(master crash)-->    +-----+------+ S1(R) S2(R)    Sr(R,no_master=1)                  S2(R)        Sr(R,no_master=1)In many cases you want to deploy at least one slave server on a remote datacenter. When the master crashes, you may not want to promote the remote slave to the new master, but let one of other slaves running on the local datacenter become the new master. MHA supports such requirements. Setting no_master=1 in the configuration file makes the slave never becomes new master.

 
2.3        Single master, multiple slaves, one candidate master(单主多从,一个候选主)
      M(RW)-----S0(R,candidate_master=1)  M(RW), promoted from S0      |                                          |  +----+----+          --(master crash)-->  +----+----+ S1(R)    S2(R)                            S1(R)      S2(R)In some cases you may want to promote a specific server to the new master if the current master crashes. In such cases, setting candidate_master=1 in the configuration file will help.

 
2.4        Multiple masters, multiple slaves(多主多从)
      M(RW)M2(R,candidate_master=1)  M(RW), promoted from M2      |                                          |  +----+----+          --(master crash)-->  +----+----+ S(R)    S2(R)                            S1(R)      S2(R)In some cases you may want to use multi-master configurations, and you may want to make the read-only master the new master if the current master crashes. MHA Manager supports multi-master configurations as long as all non-primary masters (M2 in this figure) are read-only.

 
2.5        Three tier replication(三层复制架构)
        M(RW)                                  M(RW), promoted from S1        |                                                |  +------+---------+        --(master crash)-->    +-----+------+ S1(R) S2(R)    Sr(R)                              S2(R)      Sr(R)                  |                                              |                  +                                              +                  Sr2                                            Sr2In some cases you may want to use three-tier replication like this. MHA can still be used for master failover. In the configuration file, manage the master and all second-tier slaves (in this figure, add M,S1,S2 and Sr in the MHA config file, but do not add Sr2). If the current master (M) fails, MHA automatically promotes one of the second-tier slaves(S1,S2,Sr, and you can also set priorities) to the new master, and recover the rest second-tier slaves. The third tier slave(Sr2) is not managed by MHA, but as long as Sr (Sr2's master) is alive, Sr2 can continue replication without changing anything.

最佳 Windows 性能的顶级免费优化软件
最佳 Windows 性能的顶级免费优化软件

每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号