[MySQL - MHA 구성 + VIP생성] part 1

MHA란  Master DB가 장애로 서비스가 불가능한 상태가 되면, 자동으로 failover를 수행하여 slave DB를 master DB로 승격시켜 서비스 다운타임을 최소화 auto failover 솔루션입니다.

 

Master와 Slave에서는 하나의 VIP를 공유하며 DB접속은 해당 VIP를 이용하며 장애발생시 VIP를 이용하여 절제를 진행합니다.

MHA manager 서버에 MHA 소프트웨어를 설치 및 노드들의 정보를 설정하여 노드들에 이상이 있는지 감시하는 역할을 합니다. 

노드에 장애 발생시 -> MHA manager는 slave 노드를 master로 승격시키며 vip역시 slave 노드로 넘어가게됩니다. 

 

요약 : master node와 slave node는 replication 관계. (slave node는 read only)

MHA manager 서버에서 두 노드를 감시하며 master 노드 장애 감지시 자동 failover진행 -> slave 노드가 master로 승격 -> vip역시 master에서 slave로 넘어가는 방식.

 

최종 아키텍처
테스트 진행할 아키텍처

 

 

 

 테스트 환경

HOSTNAME
PUBLIC 
PRIVATE
ID/PW
VERSION
비고
jh-mha1
118.67.133.86
10.41.181.201
192.168.100.50
 
10.2.12-MariaDB-log
vip
192.168.100.53
jh-mha2
49.50.167.226
10.41.180.182
192.168.100.51
 
10.2.12-MariaDB-log
 
jh-mha-manager
115.85.180.159
10.41.178.231
192.168.100.52
 
 
 

 

 

 

 사전 구성

 

■ db1/db2                   

mariadb 10.2.12 설치

MariaDB [(none)]> select @@basedir;
+-----------+
| @@basedir |
+-----------+
| /mysql    |
+-----------+
1 row in set (0.00 sec)


MariaDB [(none)]> select @@datadir;
+-----------+
| @@datadir |
+-----------+
| /data/    |
+-----------+
1 row in set (0.00 sec)

 

 

 

 /etc/hosts 등록 (jh-mha1, mh-mha2, jh-manager 동일)

# vi /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.100.50 jh-mha1
192.168.100.51 jh-mha2
192.168.100.52 jh-mha-manager

 

 

 

 테스트 시작

 

Replication [DB 1서버( jh-mha1)]

data, socket, log파일 등 경로 설정(임의설정)

server_id, expire_logs_days 는 필히 설정 - server_id는 master와 slave간에 달라야합니다!

[root@jh-mha1 data]# vi /etc/my.cnf

[mysqld]
datadir=/data
socket=/tmp/mysql.sock
open_files_limit=5000
expire_logs_days=7
server_id=1
log_bin=mysql.bin
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

log-error=/log/mariadb.log
pid-file=/log/mariadb.pid
[mysqld_safe]
log-error=/log/mariadb.log
pid-file=/log/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d




##replication 권한을 가진 test 유저 생성
MariaDB [(none)]> grant replication slave,replication client on *.* to test@'%' identified by 'root';
Query OK, 0 rows affected (0.01 sec)



## 설정 값 확인
MariaDB [(none)]> show variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id     | 1     |
+---------------+-------+
1 row in set (0.00 sec)



MariaDB [(none)]> show variables like 'log_bin';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_bin       | ON    |
+---------------+-------+
1 row in set (0.00 sec)



MariaDB [(none)]> show master status;
+--------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+--------------+----------+--------------+------------------+
| mysql.000001 |      324 |              |                  |
+--------------+----------+--------------+------------------+
1 row in set (0.00 sec)

 
 

 DB 2서버(jh-mha2)

[root@jh-mha2 bin]# vi /etc/my.cnf

[mysqld]
datadir=/data
socket=/tmp/mysql.sock
server_id=2
relay_log=mysql-relay-bin
log_slave_updates=1
read_only=1
relay_log_purge=1
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd

log-error=/log/mariadb.log
pid-file=/log/mariadb.pid
[mysqld_safe]
log-error=/log/mariadb.log
pid-file=/log/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d



MariaDB [(none)]> show variables like 'server_id';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| server_id       |    2    |
+---------------+-------+
1 row in set (0.00 sec)




## ACG 서로 ip 3306포트 개방
##replication -> jh-mha1의 db정보 기재
MariaDB [(none)]> CHANGE MASTER TO MASTER_HOST='192.168.100.50', MASTER_USER='test',MASTER_PASSWORD='root',MASTER_PORT=3306,MASTER_LOG_FILE='mysql.000001', MASTER_LOG_POS=324,MASTER_CONNECT_RETRY=10;

Query OK, 0 rows affected (0.02 sec)




## Slave 기동
MariaDB [(none)]> start slave;
Query OK, 0 rows affected (0.00 sec)




