[MariaDB] MHA 구성(Part 4, 5. Failover Test, Switchover Test)

728x90

이전 포스트

 

[MariaDB] MHA 구성(Part 3. MHA 설정)

이전 포스트 [MariaDB] MHA 구성(Part 1. MariaDB 10.11.8 설치)1. MariaDB 바이너리 설치아래 설치 파일들을 모두 다운로드 받습니다.OS : Red Hat Enterprise Linux release 8.10 (Ootpa)MariaDB 10.11.8 엔진 다운로드(master, sl

khyup.tistory.com


4. Failover Test

master shutdown(master)
# systemctl stop mysqld

 

MHA 중지 확인(manager)
  1. failover가 발생하면 MHA는 중지됩니다.
# status

mha master maybe down(20:PING_FAILING). master:maria1
Check /mha/manager.log for details.
# status

mha is stopped(2:NOT_RUNNING).
# log
 
Started automated(non-interactive) failover.
Invalidated master IP address on maria1(192.168.137.171:3306)
The latest slave maria2(192.168.137.172:3306) has all relay logs for recovery.
Selected maria2(192.168.137.172:3306) as a new master.
maria2(192.168.137.172:3306): OK: Applying all logs succeeded.
maria2(192.168.137.172:3306): OK: Activated master IP address.
Generating relay diff files from the latest slave succeeded.
maria2(192.168.137.172:3306): Resetting slave info succeeded.
Master failover to maria2(192.168.137.172:3306) completed successfully.

 

VIP 확인(master, slave)
  • maria1 DB가 중지되면서 maria2가 master가 됩니다.
  • maria1 NI 확인
# ifconfig

ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.119  netmask 255.255.255.0  broadcast 192.168.137.255
        inet6 fe80::20c:29ff:feee:af03  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:ee:af:03  txqueuelen 1000  (Ethernet)
        RX packets 8420  bytes 966630 (943.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 6027  bytes 860697 (840.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2075  bytes 1314367 (1.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2075  bytes 1314367 (1.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 52:54:00:d7:d4:02  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
  • maria2 NI 확인
# ifconfig
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.120  netmask 255.255.255.0  broadcast 192.168.137.255
        inet6 fe80::20c:29ff:fee3:a6e3  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:e3:a6:e3  txqueuelen 1000  (Ethernet)
        RX packets 112043  bytes 152453510 (145.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 20952  bytes 1714213 (1.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
ens160:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.100.121  netmask 255.255.255.0  broadcast 192.168.137.255
        ether 00:0c:29:e3:a6:e3  txqueuelen 1000  (Ethernet)
 
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 2598  bytes 1352771 (1.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2598  bytes 1352771 (1.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
 
virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 52:54:00:ff:86:94  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

 

maria2 : slave -> master로 변경 확인(slave)
  • 명령어 입력시 Empty Set 이 출력되면 master로 변경된 상태
MariaDB [(none)]> show slave status\G;
Empty set (0.000 sec)
 
ERROR: No query specified
  • (참고)manager 서버에는 mha.failover.complete 파일이 생성됩니다.
# cd /mha
# ls -al

total 64
drwxr-xr-x   3 root root   135 Feb 21 14:59 .
dr-xr-xr-x. 19 root root   269 Feb 20 16:44 ..
-rw-r--r--   1 root root 60050 Feb 21 14:59 manager.log
-rw-r--r--   1 root root     0 Feb 21 14:59 mha.failover.complete
-rw-r--r--   1 root root   279 Feb 21 14:59 saved_master_binlog_from_maria1_3306_20240221145903.binlog
drwxr-xr-x   2 root root   110 Feb 21 14:22 scripts

 

5. Switchover TEST

maria2(master) 상태 확인(maria2)
MariaDB [(none)]> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000008 |      358 |              |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.001 sec)

 

replication 재설정(maria1)
  • maria1에서 실행
  • maria1을 slave로 replication 설정
# systemctl start mysqld
MariaDB [(none)]> CHANGE MASTER TO MASTER_HOST='192.168.137.172', MASTER_USER='rep',MASTER_PASSWORD='rep',MASTER_PORT=3306,MASTER_LOG_FILE='mysql-bin.000008', MASTER_LOG_POS=358,MASTER_CONNECT_RETRY=10;
Query OK, 0 rows affected, 1 warning (0.011 sec)
 
MariaDB [(none)]> start slave;
Query OK, 0 rows affected (0.001 sec)
 
MariaDB [(none)]> show slave status\G;
*************************** 1. row ***************************
                Slave_IO_State: Waiting for master to send event
                   Master_Host: 192.168.137.172
                   Master_User: rep
                   Master_Port: 3306
                 Connect_Retry: 10
               Master_Log_File: mysql-bin.000008
           Read_Master_Log_Pos: 358
                Relay_Log_File: maria1-relay-bin.000002
                 Relay_Log_Pos: 555
         Relay_Master_Log_File: mysql-bin.000008
              Slave_IO_Running: Yes
             Slave_SQL_Running: Yes
          Replicate_Rewrite_DB:
               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: 358
               Relay_Log_Space: 865
               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: 2
                Master_SSL_Crl:
            Master_SSL_Crlpath:
                    Using_Gtid: No
                   Gtid_IO_Pos:
       Replicate_Do_Domain_Ids:
   Replicate_Ignore_Domain_Ids:
                 Parallel_Mode: optimistic
                     SQL_Delay: 0
           SQL_Remaining_Delay: NULL
       Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
              Slave_DDL_Groups: 0
Slave_Non_Transactional_Groups: 0
    Slave_Transactional_Groups: 0
1 row in set (0.000 sec)
 
ERROR: No query specified

 

switchover 명령어 실행(manager)
  • MHA 데몬이 내려간 상태에서 진행
# masterha_master_switch --master_state=alive --conf=/etc/mha.cnf
Wed Feb 21 15:40:46 2024 - [info] MHA::MasterRotate version 0.58.
Wed Feb 21 15:40:46 2024 - [info] Starting online master switch..
Wed Feb 21 15:40:46 2024 - [info]
Wed Feb 21 15:40:46 2024 - [info] * Phase 1: Configuration Check Phase..
Wed Feb 21 15:40:46 2024 - [info]
Wed Feb 21 15:40:46 2024 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Wed Feb 21 15:40:46 2024 - [info] Reading application default configuration from /etc/mha.cnf..
Wed Feb 21 15:40:46 2024 - [info] Reading server configuration from /etc/mha.cnf..
Wed Feb 21 15:40:47 2024 - [info] GTID failover mode = 0
Wed Feb 21 15:40:47 2024 - [info] Current Alive Master: maria2(192.168.137.172:3306)
Wed Feb 21 15:40:47 2024 - [info] Alive Slaves:
Wed Feb 21 15:40:47 2024 - [info]   maria1(192.168.137.171:3306)  Version=10.11.7-MariaDB-log (oldest major version between slaves) log-bin:enabled
Wed Feb 21 15:40:47 2024 - [info]     Replicating from 192.168.137.172(192.168.137.172:3306)
Wed Feb 21 15:40:47 2024 - [info]     Primary candidate for the new Master (candidate_master is set)
 
It is better to execute FLUSH NO_WRITE_TO_BINLOG TABLES on the master before switching. Is it ok to execute on maria2(192.168.137.172:3306)? (YES/no): yes
Wed Feb 21 15:40:52 2024 - [info] Executing FLUSH NO_WRITE_TO_BINLOG TABLES. This may take long time..
Wed Feb 21 15:40:52 2024 - [info]  ok.
Wed Feb 21 15:40:52 2024 - [info] Checking MHA is not monitoring or doing failover..
Wed Feb 21 15:40:52 2024 - [info] Checking replication health on maria1..
Wed Feb 21 15:40:52 2024 - [info]  ok.
Wed Feb 21 15:40:52 2024 - [info] Searching new master from slaves..
Wed Feb 21 15:40:52 2024 - [info]  Candidate masters from the configuration file:
Wed Feb 21 15:40:52 2024 - [info]   maria1(192.168.137.171:3306)  Version=10.11.7-MariaDB-log (oldest major version between slaves) log-bin:enabled
Wed Feb 21 15:40:52 2024 - [info]     Replicating from 192.168.137.172(192.168.137.172:3306)
Wed Feb 21 15:40:52 2024 - [info]     Primary candidate for the new Master (candidate_master is set)
Wed Feb 21 15:40:52 2024 - [info]   maria2(192.168.137.172:3306)  Version=10.11.7-MariaDB-log log-bin:enabled
Wed Feb 21 15:40:52 2024 - [info]  Non-candidate masters:
Wed Feb 21 15:40:52 2024 - [info]  Searching from candidate_master slaves which have received the latest relay log events..
Wed Feb 21 15:40:52 2024 - [info]
From:
maria2(192.168.137.172:3306) (current master)
 +--maria1(192.168.137.171:3306)
 
To:
maria1(192.168.137.171:3306) (new master)
 
Starting master switch from maria2(192.168.137.172:3306) to maria1(192.168.137.171:3306)? (yes/NO): yes
Wed Feb 21 15:40:57 2024 - [info] Checking whether maria1(192.168.137.171:3306) is ok for the new master..
Wed Feb 21 15:40:57 2024 - [info]  ok.
Wed Feb 21 15:40:57 2024 - [info] ** Phase 1: Configuration Check Phase completed.
Wed Feb 21 15:40:57 2024 - [info]
Wed Feb 21 15:40:57 2024 - [info] * Phase 2: Rejecting updates Phase..
Wed Feb 21 15:40:57 2024 - [info]
Wed Feb 21 15:40:57 2024 - [info] Executing master ip online change script to disable write on the current master:
Wed Feb 21 15:40:57 2024 - [info]   /mha/scripts/master_ip_online_change --command=stop --orig_master_host=maria2 --orig_master_ip=192.168.137.172 --orig_master_port=3306 --orig_master_user='mha' --new_master_host=maria1 --new_master_ip=192.168.137.171 --new_master_port=3306 --new_master_user='mha' --orig_master_ssh_user=root --new_master_ssh_user=root   --orig_master_password=xxx --new_master_password=xxx
Wed Feb 21 15:40:57 2024 943376 Set read_only on the new master.. ok.
Wed Feb 21 15:40:57 2024 948274 Set read_only=1 on the orig master.. ok.
Wed Feb 21 15:40:57 2024 950487 Killing all application threads..
Wed Feb 21 15:40:57 2024 950577 done.
Wed Feb 21 15:40:57 2024 - [info]  ok.
Wed Feb 21 15:40:57 2024 - [info] Locking all tables on the orig master to reject updates from everybody (including root):
Wed Feb 21 15:40:57 2024 - [info] Executing FLUSH TABLES WITH READ LOCK..
Wed Feb 21 15:40:57 2024 - [info]  ok.
Wed Feb 21 15:40:57 2024 - [info] Orig master binlog:pos is mysql-bin.000008:358.
Wed Feb 21 15:40:57 2024 - [info]  Waiting to execute all relay logs on maria1(192.168.137.171:3306)..
Wed Feb 21 15:40:57 2024 - [info]  master_pos_wait(mysql-bin.000008:358) completed on maria1(192.168.137.171:3306). Executed 0 events.
Wed Feb 21 15:40:57 2024 - [info]   done.
Wed Feb 21 15:40:57 2024 - [info] Getting new master's binlog name and position..
Wed Feb 21 15:40:57 2024 - [info]  mysql-bin.000011:342
Wed Feb 21 15:40:57 2024 - [info]  All other slaves should start replication from here. Statement should be: CHANGE MASTER TO MASTER_HOST='maria1 or 192.168.137.171', MASTER_PORT=3306, MASTER_LOG_FILE='mysql-bin.000011', MASTER_LOG_POS=342, MASTER_USER='rep', MASTER_PASSWORD='xxx';
Wed Feb 21 15:40:57 2024 - [info] Executing master ip online change script to allow write on the new master:
Wed Feb 21 15:40:57 2024 - [info]   /mha/scripts/master_ip_online_change --command=start --orig_master_host=maria2 --orig_master_ip=192.168.137.172 --orig_master_port=3306 --orig_master_user='mha' --new_master_host=maria1 --new_master_ip=192.168.137.171 --new_master_port=3306 --new_master_user='mha' --orig_master_ssh_user=root --new_master_ssh_user=root   --orig_master_password=xxx --new_master_password=xxx
Wed Feb 21 15:40:58 2024 160928 Set read_only=0 on the new master.
Wed Feb 21 15:40:58 2024 - [info]  ok.
Wed Feb 21 15:40:58 2024 - [info]
Wed Feb 21 15:40:58 2024 - [info] * Switching slaves in parallel..
Wed Feb 21 15:40:58 2024 - [info]
Wed Feb 21 15:40:58 2024 - [info] Unlocking all tables on the orig master:
Wed Feb 21 15:40:58 2024 - [info] Executing UNLOCK TABLES..
Wed Feb 21 15:40:58 2024 - [info]  ok.
Wed Feb 21 15:40:58 2024 - [info] All new slave servers switched successfully.
Wed Feb 21 15:40:58 2024 - [info]
Wed Feb 21 15:40:58 2024 - [info] * Phase 5: New master cleanup phase..
Wed Feb 21 15:40:58 2024 - [info]
Wed Feb 21 15:40:58 2024 - [info]  maria1: Resetting slave info succeeded.
Wed Feb 21 15:40:58 2024 - [info] Switching master to maria1(192.168.137.171:3306) completed successfully.

 

maria1 : slave -> master 변경 확인(maria1)
MariaDB [(none)]> show slave status\G;
Empty set (0.000 sec)
 
ERROR: No query specified
 
MariaDB [(none)]> show master status;
+------------------+----------+--------------+------------------+
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000011 |      342 |              |                  |
+------------------+----------+--------------+------------------+
1 row in set (0.000 sec)

 

maria1(master), maria2(slave)로 replication 재설정(maria2)
  • maria2에서 진행
MariaDB [(none)]> CHANGE MASTER TO MASTER_HOST='192.168.137.171', MASTER_USER='rep',MASTER_PASSWORD='rep',MASTER_PORT=3306,MASTER_LOG_FILE='mysql-bin.000011', MASTER_LOG_POS=342,MASTER_CONNECT_RETRY=10;
Query OK, 0 rows affected, 1 warning (0.005 sec)
 
MariaDB [(none)]> start slave;
Query OK, 0 rows affected (0.002 sec)
 
MariaDB [(none)]> show slave status\G;
*************************** 1. row ***************************
                Slave_IO_State: Waiting for master to send event
                   Master_Host: 192.168.137.171
                   Master_User: rep
                   Master_Port: 3306
                 Connect_Retry: 10
               Master_Log_File: mysql-bin.000011
           Read_Master_Log_Pos: 342
                Relay_Log_File: relay_log.000002
                 Relay_Log_Pos: 555
         Relay_Master_Log_File: mysql-bin.000011
              Slave_IO_Running: Yes
             Slave_SQL_Running: Yes
          Replicate_Rewrite_DB:
               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: 342
               Relay_Log_Space: 858
               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: optimistic
                     SQL_Delay: 0
           SQL_Remaining_Delay: NULL
       Slave_SQL_Running_State: Slave has read all relay log; waiting for more updates
              Slave_DDL_Groups: 0
Slave_Non_Transactional_Groups: 0
    Slave_Transactional_Groups: 0
1 row in set (0.000 sec)
 
ERROR: No query specified

 

mha.failover.complete 파일 삭제(manager)
  • 파일을 삭제하지 않고 MHA 구동 시 정상 작동하지 않음
# rm /mha/mha.failover.complete

 

sshcheck, replcheck 진행(manager)
  • MHA 데몬 시작 전 sshcheck, replcheck 진행
# sshcheck
Wed Feb 21 15:51:37 2024 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Wed Feb 21 15:51:37 2024 - [info] Reading application default configuration from /etc/mha.cnf..
Wed Feb 21 15:51:37 2024 - [info] Reading server configuration from /etc/mha.cnf..
Wed Feb 21 15:51:37 2024 - [info] Starting SSH connection tests..
Wed Feb 21 15:51:38 2024 - [debug]
Wed Feb 21 15:51:38 2024 - [debug]  Connecting via SSH from root@maria2(192.168.137.172:22) to root@maria1(192.168.137.171:22)..
Wed Feb 21 15:51:38 2024 - [debug]   ok.
Wed Feb 21 15:51:38 2024 - [debug]
Wed Feb 21 15:51:37 2024 - [debug]  Connecting via SSH from root@maria1(192.168.137.171:22) to root@maria2(192.168.137.172:22)..
Wed Feb 21 15:51:38 2024 - [debug]   ok.
Wed Feb 21 15:51:38 2024 - [info] All SSH connection tests passed successfully.
Use of uninitialized value in exit at /usr/local/bin/masterha_check_ssh line 44.
 
# replcheck
Wed Feb 21 15:52:42 2024 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Wed Feb 21 15:52:42 2024 - [info] Reading application default configuration from /etc/mha.cnf..
Wed Feb 21 15:52:42 2024 - [info] Reading server configuration from /etc/mha.cnf..
Wed Feb 21 15:52:42 2024 - [info] MHA::MasterMonitor version 0.58.
Wed Feb 21 15:52:43 2024 - [info] GTID failover mode = 0
Wed Feb 21 15:52:43 2024 - [info] Dead Servers:
Wed Feb 21 15:52:43 2024 - [info] Alive Servers:
Wed Feb 21 15:52:43 2024 - [info]   maria1(192.168.137.171:3306)
Wed Feb 21 15:52:43 2024 - [info]   maria2(192.168.137.172:3306)
Wed Feb 21 15:52:43 2024 - [info] Alive Slaves:
Wed Feb 21 15:52:43 2024 - [info]   maria2(192.168.137.172:3306)  Version=10.11.7-MariaDB-log (oldest major version between slaves) log-bin:enabled
Wed Feb 21 15:52:43 2024 - [info]     Replicating from 192.168.137.171(192.168.137.171:3306)
Wed Feb 21 15:52:43 2024 - [info]     Primary candidate for the new Master (candidate_master is set)
Wed Feb 21 15:52:43 2024 - [info] Current Alive Master: maria1(192.168.137.171:3306)
Wed Feb 21 15:52:43 2024 - [info] Checking slave configurations..
Wed Feb 21 15:52:43 2024 - [info] Checking replication filtering settings..
Wed Feb 21 15:52:43 2024 - [info]  binlog_do_db= , binlog_ignore_db=
Wed Feb 21 15:52:43 2024 - [info]  Replication filtering check ok.
Wed Feb 21 15:52:43 2024 - [info] GTID (with auto-pos) is not supported
Wed Feb 21 15:52:43 2024 - [info] Starting SSH connection tests..
Wed Feb 21 15:52:44 2024 - [info] All SSH connection tests passed successfully.
Wed Feb 21 15:52:44 2024 - [info] Checking MHA Node version..
Wed Feb 21 15:52:44 2024 - [info]  Version check ok.
Wed Feb 21 15:52:44 2024 - [info] Checking SSH publickey authentication settings on the current master..
Wed Feb 21 15:52:44 2024 - [info] HealthCheck: SSH to maria1 is reachable.
Wed Feb 21 15:52:45 2024 - [info] Master MHA Node version is 0.58.
Wed Feb 21 15:52:45 2024 - [info] Checking recovery script configurations on maria1(192.168.137.171:3306)..
Wed Feb 21 15:52:45 2024 - [info]   Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/data/mariadb/log-bin --output_file=/mha/save_binary_logs_test --manager_version=0.58 --start_file=mysql-bin.000011
Wed Feb 21 15:52:45 2024 - [info]   Connecting to root@192.168.137.171(maria1:22)..
  Creating /mha if not exists..    ok.
  Checking output directory is accessible or not..
   ok.
  Binlog found at /data/mariadb/log-bin, up to mysql-bin.000011
Wed Feb 21 15:52:45 2024 - [info] Binlog setting check done.
Wed Feb 21 15:52:45 2024 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Wed Feb 21 15:52:45 2024 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='mha' --slave_host=maria2 --slave_ip=192.168.137.172 --slave_port=3306 --workdir=/mha --target_version=10.11.7-MariaDB-log --manager_version=0.58 --relay_log_info=/data/mariadb/master/relay-log.info  --relay_dir=/data/mariadb/master/  --slave_pass=xxx
Wed Feb 21 15:52:45 2024 - [info]   Connecting to root@192.168.137.172(maria2:22)..
  Checking slave recovery environment settings..
    Opening /data/mariadb/master/relay-log.info ... ok.
    Relay log found at /data/mariadb/log-bin, up to relay_log.000002
    Temporary relay log file is /data/mariadb/log-bin/relay_log.000002
    Checking if super_read_only is defined and turned on.. not present or turned off, ignoring.
    Testing mysql connection and privileges..
 done.
    Testing mysqlbinlog output.. done.
    Cleaning up test file(s).. done.
Wed Feb 21 15:52:45 2024 - [info] Slaves settings check done.
Wed Feb 21 15:52:45 2024 - [info]
maria1(192.168.137.171:3306) (current master)
 +--maria2(192.168.137.172:3306)
 
Wed Feb 21 15:52:45 2024 - [info] Checking replication health on maria2..
Wed Feb 21 15:52:45 2024 - [info]  ok.
Wed Feb 21 15:52:45 2024 - [info] Checking master_ip_failover_script status:
Wed Feb 21 15:52:45 2024 - [info]   /mha/scripts/master_ip_failover --command=status --ssh_user=root --orig_master_host=maria1 --orig_master_ip=192.168.137.171 --orig_master_port=3306
Wed Feb 21 15:52:45 2024 - [info]  OK.
Wed Feb 21 15:52:45 2024 - [warning] shutdown_script is not defined.
Wed Feb 21 15:52:45 2024 - [info] Got exit code 0 (Not master dead).
 
MySQL Replication Health is OK.

 

MHA 데몬 시작(manager)
# start

# ps -ef | grep mha
 
avahi        806       1  0 05:45 ?        00:00:00 avahi-daemon: running [mhamanager.local]
root       78745   74968  1 13:43 pts/1    00:00:00 perl /usr/local/bin/masterha_manager --conf=/etc/mha.cnf
root       78783   74968  0 13:43 pts/1    00:00:00 grep --color=auto mha

# status
 
mha (pid:78745) is running(0:PING_OK), master:maria1

다음 포스트

 

728x90