016-MHA Mode configuration

Source: Internet
Author: User
Tags mysql in rrdtool uuid install perl

Description: MHA (Master high availability), the current MySQL in the more common solution. Tools:
MASTERHA_CHECK_SSH Check MHA SSH configuration status masterha_check_repl check MySQL replication status Masterha_manger boot MHA masterha_check_status Detects the current MHA run status Masterha_master_monitor detects master for downtime Masterha_master_switch control failover (automatic or manual) Masterha_conf_host To add or remove configured server information
Environment configuration:
Ip Role Describe mysql5.7 version
192.168.68.129 Master (Master) Node_master node
192.168.68.130 Slave (from + standby master) Node_bakup_master Standby
192.168.68.131 Slave (from) Node
192.168.68.132 Slave+manager (from + management) Node + Management Machine
192.168.68.110 Shared IP, no machine

One or one main three configuration from: (Ignore process) Note:
To disable Gtid mode in #1, MY.CNF, the 5.7 version disables Gtid mode by default, and if non-5.7 versions need to be added in [mysqld]
Gtid_mode=0 #2, 4 MySQL server_id can not be the same
Servicer_id=1, 2, 3, 4 #3, auto.cnf server-uuid 4 MySQL can not be the same [Root@slave tmp]# cd/usr/local/mysql/data/[root@slave data] # cat auto.cnf [Auto] server-uuid=8c1ea0b7-5be8-11e7-93a7-000c292ef002 [Root@slave data]# II, add MHA user name and password to be replicated:
# # all_db need to execute: Grant all privileges on *.* to ' mha_manager ' @ '% ' identified by ' 123456 '; Grant replication slave on *.* to ' repl ' @ '% ' identified by ' 123456 '; Flush privileges; # # If there is a slave running manager above this computer: This is 192.168.68.132 using MANAGERDB representatives: GRANT all privileges on *.* to ' Mha_manager ' @ ' Manag Er.100 ' identified by ' 123456 '
(manager.100) is a local name, uname-a can check to see
Third, Ssh-keygen to establish a secret trust
# # 192.168.68.129 Ssh-keygen # #猛砸回车 CD ~/.ssh/ls | The grep Id_rsa appears as follows:
# # 192.168.68.129 Copy id_rsa.pub key, and Key+ip file CP id_rsa.pub key129 # to distribute the generated KEY+IP files to the machines above the SCP key129 192.168.68.130:~/. SSH/SCP key129 192.168.68.131:~/.SSH/SCP key129 192.168.68.132:~/.ssh/# 130, 131, 132 repeat the final results of the work as follows:
# 129, 130, 131, 132 repeat the following operation Cat key129 key130 key131 key132 > Authorized_keys # After the end, in each machine access to other three machines, SSH 192.168.68.xx # # No-secret login is correct four, download the RPM package: and copied to the all_db
mha4mysql-node-0.56-0.el6.noarch.rpm mha4mysql-manager-0.56-0.el6.noarch.rpm # #如何下载请自行百度 v. Installation of mha4mysql-node-0.56- 0.el6.noarch. The RPM package is on all the machines all_db

Six, manager: namely 192.168.68.132 above operation content is as follows: Installs Mha4mysql-manager-0.56-0.el6.noarch. RPM Package
Yum Install cpan yum install perl-config-tiny yum install perl-time-hires yum install-y rrdtool perl-rrdtool RRDtool -devel Perl-params-validate # # can not use Yum source of your own Baidu, very simple
wget http://downloads.naulinux.ru/pub/NauLinux/6x/i386/sites/School/RPMS/ perl-log-dispatch-2.27-1.el6.noarch.rpm wget http://dl. fedoraproject.org/pub/epel/6/i386/perl-parallel-forkmanager-0.7.9-1.el6.noarch.rpm wget http:// dl.fedoraproject.org/pub/epel/6/i386/perl-mail-sender-0.8.16-3.el6.noarch.rpm wget http://dl.fedoraproject.org/ pub/epel/6/i386/perl-mail-sendmail-0.79-12.el6.noarch.rpm
RPM-IVH perl-mail-sender-0.8.16-1.el6.rf.noarch.rpm RPM-IVH perl-mail-sendmail-0.79-1.2.el6.rf.noarch.rpm Yum Localinstall perl-log-dispatch-2.26-1.el6.rf.noarch.rpm Yum Localinstall perl-parallel-forkmanager-0.7.5-2.2.el6.rf.noarch.rpm
RPM-IVH mha4mysql-manager-0.53-0.el6.noarch.rpm

Vii. establishment of MHA required directory and file manager_db operation:
# # MANAGER-DB Operation
Shell> Mkdir/etc/masterha--Creating a folder shell> vim/etc/masterha/app1.cnf--Creating a new configuration file section
# # APP1.CNF Configure MANAGER-DB to operate [server default] Manager_log=/var/log/mha/app1/manager.log manager_workdir=/var/log/ Mha/app1 master_binlog_dir=/usr/local/mysql/data Remote_workdir=/var/log/mha/app1 User=mha_manager password=123456 Repl_user=repl repl_password=123456 ssh_user=root ping_interval=1 secondary_check_script= "Masterha_secondary_check -S 192.168.68.129-s 192.168.68.130 "master_ip_failover_script="/tmp/master_ip_failover.sh "[Server1] Hostname= 192.168.68.129 #可以升为master candidate_master=1 [server2] hostname=192.168.68.130 candidate_master=1 check_repl_delay= 0 [Server3] hostname=192.168.68.131 no_master=1 [server4] hostname=192.168.68.132 no_master=1
### all DB above establish the Software connection note all-db All machines need to operate ln-s/usr/local/mysql/bin/mysql/usr/local/bin/mysql ln-s/usr/local/mysql/bin/ Mysqlbinlog/usr/local/bin/mysqlbinlog ln-s/usr/local/mysql/bin/mysqlbinlog/usr/bin/mysqlbinlog ln-s/usr/local/ Mysql/bin/mysql/usr/bin

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.