Home  >  Article  >  Database  >  通过Heartbert2 让MySQL Replication 具有HA

通过Heartbert2 让MySQL Replication 具有HA

WBOY
WBOYOriginal
2016-06-07 16:54:03939browse

前言 Master-Slave 的数据库机构解决了很多问题,特别是read/write 比较高的应用,结构如图: 1、写操作全部在Master

  前言

  Master-Slave 的数据库机构解决了很多问题,,特别是read/write 比较高的应用,结构如图:

  1、写操作全部在Master 结点执行,并由Slave 数据库结点定时(默认60s)读取Master 的bin-log

  2、将众多的用户读请求分散到更多的数据库节点,从而减轻了单点的压力

  它的缺点是:

  1、Slave 实时性的保障,对于实时性很高的场合可能需要做一些处理

  2、高可用性问题,Master 就是那个致命点(SPOF:Single point of failure)

  本文主要讨论的是如何解决第2 个缺点。

  解决方案如下图:

  1、使用两个MySQL 主库master1,master2,数据存在共享设备上,用heartbeat2 进行监控,当master1 发生故障时,将资源切换到master2。

  2、故障发生后,无需对slave 进行修改,slave 自动切到master2。(断电切换需要手工同步slave)

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn