MHA installation and equivalence configuration, mha Configuration

Source: Internet
Author: User
Tags install perl

MHA installation and equivalence configuration, mha Configuration

MHA consists of MHA nodes (which can be understood as subnodes) and MHA management nodes. Therefore, MHA installation is divided into two parts: Install MHA nodes and install MHA management nodes. This article briefly describes the MHA installation Based on CentOS 5.9 64bit, and also describes the equivalence configurations that need to be completed when configuring MHA. For your reference.

 

1. 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 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.

 

2. Install 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 into t dbd: mysql so you shocould be able to install easily.

 

### Current installation environment
# Cat/etc/issue
CentOS release 5.9 (Final)
Kernel \ r on an \ m

 

### Demo Environment
# 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

 

### Install the following installation packages on both node and manger
# Yum install perl-DBD-MySQL
# Yum install perl-Config-Tiny
# Yum install perl-Log-Dispatch
# Yum install perl-Parallel-ForkManager

 

### If the related package cannot be obtained during yum, we recommend that you configure epel before installing it. 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

 

### The following installation packages are collected and organized on the network. You can decide whether to install them based on the actual situation.
# 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 172 K
-Rw-r -- 1 root 112 K Dec 5 mha4mysql-manager-0.56.tar.gz
-Rw-r -- 1 root 49 K Dec 5 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

 

### Verify several files after installation
[Root @ dbsrv1 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 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 (sorted ded from Perl v5.7.3)

### The following sections deploy MHA nodes on Management Nodes. Note that MHA nodes must be installed on Management Nodes.
# 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
### Configure the hosts file for each node
# For I in 6 7 8; do scp/etc/hosts 192.168.1. $ I:/etc/; done

[Root @ mysql-manager #] $ whoami
Root
### Configuration equivalence
[Root @ mysql-manager ~] # Ssh-keygen
[Root @ mysql-manager ~] # Ls-a./. ssh/
... Id_rsa id_rsa.pub
[Root @ mysql-manager ~] # Ssh-copy-id-I ~ /. Ssh/id_rsa.pub root@192.168.1.6
[Root @ mysql-manager ~] # Ssh-copy-id-I ~ /. Ssh/id_rsa.pub root@192.168.1.7
[Root @ mysql-manager ~] # Ssh-copy-id-I ~ /. Ssh/id_rsa.pub root@192.168.1.8

### Verify the equivalence of the remaining nodes using the above method
[Root @ dbsrv2 ~] # Ssh dbsrv1 date; ssh dbsrv2 date; ssh dbsrv3 date; ssh mysql-manager date;

### Verify the equivalence using the MHA command on the Management Node
[Root @ mysql-manager ~] # Masterha_check_ssh -- conf =/etc/app1.cnf
Mon Feb 16 15:12:43 2015-[warning] Global configuration file/etc/masterha_default.cnf not found. Skipping.
Mon Feb 16 15:12:43 2015-[info] Reading application default configuration from/etc/app1.cnf ..
Mon Feb 16 15:12:43 2015-[info] Reading server configuration from/etc/app1.cnf ..
Mon Feb 16 15:12:43 2015-[info] Starting SSH connection tests ..
Mon Feb 16 15:12:45 2015-[debug]
Mon Feb 16 15:12:43 2015-[debug] Connecting via SSH from mysql@192.168.1.6 (192.168.1.6: 22) to mysql@192.168.1.7 (192.168.1.7: 22 )..
Mon Feb 16 15:12:44 2015-[debug] OK.
Mon Feb 16 15:12:44 2015-[debug] Connecting via SSH from mysql@192.168.1.6 (192.168.1.6: 22) to mysql@192.168.1.8 (192.168.1.8: 22 )..
Mon Feb 16 15:12:44 2015-[debug] OK.
Mon Feb 16 15:12:45 2015-[debug]
Mon Feb 16 15:12:44 2015-[debug] Connecting via SSH from mysql@192.168.1.7 (192.168.1.7: 22) to mysql@192.168.1.6 (192.168.1.6: 22 )..
Mon Feb 16 15:12:44 2015-[debug] OK.
Mon Feb 16 15:12:44 2015-[debug] Connecting via SSH from mysql@192.168.1.7 (192.168.1.7: 22) to mysql@192.168.1.8 (192.168.1.8: 22 )..
Mon Feb 16 15:12:44 2015-[debug] OK.
Mon Feb 16 15:12:45 2015-[debug]
Mon Feb 16 15:12:44 2015-[debug] Connecting via SSH from mysql@192.168.1.8 (192.168.1.8: 22) to mysql@192.168.1.6 (192.168.1.6: 22 )..
Mon Feb 16 15:12:45 2015-[debug] OK.
Mon Feb 16 15:12:45 2015-[debug] Connecting via SSH from mysql@192.168.1.8 (192.168.1.8: 22) to mysql@192.168.1.7 (192.168.1.7: 22 )..
Mon Feb 16 15:12:45 2015-[debug] OK.
Mon Feb 16 15:12:45 2015-[info] All SSH connection tests passed successfully.

Related Article

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.