https://code.google.com/p/mysql-master-ha/wiki/TableOfContents?tm=6

http://www.cnblogs.com/gomysql/category/566506.html 实例参考

Installation

MHA consists of MHA Manager and MHA Node packages. MHA Manager runs on a manager server, and MHA Node runs on each MySQL server. MHA Node programs do not run always, but are invoked from MHA manager programs when needed (at configuration check, failover, etc). Both MHA Manager and MHA Node are written in Perl.

Downloading MHA Node and MHA Manager

MHA Node and MHA Manager can be downloaded from "Downloads" section. These are stable packages.

If you want to try development source trees, check out GitHub source trees. MHA Manager is hosted here, and MHA Node is hosted here.

Installing MHA Node

MHA Node has scripts and dependent perl modules that do the following.

  • save_binary_logs: Saving and copying dead master's binary logs
  • apply_diff_relay_logs: Identifying differential relay log events and applying all necessary log events
  • purge_relay_logs: Purging relay log files

You need to install MHA Node to all MySQL servers (both master and slave). You also need to install MHA Node on a management server because MHA Manager modules internally depend on MHA Node modules. MHA Manager internally connects to managed MySQL servers via SSH and executes MHA Node scripts. MHA Node does not depend on any external Perl modules except DBD::mysql so you should be able to install easily.

On RHEL/CentOS distribution, you can install MHA Node rpm package as below.

  ## If you have not installed DBD::mysql, install it like below, or install from source.
  # yum install perl-DBD-MySQL   ## Get MHA Node rpm package from "Downloads" section.
  # rpm -ivh mha4mysql-node-X.Y-0.noarch.rpm

On Ubuntu/Debian distribution, you can install MHA Node deb package as below.

  ## If you have not installed DBD::mysql, install it like below, or install from source.
  # apt-get install libdbd-mysql-perl   ## Get MHA Node deb package from "Downloads" section.
  # dpkg -i mha4mysql-node_X.Y_all.deb

You can also install MHA Node from source.

  ## Install DBD::mysql if not installed
  $ tar -zxf mha4mysql-node-X.Y.tar.gz
  $ perl Makefile.PL
  $ make
  $ sudo make install

Installing MHA Manager

MHA Manager has administrative command line programs such as masterha_manager, masterha_master_switch, etc, and dependent Perl modules. MHA Manager depends on the following Perl modules. You need to install them before installing MHA Manager. Do not forget to install MHA Node.

  • MHA Node package
  • DBD::mysql
  • Config::Tiny
  • Log::Dispatch
  • Parallel::ForkManager
  • Time::HiRes (included from Perl v5.7.3)

On RHEL/CentOS distribution, you can install MHA Manager rpm package as below.

  ## Install dependent Perl modules
  # yum install perl-DBD-MySQL
  # yum install perl-Config-Tiny
  # yum install perl-Log-Dispatch
  # yum install perl-Parallel-ForkManager   ## Install MHA Node, since MHA Manager uses some modules provided by MHA Node.
  # rpm -ivh mha4mysql-node-X.Y-0.noarch.rpm   ## Finally you can install MHA Manager
  # rpm -ivh mha4mysql-manager-X.Y-0.noarch.rpm

On Ubuntu/Debian distribution, you can install MHA Manager deb package as below.

  ## Install dependent Perl modules
  # apt-get install libdbd-mysql-perl
  # apt-get install libconfig-tiny-perl
  # apt-get install liblog-dispatch-perl
  # apt-get install libparallel-forkmanager-perl   ## Install MHA Node, since MHA Manager uses some modules provided by MHA Node.
  # dpkg -i mha4mysql-node_X.Y_all.deb   ## Finally you can install MHA Manager
  # dpkg -i mha4mysql-manager_X.Y_all.deb

You can also install MHA Manager from source.

  ## Install dependent Perl modules
  # MHA Node (See above)
  # Config::Tiny
  ## perl -MCPAN -e "install Config::Tiny"
  # Log::Dispatch
  ## perl -MCPAN -e "install Log::Dispatch"
  # Parallel::ForkManager
  ## perl -MCPAN -e "install Parallel::ForkManager"
  ## Installing MHA Manager
  $ tar -zxf mha4mysql-manager-X.Y.tar.gz
  $ perl Makefile.PL
  $ make
  $ sudo make install

