MHA Installation and Equivalence configuration

Source: Internet
Author: User
Tags install perl

MHA consists of the MHA node (which can be understood as a child node) and the MHA Management Node 2. Therefore, for the installation of MHA, the corresponding is also divided into 2 parts, that is, the installation of MHA node, installation MHA Management node. This paper briefly describes the installation of MHA based on the CentOS 5.9 64bit, and also describes the equivalent configuration that needs to be done when configuring MHA. For everyone's reference.

1, the composition of MHA
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 does not run all, but is invoked from MHA manager programs when needed (at configuration check, Failov Er, etc). Both MHA Manager and MHA Node is written in Perl.

MHA Node has scripts and dependent Perl modules that does 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_r Elay_logs:purging Relay log files
you need-install MHA Node to all MySQL serv ERS (both master and slave). 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 is able to install easily.

# # #本次安装环境
# cat/etc/issue
CentOS release 5.9 (Final)
Kernel \ r on an \m

# # #本次的演示环境
# more/etc/hosts
192.168.1.6 DBSRV1 #DB Master
192.168.1.7 dbsrv2 #DB slave1
192.168.1.8 Dbsrv3 #DB Slave2
192.168.1.82 Mysql-manager #DB Manager node

# # #以下安装包, it is recommended that node and manger are installed
# yum Install Perl-dbd-mysql
# yum Install Perl-config-tiny
# yum Install Perl-log-dispatch
# yum Install Perl-parallel-forkmanager

# # #如果yum时相关相关包时, can not be obtained, it is recommended to configure Epel after installation, you need to pay attention to the corresponding version number.
# wget http://mirrors.ustc.edu.cn/fedora/epel/5/x86_64/epel-release-5-4.noarch.rpm
# RPM-UVH epel-release-5-4.noarch.rpm

# # #以下安装包从网络上搜集整理, depending on the situation, you can decide whether to install
# yum-y Install perl-config-inifiles ncftp perl-params-validate Perl-cpan perl-test-mock-lwp.noarch \
> Perl-lwp-authen-negotiate.noarch perl-devel perl-extutils-cbuilder perl-extutils-makemaker

# ls-hltr
Total 172K
-rw-r--r--1 root root 112K Dec 5 15:46 mha4mysql-manager-0.56.tar.gz
-rw-r--r--1 root root 49K Dec 5 15:46 mha4mysql-node-0.56.tar.gz

# TAR-XVF Mha4mysql-node-0.56.tar.gz
# CD mha4mysql-node-0.56
# Perl makefile.pl
# Make && make install

# # #验证安装后的几个文件
[[email protected] bin]# ls apply_diff_relay_logs save_binary_logs filter_mysqlbinlog purge_relay_logs
Apply_diff_relay_logs Filter_mysqlbinlog purge_relay_logs Save_binary_logs

3. Install MHA Manager
MHA Manager have 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. Don't forget to install MHA Node.
MHA Node Package
Dbd::mysql
Config::tiny
Log::D Ispatch
Parallel::forkmanager
Time::hires (included from Perl v5.7.3)

# # #以下部分为管理节点上的安装, note that the Management node also installs MHA node, omitted here
# TAR-XVF Mha4mysql-manager-0.56.tar.gz
# Perl makefile.pl
# Make && make install

# ls/usr/bin/mast*
/usr/bin/masterha_check_repl/usr/bin/masterha_conf_host/usr/bin/masterha_master_switch
/usr/bin/masterha_check_ssh/usr/bin/masterha_manager/usr/bin/masterha_secondary_check
/usr/bin/masterha_check_status/usr/bin/masterha_master_monitor/usr/bin/masterha_stop

4. Configuration equivalence
# # #为各节点配置hosts文件
# for I in 6 7 8;do scp/etc/hosts 192.168.1. $i:/etc/;d One

[Email protected] #]$ WhoAmI
Root
# # #配置等效性
[Email protected] ~]# Ssh-keygen
[Email protected] ~]# ls-a./.ssh/
.  .. Id_rsa id_rsa.pub
[Email protected] ~]# ssh-copy-id-i ~/.ssh/id_rsa.pub[email protected]
[email protected] ~]# ssh-copy-id-i ~/.ssh/id_rsa.pub[email protected]
[email protected] ~]# ssh-copy-id-i ~/.ssh/id_rsa.pub[email protected]

# # #使用上面的方法在其余的几个节点如法炮制后验证等效性
[[email protected] ~]# ssh dbsrv1 date;ssh dbsrv2 date;ssh dbsrv3 date; SSH Mysql-manager date;

# # #在管理节点端使用MHA命令验证等效性
[Email protected] ~]# masterha_check_ssh--conf=/etc/app1.cnf
Mon Feb-15:12:43-[WARNING] Global configuration file/etc/masterha_default.cnf not found. Skipping.
Mon Feb 15:12:43-[INFO] Reading application default configuration from/etc/app1.cnf.
Mon Feb 15:12:43-[INFO] Reading server configuration from/etc/app1.cnf.
Mon Feb 15:12:43-[INFO] Starting SSH connection tests.
Mon Feb 15:12:45-[debug]
Mon Feb 15:12:43-[debug] connecting via SSH from [email protected](192.168.1.6:22) to [email protected](192.168.1.7:22)..
Mon Feb 15:12:44-[debug] OK.
Mon Feb 15:12:44-[debug] connecting via SSH from [email protected](192.168.1.6:22) to [email protected](192.168.1.8:22)..
Mon Feb 15:12:44-[debug] OK.
Mon Feb 15:12:45-[debug]
Mon Feb 15:12:44-[debug] connecting via SSH from [email protected](192.168.1.7:22) to [email protected](192.168.1.6:22)..
Mon Feb 15:12:44-[debug] OK.
Mon Feb 15:12:44-[debug] connecting via SSH from [email protected](192.168.1.7:22) to [email protected](192.168.1.8:22)..
Mon Feb 15:12:44-[debug] OK.
Mon Feb 15:12:45-[debug]
Mon Feb 15:12:44-[debug] connecting via SSH from [email protected](192.168.1.8:22) to [email protected](192.168.1.6:22)..
Mon Feb 15:12:45-[debug] OK.
Mon Feb 15:12:45-[debug] connecting via SSH from [email protected](192.168.1.8:22) to [email protected](192.168.1.7:22)..
Mon Feb 15:12:45-[debug] OK.
Mon Feb 15:12:45-[INFO] All SSH connection tests passed successfully.

MHA installation and equivalence configuration

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.