## Slave 상태 확인
MariaDB [(none)]> show slave status\G;
*************************** 1. row ***************************
               Slave_IO_State: Waiting for master to send event
                  Master_Host: 118.67.133.86
                  Master_User: test
                  Master_Port: 3306
                Connect_Retry: 10
              Master_Log_File: mysql.000001
          Read_Master_Log_Pos: 527
               Relay_Log_File: mysql-relay-bin.000002
                Relay_Log_Pos: 754
        Relay_Master_Log_File: mysql.000001
             Slave_IO_Running: Yes
            Slave_SQL_Running: Yes
              Replicate_Do_DB:
          Replicate_Ignore_DB:
           Replicate_Do_Table:
       Replicate_Ignore_Table:
      Replicate_Wild_Do_Table:
  Replicate_Wild_Ignore_Table:
                   Last_Errno: 0
                   Last_Error:
                 Skip_Counter: 0
          Exec_Master_Log_Pos: 527
              Relay_Log_Space: 1063
              Until_Condition: None
               Until_Log_File:
                Until_Log_Pos: 0
           Master_SSL_Allowed: No
           Master_SSL_CA_File:
           Master_SSL_CA_Path:
              Master_SSL_Cert:
            Master_SSL_Cipher:
               Master_SSL_Key:
        Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
                Last_IO_Errno: 0
                Last_IO_Error:
               Last_SQL_Errno: 0
               Last_SQL_Error:
  Replicate_Ignore_Server_Ids:
             Master_Server_Id: 1
               Master_SSL_Crl:
           Master_SSL_Crlpath:
                   Using_Gtid: No
                  Gtid_IO_Pos:
      Replicate_Do_Domain_Ids:
  Replicate_Ignore_Domain_Ids:
                Parallel_Mode: conservative
                    SQL_Delay: 0
          SQL_Remaining_Delay: NULL
      Slave_SQL_Running_State: Slave has read all relay log; waiting for the slave I/O thread to update it
1 row in set (0.00 sec)

 

 

MHA 구성

 

■ VIP 생성 (db1, db2 동일하게 만들어놓고 db1만 ifup 시킵니다.)

※ NCP에서 구축했기때문에 NCP기준으로 진행하겠습니다.
[root@jh-mha1 network-scripts]# vi ifcfg-eth1:1
DEVICE=eth1:1
BOOTPROTO=static
IPADDR=192.168.100.53            =>임의 지정
PREFIX=24
ONBOOT=no
ONPARENT=no




[root@jh-mha1 network-scripts]# ifup eth1:1