mysql-master-ha的更多相关文章

  1. Windows下搭建MySQL Master Slave[转]

    Windows下搭建MySQL Master Slave 一.背景 服务器上放了很多MySQL数据库,为了安全,现在需要做Master/Slave方案,因为操作系统是Window的,所以没有办法使用k ...

  2. mysql-master-ha 实现mysql master的高可用。

    常用的mysql 高可用有下面几种方案: 名称 原理 特点 mysqlmha Perl脚本对mysql master做心跳,master down了以后,选举new master   ,是要改代理层的 ...

  3. [Spark内核] 第29课:Master HA彻底解密

    本课主题 Master HA 解析 Master HA 解析源码分享 [引言部份:你希望读者看完这篇博客后有那些启发.学到什么样的知识点] 更新中...... Master HA 解析 生产环境下一般 ...

  4. 【Spark-core学习之三】 Spark集群搭建 & spark-shell & Master HA

    环境 虚拟机:VMware 10 Linux版本:CentOS-6.5-x86_64 客户端:Xshell4 FTP:Xftp4 jdk1.8 scala-2.10.4(依赖jdk1.8) spark ...

  5. MySQL Master High Available 源码篇

    https://m.aliyun.com/yunqi/users/1287368569594542/articles https://yq.aliyun.com/articles/59233 MySQ ...

  6. Master HA彻底解密

    本课主题 Master HA 解析 Master HA 解析源码分享 Master HA 解析 生产环境下一般采用 ZooKeeper 做 HA,且建义为 3台 Master, ZooKeeper 会 ...

  7. Windows下搭建MySQL Master Slave

    一.背景 服务器上放了很多MySQL数据库,为了安全,现在需要做Master/Slave方案,因为操作系统是Window的,所以没有办法使用keepalived这个HA工具,但是我们可以接受人工进行切 ...

  8. 【原】ubuntu下Mysql的HA(corosync+pacemaker+drbd)

    一.前提准备: 1.OS:ubuntu 12.04 2.cat /etc/hosts: 127.0.0.1 localhost 192.168.153.154 ha1 192.168.153.155 ...

  9. MySQL master/slave 模式

    1 .复制 Mysql内建的复制功能是构建大型,高性能应用程序的基础.将Mysql的数据分布到多个系统上去,这种分布的机制,是通过将Mysql的某一台主机的 数据复制到其它主机(slaves)上,并重 ...

  10. HBase Master HA高可用

    HMaster没有单点问题,HBase中可以启动多个HMaster,通过Zookeeper的Master Election机制保证总有一个Master运行. 所以这里要配置HBase高可用的话,只需要 ...

随机推荐

  1. 17、SQL基础整理(事务)

    事务 事务==流程控制 确保流程只能成功或者失败,若出现错误会自动回到原点 例: begin tran insert into student values('111','王五','男','1999- ...

  2. HDU 3351

    http://acm.hdu.edu.cn/showproblem.php?pid=3351 乍一看很像经典的括号匹配问题,其实不然,因为操作并非增加括号,而是翻转括号 只需记录多余的左括号的数量即可 ...

  3. 转:设置session过期时间

    在Asp.net应用中,很多人会遇到Session过期设置有冲突.其中,可以有四处设置Session的过期时间: 一.全局网站(即服务器)级 IIS-网站-属性-Asp.net-编辑配置-状态管理-会 ...

  4. js取配置文件内容

    使用 jQuery.i18n.properties 实现 Web 前端的国际化 http://www.ibm.com/developerworks/cn/web/1305_hezj_jqueryi18 ...

  5. USB协议-USB的包结构及包的分类

    USB是串行总线,所以数据是一位一位地在数据线上传送的.既然是一位一位地传送,就存在着一个数据位先后的问题.USB使用的是LSB在前的方式,即先出来的是最低位数据,接下来是次低位,最后是最高位(MSB ...

  6. Android开发之Java必备基础

    Android开发之Java必备基础 Java类型系统 Java语言基础数据类型有两种:对象和基本类型(Primitives).Java通过强制使用静态类型来确保类型安全,要求每个变量在使用之前必须先 ...

  7. interproscan 的使用和遇到的问题

    错误一: 2014-10-08 13:09:32,238 [uk.ac.ebi.interpro.scan.jms.worker.LocalJobQueueListener:193] ERROR - ...

  8. .NET 里 静态方法的并发处理

    静态方法在程序运行时 就已经实例化好了 不管多少用户并发 都一样处理,不需要排队等待,实例代码: namespace DotNet.Example { using DotNet.BaseManager ...

  9. 【字体区别】Serif和Sans Serif

    [字体区别]Serif和Sans Serif 在西方国家罗马字母阵营中,字体分为两大种类:Sans Serif和Serif,打字机体虽然也属于Sans Serif,但由于是等宽字体,所以另外独立出Mo ...

  10. ZOJ 1074 To the Max

    原题链接 题目大意:这是一道好题.在<算法导论>这本书里面,有一节是介绍如何求最大子序列的.这道题有点类似,区别是从数组变成了矩阵,求最大子矩阵. 解法:完全没有算法功底的人当然不知道最大 ...