最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
當(dāng)前位置: 首頁 - 科技 - 知識百科 - 正文

MHA安裝及等效性配置

來源:懂視網(wǎng) 責(zé)編:小采 時間:2020-11-09 14:08:05
文檔

MHA安裝及等效性配置

MHA安裝及等效性配置:MHA由MHA節(jié)點(可以理解為子節(jié)點)及MHA管理節(jié)點2部分組成。因此對于MHA的安裝,相應(yīng)的也分為2個部分,即安裝MHA節(jié)點,安裝MHA管理節(jié)點。本文基于CentOS 5.9 64bit簡要描述了MHA的安裝,同時也描述了在配置MHA時需要完成的等效性配置。供大家參考。 1、MHA
推薦度:
導(dǎo)讀MHA安裝及等效性配置:MHA由MHA節(jié)點(可以理解為子節(jié)點)及MHA管理節(jié)點2部分組成。因此對于MHA的安裝,相應(yīng)的也分為2個部分,即安裝MHA節(jié)點,安裝MHA管理節(jié)點。本文基于CentOS 5.9 64bit簡要描述了MHA的安裝,同時也描述了在配置MHA時需要完成的等效性配置。供大家參考。 1、MHA

MHA由MHA節(jié)點(可以理解為子節(jié)點)及MHA管理節(jié)點2部分組成。因此對于MHA的安裝,相應(yīng)的也分為2個部分,即安裝MHA節(jié)點,安裝MHA管理節(jié)點。本文基于CentOS 5.9 64bit簡要描述了MHA的安裝,同時也描述了在配置MHA時需要完成的等效性配置。供大家參考。 1、MHA的組

MHA由MHA節(jié)點(可以理解為子節(jié)點)及MHA管理節(jié)點2部分組成。因此對于MHA的安裝,相應(yīng)的也分為2個部分,即安裝MHA節(jié)點,安裝MHA管理節(jié)點。本文基于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 【本文來自鴻網(wǎng)互聯(lián) (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.

###本次安裝環(huán)境
# cat /etc/issue
CentOS release 5.9 (Final)
Kernel \r on an \m

###本次的演示環(huán)境
# 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時相關(guān)相關(guān)包時,無法獲取到,建議配置epel后再安裝,需要注意對應(yīng)的相關(guān)版本號。
# 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

###以下安裝包從網(wǎng)絡(luò)上搜集整理,大家可根據(jù)情形自行決定是否安裝
# 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)

###以下部分為管理節(jié)點上的安裝,注,管理節(jié)點也要安裝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、配置等效性
###為各節(jié)點配置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

###使用上面的方法在其余的幾個節(jié)點如法炮制后驗證等效性
[root@dbsrv2 ~]# ssh dbsrv1 date;ssh dbsrv2 date;ssh dbsrv3 date; ssh mysql-manager date;

###在管理節(jié)點端使用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.

聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

MHA安裝及等效性配置

MHA安裝及等效性配置:MHA由MHA節(jié)點(可以理解為子節(jié)點)及MHA管理節(jié)點2部分組成。因此對于MHA的安裝,相應(yīng)的也分為2個部分,即安裝MHA節(jié)點,安裝MHA管理節(jié)點。本文基于CentOS 5.9 64bit簡要描述了MHA的安裝,同時也描述了在配置MHA時需要完成的等效性配置。供大家參考。 1、MHA
推薦度:
標(biāo)簽: 安裝 可以 管理
  • 熱門焦點

最新推薦

猜你喜歡

熱門推薦

專題
Top