最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
问答文章1 问答文章501 问答文章1001 问答文章1501 问答文章2001 问答文章2501 问答文章3001 问答文章3501 问答文章4001 问答文章4501 问答文章5001 问答文章5501 问答文章6001 问答文章6501 问答文章7001 问答文章7501 问答文章8001 问答文章8501 问答文章9001 问答文章9501
当前位置: 首页 - 科技 - 知识百科 - 正文

MHA安装及等效性配置

来源:懂视网 责编:小采 时间:2020-11-09 14:08:05
文档

MHA安装及等效性配置

MHA安装及等效性配置:MHA由MHA节点(可以理解为子节点)及MHA管理节点2部分组成。因此对于MHA的安装,相应的也分为2个部分,即安装MHA节点,安装MHA管理节点。本文基于CentOS 5.9 64bit简要描述了MHA的安装,同时也描述了在配置MHA时需要完成的等效性配置。供大家参考。 1、MHA
推荐度:
导读MHA安装及等效性配置:MHA由MHA节点(可以理解为子节点)及MHA管理节点2部分组成。因此对于MHA的安装,相应的也分为2个部分,即安装MHA节点,安装MHA管理节点。本文基于CentOS 5.9 64bit简要描述了MHA的安装,同时也描述了在配置MHA时需要完成的等效性配置。供大家参考。 1、MHA

MHA由MHA节点(可以理解为子节点)及MHA管理节点2部分组成。因此对于MHA的安装,相应的也分为2个部分,即安装MHA节点,安装MHA管理节点。本文基于CentOS 5.9 64bit简要描述了MHA的安装,同时也描述了在配置MHA时需要完成的等效性配置。供大家参考。 1、MHA的组

MHA由MHA节点(可以理解为子节点)及MHA管理节点2部分组成。因此对于MHA的安装,相应的也分为2个部分,即安装MHA节点,安装MHA管理节点。本文基于CentOS 5.9 64bit简要描述了MHA的安装,同时也描述了在配置MHA时需要完成的等效性配置。供大家参考。

1、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 【本文来自鸿网互联 (http://www.68idc.cn)】Manager and MHA Node are written in Perl.

2、安装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.

###本次安装环境
# 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

###以下安装包,建议node和manger都安装
# yum install perl-DBD-MySQL
# yum install perl-Config-Tiny
# yum install perl-Log-Dispatch
# yum install perl-Parallel-ForkManager

###如果yum时相关相关包时,无法获取到,建议配置epel后再安装,需要注意对应的相关版本号。
# 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

###以下安装包从网络上搜集整理,大家可根据情形自行决定是否安装
# 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

###验证安装后的几个文件
[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、安装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)

###以下部分为管理节点上的安装,注,管理节点也要安装MHA Node,此处省略
# 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、配置等效性
###为各节点配置hosts文件
# for i in 6 7 8;do scp /etc/hosts 192.168.1.$i:/etc/;done

[root@mysql-manager #]$ whoami
root
###配置等效性
[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

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

###在管理节点端使用MHA命令验证等效性
[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.

声明:本网页内容旨在传播知识,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文档

MHA安装及等效性配置

MHA安装及等效性配置:MHA由MHA节点(可以理解为子节点)及MHA管理节点2部分组成。因此对于MHA的安装,相应的也分为2个部分,即安装MHA节点,安装MHA管理节点。本文基于CentOS 5.9 64bit简要描述了MHA的安装,同时也描述了在配置MHA时需要完成的等效性配置。供大家参考。 1、MHA
推荐度:
标签: 安装 可以 管理
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top