[root@jh-mha1 network-scripts]# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.41.181.201  netmask 255.255.254.0  broadcast 10.41.181.255
        ether f2:20:cd:59:d8:93  txqueuelen 1000  (Ethernet)
        RX packets 383193  bytes 487148455 (464.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 206549  bytes 24427042 (23.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.50  netmask 255.255.255.0  broadcast 192.168.100.255
        ether f2:d7:cf:4d:e0:af  txqueuelen 1000  (Ethernet)
        RX packets 13  bytes 750 (750.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 31  bytes 1526 (1.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
eth1:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.53  netmask 255.255.255.0  broadcast 192.168.100.255
        ether f2:d7:cf:4d:e0:af  txqueuelen 1000  (Ethernet)
 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 1  (Local Loopback)
        RX packets 87  bytes 8040 (7.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 87  bytes 8040 (7.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
 

 구성 필요 패키지 설치

# yum -y install epel*
# yum install -y epel perl-devel perl-CPAN perl-DBD-MySQL perl-Config-Tiny perl-Log-Dispatch perl-Parallel-ForkManager perl-Module-Install


rpm -qa |grep epel
rpm -qa |grep perl-devel
rpm -qa |grep perl-CPAN
rpm -qa |grep perl-DBD-MySQL
rpm -qa |grep perl-Config-Tiny
rpm -qa |grep perl-Log-Dispatch
rpm -qa |grep perl-Parallel-ForkManager
rpm -qa |grep perl-Module-Install





--->
[root@jh-mha1 network-scripts]# rpm -qa |grep epel
epel-release-7-11.noarch
[root@jh-mha1 network-scripts]# rpm -qa |grep perl-devel
perl-devel-5.16.3-299.el7_9.x86_64
[root@jh-mha1 network-scripts]# rpm -qa |grep perl-CPAN
perl-CPAN-Meta-Requirements-2.122-7.el7.noarch
perl-CPAN-Meta-YAML-0.008-14.el7.noarch
perl-CPAN-Meta-2.120921-5.el7.noarch
perl-CPANPLUS-0.91.38-4.el7.noarch
perl-CPAN-1.9800-299.el7_9.noarch
[root@jh-mha1 network-scripts]# rpm -qa |grep perl-DBD-MySQL
perl-DBD-MySQL-4.023-6.el7.x86_64
[root@jh-mha1 network-scripts]# rpm -qa |grep perl-Config-Tiny
perl-Config-Tiny-2.14-7.el7.noarch
[root@jh-mha1 network-scripts]# rpm -qa |grep perl-Log-Dispatch
perl-Log-Dispatch-2.41-1.el7.1.noarch
[root@jh-mha1 network-scripts]# rpm -qa |grep perl-Parallel-ForkManager
perl-Parallel-ForkManager-1.18-2.el7.noarch
[root@jh-mha1 network-scripts]# rpm -qa |grep perl-Module-Install
perl-Module-Install-1.06-4.el7.noarch
 


 SSH 공개키 공유

[root@khudb1 ~]# passwd



## ssh config 수정
[root@jh-mha1 network-scripts]# vi /etc/ssh/sshd_config


[root@jh-mha1 network-scripts]# cat /etc/ssh/sshd_config | grep PermitRootLogin
PermitRootLogin yes
# the setting of "PermitRootLogin without-password".




[root@jh-mha1 network-scripts]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):  enter
Enter passphrase (empty for no passphrase):  <enter>
Enter same passphrase again: <enter>
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
ef:c2:74:ab:db:88:58:b5:d3:d6:a3:06:19:c1:da:fe root@jh-mha1
The key's randomart image is:
+--[ RSA 2048]----+
|       .         |
|        o        |
|       o .       |
|      . o        |
|       .So       |
|       .=+..     |
|      .oo++.o    |
|     o .o*E. .   |
|    . . +=+      |
+-----------------+




[root@jh-mha1 network-scripts]# ls -al ~/.ssh/
total 12
drwx------  2 root root   36 Aug  3 17:04 .
dr-xr-x---. 6 root root 4096 Aug  3 17:03 ..
-rw-------  1 root root 1675 Aug  3 17:04 id_rsa
-rw-r--r--  1 root root  394 Aug  3 17:04 id_rsa.pub





[root@jh-mha1 network-scripts]# chmod 700 ~/.ssh
[root@jh-mha1 network-scripts]# chmod 600 ~/.ssh/id_rsa
[root@jh-mha1 network-scripts]# chmod 644 ~/.ssh/id_rsa.pub
[root@jh-mha1 network-scripts]# cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
[root@jh-mha1 network-scripts]# chmod 644 ~/.ssh/authorized_keys




[root@jh-mha1 network-scripts]# cd ~/.ssh/
[root@jh-mha1 .ssh]# ll
total 12
-rw-r--r-- 1 root root  394 Aug  3 17:05 authorized_keys
-rw------- 1 root root 1675 Aug  3 17:04 id_rsa
-rw-r--r-- 1 root root  394 Aug  3 17:04 id_rsa.pub




##SSH 접속을 비번없이 가능하게 하기 위해 키를 교환
manager -> node1, node2
node1 -> node2, manager
node2 -> node1, manager



[root@jh-mha1 .ssh]# vi authorized_keys
[root@jh-mha2 .ssh]# vi authorized_keys
[root@jh-mha-manager .ssh]# vi authorized_keys
##jh-mha1
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC5GQI/uUFOI/0neXKm+DQ3R9h1suRQXnLtE98tPOcIqdKq1HrgADvU+kilOC3mlPbTAZj/A/L56mYM8VnirmSrN0nBG1riXTd9Wv9CAyWCyb5MoQhIWkAyvdU1UzJYFMSyssL8HHJ38DdhogCb1/2JCz2p5WISUroMbOBqdEiyCiUgjtTH3zU+51oP8ADk7b4MYu3OtcJUX3wU/OfbuBiewiR6UWpCQb9xNVBDVrlw4xFF+4ajKLLpjl0gsZXvTHjkJei6BNsmsgoni+pqdfN6ctVHAeS9cREnzZrosOpcsdnOfPpsPbji5f8T2lcDgl43/5jxJwLIDMrVx9xjkxpr root@jh-mha1

##jh-mha2
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDEGe89tGCZSCHv5JyAX7wCJxD0ZLro8p/BhokNclVw/yJ4jYNCV2A5Cp5jny53LhzCQ5vDHbkDiZ7kSkM/Ef/xZXsq6edYs7wpjC0xiF6YPQAUhPFdL1u6qZLyEKieZuOf2ugXJtgDRxOzUtbAErxaXlW+HfbzdjGlfv/o8CJW/YRO8sOVoiCcaxUjtVDPXDqGji1LxCI2c4tv9a6sNIASJRSgSGUpKm+ezQOg4fWPe872k6yAYUzl/7rVt9jmE69DMd0O81CjOXVcBSXhsRSH5X1kyyizrAvUBP7zabwHfCmx1Hu2yyRoqa0uj1N7Aom7n1/wIbeFytvBZkyTVXFx root@jh-mha2

##jh-mha-manager
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDnMJCqyB7zMO9eivk+fUkoYXNlBa4S7MjXVD1yMgbxmE9ka0lf8tXdv/qFxegp1IqH+QbDH+2WxormmHUDzAqzgYhQxS4LI7QDhBeN91DmDJPsSJZjCAzBQL7UGWRbJXWX1lP+4Wo/yUbKNQhNWohs+tnNeBAoWPSEJFsuDy8K/y5nTukybIfRKyp45puKu2Iz3Y2jt5Gp04ltblS3O7yDQFcXv7fBvu89DCi/5+/oAhU+9xwigon+SM+K2aXMEmcsG1+W9qVyO7eiyCNUiOC3o5vAD19IcfFcw25X+lQMJRNIIkcTFDktPiBQVMD7IRgbaCkXTA/YLzPAxKGzncsn root@jh-mha-manager



## sshd 재시작
[root@khudb1 .ssh]# systemctl restart sshd




##manager -> db1 , db2  ssh접속 가능 여부 확인
[root@jh-mha-manager network-scripts]# ssh 192.168.100.50
[root@jh-mha1 ~]#


[root@jh-mha-manager network-scripts]# ssh 192.168.100.51
[root@jh-mha2 ~]#

 

 

 mha4mysql-node 컴파일 & 인스톨 ( jh-mha1 & jh-mha2 & jh-manager )

<Manager>
[root@jh-mha-manager ~]# tar -zxvf mha4mysql-node-0.57.tar.gz


[root@jh-mha-manager ~]# cd mha4mysql-node-0.57/


[root@jh-mha-manager mha4mysql-node-0.57]# perl Makefile.PL
*** Module::AutoInstall version 1.06
*** Checking for Perl dependencies...
[Core Features]
- DBI        ...loaded. (1.627)
- DBD::mysql ...loaded. (4.023)
*** Module::AutoInstall configuration finished.
Checking if your kit is complete...
Looks good
Writing Makefile for mha4mysql::node
Writing MYMETA.yml and MYMETA.json





[root@jh-mha-manager mha4mysql-node-0.57]# make && make install
cp lib/MHA/BinlogManager.pm blib/lib/MHA/BinlogManager.pm
cp lib/MHA/BinlogPosFindManager.pm blib/lib/MHA/BinlogPosFindManager.pm
cp lib/MHA/BinlogPosFinderXid.pm blib/lib/MHA/BinlogPosFinderXid.pm
cp lib/MHA/BinlogHeaderParser.pm blib/lib/MHA/BinlogHeaderParser.pm
cp lib/MHA/BinlogPosFinder.pm blib/lib/MHA/BinlogPosFinder.pm
cp lib/MHA/NodeUtil.pm blib/lib/MHA/NodeUtil.pm
cp lib/MHA/BinlogPosFinderElp.pm blib/lib/MHA/BinlogPosFinderElp.pm
cp lib/MHA/SlaveUtil.pm blib/lib/MHA/SlaveUtil.pm
cp lib/MHA/NodeConst.pm blib/lib/MHA/NodeConst.pm
cp bin/filter_mysqlbinlog blib/script/filter_mysqlbinlog
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/filter_mysqlbinlog
cp bin/apply_diff_relay_logs blib/script/apply_diff_relay_logs
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/apply_diff_relay_logs
cp bin/purge_relay_logs blib/script/purge_relay_logs
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/purge_relay_logs
cp bin/save_binary_logs blib/script/save_binary_logs
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/save_binary_logs
Manifying blib/man1/filter_mysqlbinlog.1
Manifying blib/man1/apply_diff_relay_logs.1
Manifying blib/man1/purge_relay_logs.1
Manifying blib/man1/save_binary_logs.1
Installing /usr/local/share/perl5/MHA/BinlogManager.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFindManager.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFinderXid.pm
Installing /usr/local/share/perl5/MHA/BinlogHeaderParser.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFinder.pm
Installing /usr/local/share/perl5/MHA/NodeUtil.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFinderElp.pm
Installing /usr/local/share/perl5/MHA/SlaveUtil.pm
Installing /usr/local/share/perl5/MHA/NodeConst.pm
Installing /usr/local/share/man/man1/filter_mysqlbinlog.1
Installing /usr/local/share/man/man1/apply_diff_relay_logs.1
Installing /usr/local/share/man/man1/purge_relay_logs.1
Installing /usr/local/share/man/man1/save_binary_logs.1
Installing /usr/local/bin/filter_mysqlbinlog
Installing /usr/local/bin/apply_diff_relay_logs
Installing /usr/local/bin/purge_relay_logs
Installing /usr/local/bin/save_binary_logs
Appending installation info to /usr/lib64/perl5/perllocal.pod





<Master>
[root@jh-mha1 mha4mysql-node-0.57]# perl Makefile.PL
*** Module::AutoInstall version 1.06
*** Checking for Perl dependencies...
[Core Features]
- DBI        ...loaded. (1.627)
- DBD::mysql ...loaded. (4.023)
*** Module::AutoInstall configuration finished.
Checking if your kit is complete...
Looks good
Writing Makefile for mha4mysql::node
Writing MYMETA.yml and MYMETA.json






[root@jh-mha1 mha4mysql-node-0.57]# make && make install
cp lib/MHA/BinlogManager.pm blib/lib/MHA/BinlogManager.pm
cp lib/MHA/BinlogPosFindManager.pm blib/lib/MHA/BinlogPosFindManager.pm
cp lib/MHA/BinlogPosFinderXid.pm blib/lib/MHA/BinlogPosFinderXid.pm
cp lib/MHA/BinlogHeaderParser.pm blib/lib/MHA/BinlogHeaderParser.pm
cp lib/MHA/BinlogPosFinder.pm blib/lib/MHA/BinlogPosFinder.pm
cp lib/MHA/NodeUtil.pm blib/lib/MHA/NodeUtil.pm
cp lib/MHA/BinlogPosFinderElp.pm blib/lib/MHA/BinlogPosFinderElp.pm
cp lib/MHA/SlaveUtil.pm blib/lib/MHA/SlaveUtil.pm
cp lib/MHA/NodeConst.pm blib/lib/MHA/NodeConst.pm
cp bin/filter_mysqlbinlog blib/script/filter_mysqlbinlog
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/filter_mysqlbinlog
cp bin/apply_diff_relay_logs blib/script/apply_diff_relay_logs
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/apply_diff_relay_logs
cp bin/purge_relay_logs blib/script/purge_relay_logs
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/purge_relay_logs
cp bin/save_binary_logs blib/script/save_binary_logs
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/save_binary_logs
Manifying blib/man1/filter_mysqlbinlog.1
Manifying blib/man1/apply_diff_relay_logs.1
Manifying blib/man1/purge_relay_logs.1
Manifying blib/man1/save_binary_logs.1
Installing /usr/local/share/perl5/MHA/BinlogManager.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFindManager.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFinderXid.pm
Installing /usr/local/share/perl5/MHA/BinlogHeaderParser.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFinder.pm
Installing /usr/local/share/perl5/MHA/NodeUtil.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFinderElp.pm
Installing /usr/local/share/perl5/MHA/SlaveUtil.pm
Installing /usr/local/share/perl5/MHA/NodeConst.pm
Installing /usr/local/share/man/man1/filter_mysqlbinlog.1
Installing /usr/local/share/man/man1/apply_diff_relay_logs.1
Installing /usr/local/share/man/man1/purge_relay_logs.1
Installing /usr/local/share/man/man1/save_binary_logs.1
Installing /usr/local/bin/filter_mysqlbinlog
Installing /usr/local/bin/apply_diff_relay_logs
Installing /usr/local/bin/purge_relay_logs
Installing /usr/local/bin/save_binary_logs
Appending installation info to /usr/lib64/perl5/perllocal.pod




<Slave>
[root@jh-mha2 mha4mysql-node-0.57]# perl Makefile.PL
*** Module::AutoInstall version 1.06
*** Checking for Perl dependencies...
[Core Features]
- DBI        ...loaded. (1.627)
- DBD::mysql ...loaded. (4.023)
*** Module::AutoInstall configuration finished.
Checking if your kit is complete...
Looks good
Writing Makefile for mha4mysql::node
Writing MYMETA.yml and MYMETA.json



[root@jh-mha2 mha4mysql-node-0.57]# make && make install
cp lib/MHA/BinlogManager.pm blib/lib/MHA/BinlogManager.pm
cp lib/MHA/BinlogPosFindManager.pm blib/lib/MHA/BinlogPosFindManager.pm
cp lib/MHA/BinlogPosFinderXid.pm blib/lib/MHA/BinlogPosFinderXid.pm
cp lib/MHA/BinlogHeaderParser.pm blib/lib/MHA/BinlogHeaderParser.pm
cp lib/MHA/BinlogPosFinder.pm blib/lib/MHA/BinlogPosFinder.pm
cp lib/MHA/NodeUtil.pm blib/lib/MHA/NodeUtil.pm
cp lib/MHA/BinlogPosFinderElp.pm blib/lib/MHA/BinlogPosFinderElp.pm
cp lib/MHA/SlaveUtil.pm blib/lib/MHA/SlaveUtil.pm
cp lib/MHA/NodeConst.pm blib/lib/MHA/NodeConst.pm
cp bin/filter_mysqlbinlog blib/script/filter_mysqlbinlog
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/filter_mysqlbinlog
cp bin/apply_diff_relay_logs blib/script/apply_diff_relay_logs
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/apply_diff_relay_logs
cp bin/purge_relay_logs blib/script/purge_relay_logs
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/purge_relay_logs
cp bin/save_binary_logs blib/script/save_binary_logs
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/save_binary_logs
Manifying blib/man1/filter_mysqlbinlog.1
Manifying blib/man1/apply_diff_relay_logs.1
Manifying blib/man1/purge_relay_logs.1
Manifying blib/man1/save_binary_logs.1
Installing /usr/local/share/perl5/MHA/BinlogManager.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFindManager.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFinderXid.pm
Installing /usr/local/share/perl5/MHA/BinlogHeaderParser.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFinder.pm
Installing /usr/local/share/perl5/MHA/NodeUtil.pm
Installing /usr/local/share/perl5/MHA/BinlogPosFinderElp.pm
Installing /usr/local/share/perl5/MHA/SlaveUtil.pm
Installing /usr/local/share/perl5/MHA/NodeConst.pm
Installing /usr/local/share/man/man1/filter_mysqlbinlog.1
Installing /usr/local/share/man/man1/apply_diff_relay_logs.1
Installing /usr/local/share/man/man1/purge_relay_logs.1
Installing /usr/local/share/man/man1/save_binary_logs.1
Installing /usr/local/bin/filter_mysqlbinlog
Installing /usr/local/bin/apply_diff_relay_logs
Installing /usr/local/bin/purge_relay_logs
Installing /usr/local/bin/save_binary_logs
Appending installation info to /usr/lib64/perl5/perllocal.pod
 
 
 
 

mha4mysql-manager 컴파일 & 인스톨 (Manager)

jh-mha-manager

[root@jh-mha-manager ~]# tar -zxvf mha4mysql-manager-0.57.tar.gz
[root@jh-mha-manager ~]# cd mha4mysql-manager-0.57/


[root@jh-mha-manager mha4mysql-manager-0.57]# cpan YAML
CPAN is the world-wide archive of perl resources. It consists of about
300 sites that all replicate the same contents around the globe. Many
countries have at least one CPAN site already. The resources found on
CPAN are easily accessible with the CPAN.pm module. If you want to use
CPAN.pm, lots of things have to be configured. Fortunately, most of
them can be determined automatically. If you prefer the automatic
configuration, answer 'yes' below.


If you prefer to enter a dialog instead, you can answer 'no' to this
question and I'll let you configure in small steps one thing after the
other. (Note: you can revisit this dialog anytime later by typing 'o
conf init' at the cpan prompt.)
Would you like me to configure as much as possible automatically? [yes]
(생략)..................................
...
Installing /usr/local/share/man/man3/YAML::Error.3pm
Installing /usr/local/share/man/man3/YAML::Marshall.3pm
Installing /usr/local/share/man/man3/YAML::Loader::Base.3pm
Installing /usr/local/share/man/man3/YAML::Types.3pm
Installing /usr/local/share/man/man3/YAML.3pm
Installing /usr/local/share/man/man3/YAML::Node.3pm
Installing /usr/local/share/man/man3/YAML::Any.3pm
Installing /usr/local/share/man/man3/YAML::Loader.3pm
Installing /usr/local/share/man/man3/YAML::Dumper::Base.3pm
Installing /usr/local/share/man/man3/YAML::Dumper.3pm
Appending installation info to /usr/lib64/perl5/perllocal.pod
  TINITA/YAML-1.30.tar.gz
  /usr/bin/make install  -- OK



[root@jh-mha-manager mha4mysql-manager-0.57]# perl -MCPAN -e "install File::Remove"
Reading '/root/.cpan/Metadata'
  Database was generated on Tue, 03 Aug 2021 07:41:03 GMT
Running install for module 'File::Remove'
Running make for S/SH/SHLOMIF/File-Remove-1.60.tar.gz
Fetching with LWP:
http://www.cpan.org/authors/id/S/SH/SHLOMIF/File-Remove-1.60.tar.gz
Fetching with LWP:
HASH(0x12f9e650)authors/id/S/SH/SHLOMIF/CHECKSUMS
...생략



[root@jh-mha-manager mha4mysql-manager-0.57]# perl -MCPAN -e "install Build"
Reading '/root/.cpan/Metadata'
  Database was generated on Tue, 03 Aug 2021 07:41:03 GMT
Running install for module 'Build'
Running make for A/AU/AUTRIJUS/Acme-Hello-0.02.tar.gz
Fetching with LWP:
http://www.cpan.org/authors/id/A/AU/AUTRIJUS/Acme-Hello-0.02.tar.gz
...생략



[root@jh-mha-manager mha4mysql-manager-0.57]# perl -MCPAN -e "install Module::Install"
...
Installing /usr/local/share/man/man3/Module::Install::Base.3pm
Installing /usr/local/share/man/man3/Module::Install::Philosophy.3pm
Installing /usr/local/share/man/man3/Module::Install::Deprecated.3pm
Installing /usr/local/share/man/man3/Module::Install.3pm
Appending installation info to /usr/lib64/perl5/perllocal.pod
  ETHER/Module-Install-1.19.tar.gz
  /usr/bin/make install  -- OK


[root@jh-mha-manager mha4mysql-manager-0.57]# perl -MCPAN -e "install Net::Telnet"
...
Installing /usr/local/share/man/man3/Net::Telnet.3pm
Appending installation info to /usr/lib64/perl5/perllocal.pod
  JROGERS/Net-Telnet-3.05.tar.gz
  /usr/bin/make install  -- OK


[root@jh-mha-manager mha4mysql-manager-0.57]# perl -MCPAN -e "install Log::Dispatch"
...
Installing /usr/local/share/man/man3/Log::Dispatch::ApacheLog.3pm
Installing /usr/local/share/man/man3/Log::Dispatch::Vars.3pm
Appending installation info to /usr/lib64/perl5/perllocal.pod
  DROLSKY/Log-Dispatch-2.70.tar.gz
  /usr/bin/make install  -- OK




[root@jh-mha-manager mha4mysql-manager-0.57]# perl Makefile.PL
*** Module::AutoInstall version 1.06
*** Checking for Perl dependencies...
[Core Features]
- DBI                   ...loaded. (1.627)
- DBD::mysql            ...loaded. (4.023)
- Time::HiRes           ...loaded. (1.9725)
- Config::Tiny          ...loaded. (2.14)
- Log::Dispatch         ...loaded. (2.70)
- Parallel::ForkManager ...loaded. (1.18)
- MHA::NodeConst        ...loaded. (0.57)
*** Module::AutoInstall configuration finished.
Checking if your kit is complete...
Looks good
Writing Makefile for mha4mysql::manager
Writing MYMETA.yml and MYMETA.json




[root@jh-mha-manager mha4mysql-manager-0.57]# make && make install
cp lib/MHA/ManagerUtil.pm blib/lib/MHA/ManagerUtil.pm
cp lib/MHA/Config.pm blib/lib/MHA/Config.pm
cp lib/MHA/HealthCheck.pm blib/lib/MHA/HealthCheck.pm
cp lib/MHA/ServerManager.pm blib/lib/MHA/ServerManager.pm
cp lib/MHA/ManagerConst.pm blib/lib/MHA/ManagerConst.pm
cp lib/MHA/ManagerAdmin.pm blib/lib/MHA/ManagerAdmin.pm
cp lib/MHA/FileStatus.pm blib/lib/MHA/FileStatus.pm
cp lib/MHA/MasterFailover.pm blib/lib/MHA/MasterFailover.pm
cp lib/MHA/ManagerAdminWrapper.pm blib/lib/MHA/ManagerAdminWrapper.pm
cp lib/MHA/MasterMonitor.pm blib/lib/MHA/MasterMonitor.pm
cp lib/MHA/MasterRotate.pm blib/lib/MHA/MasterRotate.pm
cp lib/MHA/SSHCheck.pm blib/lib/MHA/SSHCheck.pm
cp lib/MHA/Server.pm blib/lib/MHA/Server.pm
cp lib/MHA/DBHelper.pm blib/lib/MHA/DBHelper.pm
cp bin/masterha_stop blib/script/masterha_stop
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_stop
cp bin/masterha_conf_host blib/script/masterha_conf_host
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_conf_host
cp bin/masterha_check_repl blib/script/masterha_check_repl
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_check_repl
cp bin/masterha_check_status blib/script/masterha_check_status
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_check_status
cp bin/masterha_master_monitor blib/script/masterha_master_monitor
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_master_monitor
cp bin/masterha_check_ssh blib/script/masterha_check_ssh
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_check_ssh
cp bin/masterha_master_switch blib/script/masterha_master_switch
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_master_switch
cp bin/masterha_secondary_check blib/script/masterha_secondary_check
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_secondary_check
cp bin/masterha_manager blib/script/masterha_manager
/usr/bin/perl "-Iinc" -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/masterha_manager
Manifying blib/man1/masterha_stop.1
Manifying blib/man1/masterha_conf_host.1
Manifying blib/man1/masterha_check_repl.1
Manifying blib/man1/masterha_check_status.1
Manifying blib/man1/masterha_master_monitor.1
Manifying blib/man1/masterha_check_ssh.1
Manifying blib/man1/masterha_master_switch.1
Manifying blib/man1/masterha_secondary_check.1
Manifying blib/man1/masterha_manager.1
Installing /usr/local/share/perl5/MHA/ManagerUtil.pm
Installing /usr/local/share/perl5/MHA/Config.pm
Installing /usr/local/share/perl5/MHA/HealthCheck.pm
Installing /usr/local/share/perl5/MHA/ServerManager.pm
Installing /usr/local/share/perl5/MHA/ManagerConst.pm
Installing /usr/local/share/perl5/MHA/ManagerAdmin.pm
Installing /usr/local/share/perl5/MHA/FileStatus.pm
Installing /usr/local/share/perl5/MHA/MasterFailover.pm
Installing /usr/local/share/perl5/MHA/ManagerAdminWrapper.pm
Installing /usr/local/share/perl5/MHA/MasterMonitor.pm
Installing /usr/local/share/perl5/MHA/MasterRotate.pm
Installing /usr/local/share/perl5/MHA/SSHCheck.pm
Installing /usr/local/share/perl5/MHA/Server.pm
Installing /usr/local/share/perl5/MHA/DBHelper.pm
Installing /usr/local/share/man/man1/masterha_stop.1
Installing /usr/local/share/man/man1/masterha_conf_host.1
Installing /usr/local/share/man/man1/masterha_check_repl.1
Installing /usr/local/share/man/man1/masterha_check_status.1
Installing /usr/local/share/man/man1/masterha_master_monitor.1
Installing /usr/local/share/man/man1/masterha_check_ssh.1
Installing /usr/local/share/man/man1/masterha_master_switch.1
Installing /usr/local/share/man/man1/masterha_secondary_check.1
Installing /usr/local/share/man/man1/masterha_manager.1
Installing /usr/local/bin/masterha_stop
Installing /usr/local/bin/masterha_conf_host
Installing /usr/local/bin/masterha_check_repl
Installing /usr/local/bin/masterha_check_status
Installing /usr/local/bin/masterha_master_monitor
Installing /usr/local/bin/masterha_check_ssh
Installing /usr/local/bin/masterha_master_switch
Installing /usr/local/bin/masterha_secondary_check
Installing /usr/local/bin/masterha_manager
Appending installation info to /usr/lib64/perl5/perllocal.pod
 
 
 
 

MHA CONFIGURE (jh-mha-manager)

[root@jh-mha-manager mha4mysql-manager-0.57]# vi ~/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

alias sshcheck='/usr/local/bin/masterha_check_ssh --conf=/etc/mha.cnf'

alias replcheck='/usr/local/bin/masterha_check_repl --conf=/etc/mha.cnf'

alias start='/usr/local/bin/masterha_manager --conf=/etc/mha.cnf &'

alias stop='/usr/local/bin/masterha_stop --conf=/etc/mha.cnf' 
                                   
alias status='/usr/local/bin/masterha_check_status --conf=/etc/mha.cnf'

alias log='tail -f /var/log/masterha/app1/app1.log'

export PATH





[root@khudb-manager mha4mysql-manager-0.57]# cp /root/mha4mysql-manager-0.57/samples/conf/app1.cnf  /etc/mha.cnf

[root@khudb-manager mha4mysql-manager-0.57]# mkdir /mha

[root@jh-mha-manager mha4mysql-manager-0.57]# vi /etc/mha.cnf
# MHA용 mysql 사용자 및 비밀번호
[server default]
user=mha                     
password=root
ssh_user=root


# working directory on the manager
manager_workdir=/var/log/masterha/app1


# manager log file
manager_log=/var/log/masterha/app1/app1.log


# working directory on MySQL servers
remote_workdir=/var/log/masterha/app5


repl_user=test
repl_password=root


master_binlog_dir=/data



#ping interval, 3 times trial
ping_interval=5


#custom scripts for master ip failover
master_ip_failover_script=/var/log/masterha/app1/custom_scripts/master_ip_failover


#custom scripts for shutdown using fencing network custom script
#shutdown_script=/var/log/masterha/app1/custom_scripts/power_manager


#custom scripts for manual master switch
master_ip_online_change_script=/var/log/masterha/app1/custom_scripts/master_ip_online_change


#마스터 및 슬레이브 모든 노드들을 등록한다. (별도의 마스터/슬레이브 지정은 없다)
[server1]
hostname=192.168.100.50
port=3306
ignore_fail=1


[server2]
hostname=192.168.100.51
port=3306
ignore_fail=1




:wq





##디렉토리 생성
[root@jh-mha-manager app1]# mkdir -p /var/log/masterha/app1/custom_scripts






Master & Slave /mha 생성 (jh-mha1, jh-mha2)
[root@jh-mha1 mysql]# mkdir -p /var/log/masterha/app5

[root@jh-mha2 mysql]# mkdir -p /var/log/masterha/app5

 
 
 
 

 SSH Check (jh-mha-manager)

[root@jh-mha-manager app1]# sshcheck
Thu Aug  5 12:15:26 2021 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Thu Aug  5 12:15:26 2021 - [info] Reading application default configuration from /etc/mha.cnf..
Thu Aug  5 12:15:26 2021 - [info] Reading server configuration from /etc/mha.cnf..
Thu Aug  5 12:15:26 2021 - [info] Starting SSH connection tests..
Thu Aug  5 12:15:26 2021 - [debug]
Thu Aug  5 12:15:26 2021 - [debug]  Connecting via SSH from root@192.168.100.50(192.168.100.50:22) to root@192.168.100.51(192.168.100.51:22)..
Thu Aug  5 12:15:26 2021 - [debug]   ok.
Thu Aug  5 12:15:27 2021 - [debug]
Thu Aug  5 12:15:26 2021 - [debug]  Connecting via SSH from root@192.168.100.51(192.168.100.51:22) to root@192.168.100.50(192.168.100.50:22)..
Thu Aug  5 12:15:27 2021 - [debug]   ok.
Thu Aug  5 12:15:27 2021 - [info] All SSH connection tests passed successfully.
Use of uninitialized value in exit at /usr/local/bin/masterha_check_ssh line 44.
 
 
 
 

Replcheck 

##replcheck 전 미리 생성(jh-mha1, jh-mha2)
[root@jh-mha1 bin]# ln -s /mysql/bin/mysqlbinlog  /usr/bin/mysqlbinlog
[root@jh-mha1 bin]# ln -s /mysql/bin/mysql /usr/bin/mysql

[root@jh-mha2 bin]# ln -s /mysql/bin/mysqlbinlog  /usr/bin/mysqlbinlog
[root@jh-mha2 bin]# ln -s /mysql/bin/mysql /usr/bin/mysql



[root@jh-mha-manager custom_scripts]# replcheck
Fri Aug  6 10:47:12 2021 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Fri Aug  6 10:47:12 2021 - [info] Reading application default configuration from /etc/mha.cnf..
Fri Aug  6 10:47:12 2021 - [info] Reading server configuration from /etc/mha.cnf..
Fri Aug  6 10:47:12 2021 - [info] MHA::MasterMonitor version 0.57.
Fri Aug  6 10:47:13 2021 - [info] GTID failover mode = 0
Fri Aug  6 10:47:13 2021 - [info] Dead Servers:
Fri Aug  6 10:47:13 2021 - [info] Alive Servers:
Fri Aug  6 10:47:13 2021 - [info]   192.168.100.50(192.168.100.50:3306)
Fri Aug  6 10:47:13 2021 - [info]   192.168.100.51(192.168.100.51:3306)
Fri Aug  6 10:47:13 2021 - [info] Alive Slaves:
Fri Aug  6 10:47:13 2021 - [info]   192.168.100.51(192.168.100.51:3306)  Version=10.2.12-MariaDB-log (oldest major version between slaves) log-bin:enabled
Fri Aug  6 10:47:13 2021 - [info]     Replicating from 192.168.100.50(192.168.100.50:3306)
Fri Aug  6 10:47:13 2021 - [info] Current Alive Master: 192.168.100.50(192.168.100.50:3306)
Fri Aug  6 10:47:13 2021 - [info] Checking slave configurations..
Fri Aug  6 10:47:13 2021 - [info] Checking replication filtering settings..
Fri Aug  6 10:47:13 2021 - [info]  binlog_do_db= , binlog_ignore_db=
Fri Aug  6 10:47:13 2021 - [info]  Replication filtering check ok.
Fri Aug  6 10:47:13 2021 - [info] GTID (with auto-pos) is not supported
Fri Aug  6 10:47:13 2021 - [info] Starting SSH connection tests..
Fri Aug  6 10:47:14 2021 - [info] All SSH connection tests passed successfully.
Fri Aug  6 10:47:14 2021 - [info] Checking MHA Node version..
Fri Aug  6 10:47:14 2021 - [info]  Version check ok.
Fri Aug  6 10:47:14 2021 - [info] Checking SSH publickey authentication settings on the current master..
Fri Aug  6 10:47:14 2021 - [info] HealthCheck: SSH to 192.168.100.50 is reachable.
Fri Aug  6 10:47:14 2021 - [info] Master MHA Node version is 0.57.
Fri Aug  6 10:47:14 2021 - [info] Checking recovery script configurations on 192.168.100.50(192.168.100.50:3306)..
Fri Aug  6 10:47:14 2021 - [info]   Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/data --output_file=/var/log/masterha/app5/save_binary_logs_test --manager_version=0.57 --start_file=mysql.000010
Fri Aug  6 10:47:14 2021 - [info]   Connecting to root@192.168.100.50(192.168.100.50:22)..
  Creating /var/log/masterha/app5 if not exists..    ok.
  Checking output directory is accessible or not..
   ok.
  Binlog found at /data, up to mysql.000010
Fri Aug  6 10:47:14 2021 - [info] Binlog setting check done.
Fri Aug  6 10:47:14 2021 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Fri Aug  6 10:47:14 2021 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='test' --slave_host=192.168.100.51 --slave_ip=192.168.100.51 --slave_port=3306 --workdir=/var/log/masterha/app5 --target_version=10.2.12-MariaDB-log --manager_version=0.57 --relay_log_info=/data/relay-log.info  --relay_dir=/data/  --slave_pass=xxx
Fri Aug  6 10:47:14 2021 - [info]   Connecting to root@192.168.100.51(192.168.100.51:22)..
  Checking slave recovery environment settings..
    Opening /data/relay-log.info ... ok.
    Relay log found at /data, up to mysql-relay-bin.000004
    Temporary relay log file is /data/mysql-relay-bin.000004
    Testing mysql connection and privileges.. done.
    Testing mysqlbinlog output.. done.
    Cleaning up test file(s).. done.
Fri Aug  6 10:47:14 2021 - [info] Slaves settings check done.
Fri Aug  6 10:47:14 2021 - [info]
192.168.100.50(192.168.100.50:3306) (current master)
+--192.168.100.51(192.168.100.51:3306)

Fri Aug  6 10:47:14 2021 - [info] Checking replication health on 192.168.100.51..
Fri Aug  6 10:47:14 2021 - [info]  ok.
Fri Aug  6 10:47:14 2021 - [info] Checking master_ip_failover_script status:
Fri Aug  6 10:47:14 2021 - [info]   /var/log/masterha/app1/custom_scripts/master_ip_failover --command=status --ssh_user=root --orig_master_host=192.168.100.50 --orig_master_ip=192.168.100.50 --orig_master_port=3306
Fri Aug  6 10:47:15 2021 - [info]  OK.
Fri Aug  6 10:47:15 2021 - [warning] shutdown_script is not defined.
Fri Aug  6 10:47:15 2021 - [info] Got exit code 0 (Not master dead).

MySQL Replication Health is OK.
 
 
 
 
 

여기까지 MHA 구성을 하였습니다. part2에서 스크립트 생성, failover + switchover 테스트를 진행하겠습니다.