配置环境
主master:hostname server01
从master:hostname server02
slave1: hsotname server03
slave2:hsotname server04
manger机:hostname server05
[root@server01 ~]# vim /etc/hosts
192.168.200.10 server01
192.168.200.11 server02
192.168.200.12 server03
192.168.200.13 server04
192.168.200.14 server05
[root@server01 ~]# scp /etc/hosts 192.168.200.11:/etc/
[root@server01 ~]# scp /etc/hosts 192.168.200.12:/etc/
[root@server01 ~]# scp /etc/hosts 192.168.200.13:/etc/
[root@server01 ~]# scp /etc/hosts 192.168.200.14:/etc/
一:安装MHA NODE
二:安装MHA MANGER
三:配置ssh密钥对验证
四:安装MySQL
五:搭建主从复制环境
六:配置MHA环境
七:vip配置管理
MHA NODE和MHA Manger包是需要在网站下载之后传到虚拟机上
一:安装MHA NODE
######所有机器都需要安装epel源及相关的perl依赖包和MHA NODE#####
1:安装epel源
[root@server01 yum.repos.d]# rpm -ivh epel-release-latest-7.noarch.rpm
[root@server01 yum.repos.d]# yum -y clean all
[root@server01 yum.repos.d]# yum makecache
2.安装相关的perl依赖包
[root@server01 ~]# yum install -y perl-DBD-MySQL.x86_64 perl-DBI.x86_64 perl-CPAN perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
总用量 40
-r-xr-xr-x. 1 root root 16346 10月 23 10:37 apply_diff_relay_logs
-r-xr-xr-x. 1 root root 4807 10月 23 10:37 filter_mysqlbinlog
-r-xr-xr-x. 1 root root 7401 10月 23 10:37 purge_relay_logs
-r-xr-xr-x. 1 root root 7395 10月 23 10:37 save_binary_logs
[root@server05 ~]# cd mha4mysql-manager-0.56/
[root@server05 mha4mysql-manager-0.56]# perl Makefile.PL
总用量 76
-r-xr-xr-x. 1 root root 16346 10月 23 10:44 apply_diff_relay_logs
-r-xr-xr-x. 1 root root 4807 10月 23 10:44 filter_mysqlbinlog
-r-xr-xr-x. 1 root root 1995 10月 23 10:56 masterha_check_repl
-r-xr-xr-x. 1 root root 1779 10月 23 10:56 masterha_check_ssh
-r-xr-xr-x. 1 root root 1865 10月 23 10:56 masterha_check_status
-r-xr-xr-x. 1 root root 3201 10月 23 10:56 masterha_conf_host
-r-xr-xr-x. 1 root root 2517 10月 23 10:56 masterha_manager
-r-xr-xr-x. 1 root root 2165 10月 23 10:56 masterha_master_monitor
-r-xr-xr-x. 1 root root 2373 10月 23 10:56 masterha_master_switch
-r-xr-xr-x. 1 root root 3879 10月 23 10:56 masterha_secondary_check
-r-xr-xr-x. 1 root root 1739 10月 23 10:56 masterha_stop
-r-xr-xr-x. 1 root root 7401 10月 23 10:44 purge_relay_logs
-r-xr-xr-x. 1 root root 7395 10月 23 10:44 save_binary_logs
vim /etc/my.cnf
[mysqld]
server-id = 1
log-bin=master-bin
log-slave-updates=true
relay_log_purge=0
systemctl restart mariadb
从Master(192.168.200.11):
vim /etc/my.cnf
[mysqld]
server-id=2
log-bin=master-bin
log-slave-updates=true
relay_log_purge=0
systemctl restart mariadb
slave1(192.168.200.12):
vim /etc/my.cnf
[mysqld]
server-id=3
log-bin=mysql-bin
relay-log=slave-relay-bin
log-slave-updates=true
relay_log_purge=0
systemctl restart mariadb
slave2(192.168.200.13):
vim /etc/my.cnf
[mysqld]
server-id=4
log-bin=mysql-bin
relay-log=slave-relay-bin
log-slave-updates=true
relay_log_purge=0
systemctl restart mariadb
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
+-------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-------------------+----------+--------------+------------------+
| master-bin.000001 | 474 | | |
+-------------------+----------+--------------+------------------+
1 row in set (0.00 sec)
Query OK, 0 rows affected, 1 warning (0.00 sec)
-> master_host='192.168.200.10',
-> master_user='repl',
-> master_password='123456',
-> master_log_file='master-bin.000001',
-> master_log_pos=474;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.200.10
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: master-bin.000001
Read_Master_Log_Pos: 474
Relay_Log_File: mariadb-relay-bin.000002
Relay_Log_Pos: 530
Relay_Master_Log_File: master-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Query OK, 0 rows affected, 1 warning (0.00 sec)
-> master_host='192.168.200.10',
-> master_user='repl',
-> master_password='123456',
-> master_log_file='master-bin.000001',
-> master_log_pos=474;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.200.10
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: master-bin.000001
Read_Master_Log_Pos: 474
Relay_Log_File: mariadb-relay-bin.000002
Relay_Log_Pos: 530
Relay_Master_Log_File: master-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
slave2
Query OK, 0 rows affected, 1 warning (0.00 sec)
-> master_host='192.168.200.10',
-> master_user='repl',
-> master_password='123456',
-> master_log_file='master-bin.000001',
-> master_log_pos=474;
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.200.10
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: master-bin.000001
Read_Master_Log_Pos: 474
Relay_Log_File: mariadb-relay-bin.000002
Relay_Log_Pos: 530
Relay_Master_Log_File: master-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
[root@server05 ~]# cp mha4mysql-manager-0.56/samples/conf/app1.cnf /etc/masterha/
5.检查MHA ssh 通信状态
[root@server05 ~]# masterha_check_ssh --conf=/etc/masterha/app1.cnf
Wed Oct 23 14:21:54 2019 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Wed Oct 23 14:21:54 2019 - [info] Reading application default configurations from /etc/masterha/app1.cnf..
Wed Oct 23 14:21:54 2019 - [info] Reading server configurations from /etc/masterha/app1.cnf..
Wed Oct 23 14:21:54 2019 - [info] Starting SSH connection tests..
Wed Oct 23 14:22:06 2019 - [debug]
Wed Oct 23 14:21:57 2019 - [debug] Connecting via SSH from root@server04(192.168.200.13:22) to root@server01(192.168.200.10:22)..
Wed Oct 23 14:21:59 2019 - [debug] ok.
Wed Oct 23 14:21:59 2019 - [debug] Connecting via SSH from root@server04(192.168.200.13:22) to root@server02(192.168.200.11:22)..
Wed Oct 23 14:22:01 2019 - [debug] ok.
Wed Oct 23 14:22:01 2019 - [debug] Connecting via SSH from root@server04(192.168.200.13:22) to root@server03(192.168.200.12:22)..
Wed Oct 23 14:22:05 2019 - [debug] ok.
Wed Oct 23 14:22:06 2019 - [debug]
Wed Oct 23 14:21:55 2019 - [debug] Connecting via SSH from root@server01(192.168.200.10:22) to root@server02(192.168.200.11:22)..
Wed Oct 23 14:21:57 2019 - [debug] ok.
Wed Oct 23 14:21:57 2019 - [debug] Connecting via SSH from root@server01(192.168.200.10:22) to root@server03(192.168.200.12:22)..
Wed Oct 23 14:22:04 2019 - [debug] ok.
Wed Oct 23 14:22:04 2019 - [debug] Connecting via SSH from root@server01(192.168.200.10:22) to root@server04(192.168.200.13:22)..
Wed Oct 23 14:22:05 2019 - [debug] ok.
Wed Oct 23 14:22:08 2019 - [debug]
Wed Oct 23 14:21:56 2019 - [debug] Connecting via SSH from root@server03(192.168.200.12:22) to root@server01(192.168.200.10:22)..
Wed Oct 23 14:22:01 2019 - [debug] ok.
Wed Oct 23 14:22:01 2019 - [debug] Connecting via SSH from root@server03(192.168.200.12:22) to root@server02(192.168.200.11:22)..
Wed Oct 23 14:22:06 2019 - [debug] ok.
Wed Oct 23 14:22:06 2019 - [debug] Connecting via SSH from root@server03(192.168.200.12:22) to root@server04(192.168.200.13:22)..
Wed Oct 23 14:22:08 2019 - [debug] ok.
Wed Oct 23 14:22:08 2019 - [debug]
Wed Oct 23 14:21:55 2019 - [debug] Connecting via SSH from root@server02(192.168.200.11:22) to root@server01(192.168.200.10:22)..
Wed Oct 23 14:21:58 2019 - [debug] ok.
Wed Oct 23 14:21:58 2019 - [debug] Connecting via SSH from root@server02(192.168.200.11:22) to root@server03(192.168.200.12:22)..
Wed Oct 23 14:22:05 2019 - [debug] ok.
Wed Oct 23 14:22:05 2019 - [debug] Connecting via SSH from root@server02(192.168.200.11:22) to root@server04(192.168.200.13:22)..
Wed Oct 23 14:22:07 2019 - [debug] ok.
Wed Oct 23 14:22:08 2019 - [info] All SSH connection tests passed successfully.
6.给从服务器创建主从复制用户
从master,slave1,slave2,都要做相同的配置
Query OK, 0 rows affected (0.39 sec)
Query OK, 0 rows affected (0.11 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.11 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Query OK, 0 rows affected (0.00 sec)
Wed Oct 23 14:41:32 2019 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Wed Oct 23 14:41:32 2019 - [info] Reading application default configurations from /etc/masterha/app1.cnf..
Wed Oct 23 14:41:32 2019 - [info] Reading server configurations from /etc/masterha/app1.cnf..
Wed Oct 23 14:41:32 2019 - [info] MHA::MasterMonitor version 0.56.
Wed Oct 23 14:41:33 2019 - [info] Dead Servers:
Wed Oct 23 14:41:33 2019 - [info] Alive Servers:
Wed Oct 23 14:41:33 2019 - [info] server01(192.168.200.10:3306)
Wed Oct 23 14:41:33 2019 - [info] server02(192.168.200.11:3306)
Wed Oct 23 14:41:33 2019 - [info] server03(192.168.200.12:3306)
Wed Oct 23 14:41:33 2019 - [info] server04(192.168.200.13:3306)
Wed Oct 23 14:41:33 2019 - [info] Alive Slaves:
Wed Oct 23 14:41:33 2019 - [info] server02(192.168.200.11:3306) Version=5.5.64-MariaDB (oldest major version between slaves) log-bin:enabled
Wed Oct 23 14:41:33 2019 - [info] Replicating from 192.168.200.10(192.168.200.10:3306)
Wed Oct 23 14:41:33 2019 - [info] Primary candidate for the new Master (candidate_master is set)
Wed Oct 23 14:41:33 2019 - [info] server03(192.168.200.12:3306) Version=5.5.64-MariaDB (oldest major version between slaves) log-bin:enabled
Wed Oct 23 14:41:33 2019 - [info] Replicating from 192.168.200.10(192.168.200.10:3306)
Wed Oct 23 14:41:33 2019 - [info] server04(192.168.200.13:3306) Version=5.5.64-MariaDB (oldest major version between slaves) log-bin:enabled
Wed Oct 23 14:41:33 2019 - [info] Replicating from 192.168.200.10(192.168.200.10:3306)
Wed Oct 23 14:41:33 2019 - [info] Current Alive Master: server01(192.168.200.10:3306)
Wed Oct 23 14:41:33 2019 - [info] Checking slave configurations..
Wed Oct 23 14:41:33 2019 - [info] read_only=1 is not set on slave server02(192.168.200.11:3306).
Wed Oct 23 14:41:33 2019 - [info] read_only=1 is not set on slave server03(192.168.200.12:3306).
Wed Oct 23 14:41:33 2019 - [info] read_only=1 is not set on slave server04(192.168.200.13:3306).
Wed Oct 23 14:41:33 2019 - [info] Checking replication filtering settings..
Wed Oct 23 14:41:33 2019 - [info] binlog_do_db= , binlog_ignore_db=
Wed Oct 23 14:41:33 2019 - [info] Replication filtering check ok.
Wed Oct 23 14:41:33 2019 - [info] Starting SSH connection tests..
Wed Oct 23 14:41:39 2019 - [info] All SSH connection tests passed successfully.
Wed Oct 23 14:41:39 2019 - [info] Checking MHA Node version..
Wed Oct 23 14:41:41 2019 - [info] Version check ok.
Wed Oct 23 14:41:41 2019 - [info] Checking SSH publickey authentication settings on the current master..
Wed Oct 23 14:41:41 2019 - [info] HealthCheck: SSH to server01 is reachable.
Wed Oct 23 14:41:42 2019 - [info] Master MHA Node version is 0.56.
Wed Oct 23 14:41:42 2019 - [info] Checking recovery script configurations on the current master..
Wed Oct 23 14:41:42 2019 - [info] Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/var/lib/mysql --output_file=/tmp/save_binary_logs_test --manager_version=0.56 --start_file=master-bin.000001
Wed Oct 23 14:41:42 2019 - [info] Connecting to root@server01(server01)..
Creating /tmp if not exists.. ok.
Checking output directory is accessible or not..
ok.
Binlog found at /var/lib/mysql, up to master-bin.000001
Wed Oct 23 14:41:42 2019 - [info] Master setting check done.
Wed Oct 23 14:41:42 2019 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Wed Oct 23 14:41:42 2019 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=server02 --slave_ip=192.168.200.11 --slave_port=3306 --workdir=/tmp --target_version=5.5.64-MariaDB --manager_version=0.56 --relay_log_info=/var/lib/mysql/relay-log.info --relay_dir=/var/lib/mysql/ --slave_pass=xxx
Wed Oct 23 14:41:42 2019 - [info] Connecting to root@192.168.200.11(server02:22)..
Checking slave recovery environment settings..
Opening /var/lib/mysql/relay-log.info ... ok.
Relay log found at /var/lib/mysql, up to mariadb-relay-bin.000002
Temporary relay log file is /var/lib/mysql/mariadb-relay-bin.000002
Testing mysql connection and privileges.. done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Wed Oct 23 14:41:43 2019 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=server03 --slave_ip=192.168.200.12 --slave_port=3306 --workdir=/tmp --target_version=5.5.64-MariaDB --manager_version=0.56 --relay_log_info=/var/lib/mysql/relay-log.info --relay_dir=/var/lib/mysql/ --slave_pass=xxx
Wed Oct 23 14:41:43 2019 - [info] Connecting to root@192.168.200.12(server03:22)..
Checking slave recovery environment settings..
Opening /var/lib/mysql/relay-log.info ... ok.
Relay log found at /var/lib/mysql, up to slave-relay-bin.000002
Temporary relay log file is /var/lib/mysql/slave-relay-bin.000002
Testing mysql connection and privileges.. done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Wed Oct 23 14:41:44 2019 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=server04 --slave_ip=192.168.200.13 --slave_port=3306 --workdir=/tmp --target_version=5.5.64-MariaDB --manager_version=0.56 --relay_log_info=/var/lib/mysql/relay-log.info --relay_dir=/var/lib/mysql/ --slave_pass=xxx
Wed Oct 23 14:41:44 2019 - [info] Connecting to root@192.168.200.13(server04:22)..
Checking slave recovery environment settings..
Opening /var/lib/mysql/relay-log.info ... ok.
Relay log found at /var/lib/mysql, up to slave-relay-bin.000002
Temporary relay log file is /var/lib/mysql/slave-relay-bin.000002
Testing mysql connection and privileges.. done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Wed Oct 23 14:41:45 2019 - [info] Slaves settings check done.
Wed Oct 23 14:41:45 2019 - [info]
server01 (current master)
+--server02
+--server03
+--server04
Wed Oct 23 14:41:45 2019 - [info] ok.
Wed Oct 23 14:41:45 2019 - [info] Checking replication health on server03..
Wed Oct 23 14:41:45 2019 - [info] ok.
Wed Oct 23 14:41:45 2019 - [info] Checking replication health on server04..
Wed Oct 23 14:41:45 2019 - [info] ok.
Wed Oct 23 14:41:45 2019 - [info] Checking master_ip_failover_script status:
Wed Oct 23 14:41:45 2019 - [info] /usr/local/bin/master_ip_failover --command=status --ssh_user=root --orig_master_host=server01 --orig_master_ip=192.168.200.10 --orig_master_port=3306
IN SCRIPT TEST====/sbin/ifconfig ens32:1 down==/sbin/ifconfig ens32:1 192.168.200.100===
Wed Oct 23 14:41:46 2019 - [info] OK.
Wed Oct 23 14:41:46 2019 - [warning] shutdown_script is not defined.
Wed Oct 23 14:41:46 2019 - [info] Got exit code 0 (Not master dead).
app1 is stopped(2:NOT_RUNNING).
[1] 62367
app1 (pid:62367) is running(0:PING_OK), master:server01
Wed Oct 23 15:02:57 2019 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Wed Oct 23 15:02:57 2019 - [info] Reading application default configurations from /etc/masterha/app1.cnf..
Wed Oct 23 15:02:57 2019 - [info] Reading server configurations from /etc/masterha/app1.cnf..
Wed Oct 23 15:02:57 2019 - [info] MHA::MasterMonitor version 0.56.
Wed Oct 23 15:02:58 2019 - [info] Dead Servers:
Wed Oct 23 15:02:58 2019 - [info] Alive Servers:
Wed Oct 23 15:02:58 2019 - [info] server01(192.168.200.10:3306)
Wed Oct 23 15:02:58 2019 - [info] server02(192.168.200.11:3306)
Wed Oct 23 15:02:58 2019 - [info] server03(192.168.200.12:3306)
Wed Oct 23 15:02:58 2019 - [info] server04(192.168.200.13:3306)
Wed Oct 23 15:02:58 2019 - [info] Alive Slaves:
Wed Oct 23 15:02:58 2019 - [info] server02(192.168.200.11:3306) Version=5.5.64-MariaDB (oldest major version between slaves) log-bin:enabled
Wed Oct 23 15:02:58 2019 - [info] Replicating from 192.168.200.10(192.168.200.10:3306)
Wed Oct 23 15:02:58 2019 - [info] Primary candidate for the new Master (candidate_master is set)
Wed Oct 23 15:02:58 2019 - [info] server03(192.168.200.12:3306) Version=5.5.64-MariaDB (oldest major version between slaves) log-bin:enabled
Wed Oct 23 15:02:58 2019 - [info] Replicating from 192.168.200.10(192.168.200.10:3306)
Wed Oct 23 15:02:58 2019 - [info] server04(192.168.200.13:3306) Version=5.5.64-MariaDB (oldest major version between slaves) log-bin:enabled
Wed Oct 23 15:02:58 2019 - [info] Replicating from 192.168.200.10(192.168.200.10:3306)
Wed Oct 23 15:02:58 2019 - [info] Current Alive Master: server01(192.168.200.10:3306)
Wed Oct 23 15:02:58 2019 - [info] Checking slave configurations..
Wed Oct 23 15:02:58 2019 - [info] read_only=1 is not set on slave server02(192.168.200.11:3306).
Wed Oct 23 15:02:58 2019 - [info] read_only=1 is not set on slave server03(192.168.200.12:3306).
Wed Oct 23 15:02:58 2019 - [info] read_only=1 is not set on slave server04(192.168.200.13:3306).
Wed Oct 23 15:02:58 2019 - [info] Checking replication filtering settings..
Wed Oct 23 15:02:58 2019 - [info] binlog_do_db= , binlog_ignore_db=
Wed Oct 23 15:02:58 2019 - [info] Replication filtering check ok.
Wed Oct 23 15:02:58 2019 - [info] Starting SSH connection tests..
Wed Oct 23 15:03:05 2019 - [info] All SSH connection tests passed successfully.
Wed Oct 23 15:03:05 2019 - [info] Checking MHA Node version..
Wed Oct 23 15:03:07 2019 - [info] Version check ok.
Wed Oct 23 15:03:07 2019 - [info] Checking SSH publickey authentication settings on the current master..
Wed Oct 23 15:03:07 2019 - [info] HealthCheck: SSH to server01 is reachable.
Wed Oct 23 15:03:08 2019 - [info] Master MHA Node version is 0.56.
Wed Oct 23 15:03:08 2019 - [info] Checking recovery script configurations on the current master..
Wed Oct 23 15:03:08 2019 - [info] Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/var/lib/mysql --output_file=/tmp/save_binary_logs_test --manager_version=0.56 --start_file=master-bin.000001
Wed Oct 23 15:03:08 2019 - [info] Connecting to root@server01(server01)..
Creating /tmp if not exists.. ok.
Checking output directory is accessible or not..
ok.
Binlog found at /var/lib/mysql, up to master-bin.000001
Wed Oct 23 15:03:08 2019 - [info] Master setting check done.
Wed Oct 23 15:03:08 2019 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Wed Oct 23 15:03:08 2019 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=server02 --slave_ip=192.168.200.11 --slave_port=3306 --workdir=/tmp --target_version=5.5.64-MariaDB --manager_version=0.56 --relay_log_info=/var/lib/mysql/relay-log.info --relay_dir=/var/lib/mysql/ --slave_pass=xxx
Wed Oct 23 15:03:08 2019 - [info] Connecting to root@192.168.200.11(server02:22)..
Checking slave recovery environment settings..
Opening /var/lib/mysql/relay-log.info ... ok.
Relay log found at /var/lib/mysql, up to mariadb-relay-bin.000002
Temporary relay log file is /var/lib/mysql/mariadb-relay-bin.000002
Testing mysql connection and privileges.. done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Wed Oct 23 15:03:09 2019 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=server03 --slave_ip=192.168.200.12 --slave_port=3306 --workdir=/tmp --target_version=5.5.64-MariaDB --manager_version=0.56 --relay_log_info=/var/lib/mysql/relay-log.info --relay_dir=/var/lib/mysql/ --slave_pass=xxx
Wed Oct 23 15:03:09 2019 - [info] Connecting to root@192.168.200.12(server03:22)..
Checking slave recovery environment settings..
Opening /var/lib/mysql/relay-log.info ... ok.
Relay log found at /var/lib/mysql, up to slave-relay-bin.000002
Temporary relay log file is /var/lib/mysql/slave-relay-bin.000002
Testing mysql connection and privileges.. done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Wed Oct 23 15:03:10 2019 - [info] Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=server04 --slave_ip=192.168.200.13 --slave_port=3306 --workdir=/tmp --target_version=5.5.64-MariaDB --manager_version=0.56 --relay_log_info=/var/lib/mysql/relay-log.info --relay_dir=/var/lib/mysql/ --slave_pass=xxx
Wed Oct 23 15:03:10 2019 - [info] Connecting to root@192.168.200.13(server04:22)..
Checking slave recovery environment settings..
Opening /var/lib/mysql/relay-log.info ... ok.
Relay log found at /var/lib/mysql, up to slave-relay-bin.000002
Temporary relay log file is /var/lib/mysql/slave-relay-bin.000002
Testing mysql connection and privileges.. done.
Testing mysqlbinlog output.. done.
Cleaning up test file(s).. done.
Wed Oct 23 15:03:10 2019 - [info] Slaves settings check done.
Wed Oct 23 15:03:10 2019 - [info]
server01 (current master)
+--server02
+--server03
+--server04
Wed Oct 23 15:03:10 2019 - [info] /usr/local/bin/master_ip_failover --command=status --ssh_user=root --orig_master_host=server01 --orig_master_ip=192.168.200.10 --orig_master_port=3306
IN SCRIPT TEST====/sbin/ifconfig ens32:1 down==/sbin/ifconfig ens32:1 192.168.200.100===
Wed Oct 23 15:03:10 2019 - [info] OK.
Wed Oct 23 15:03:10 2019 - [warning] shutdown_script is not defined.
Wed Oct 23 15:03:10 2019 - [info] Set master ping interval 1 seconds.
Wed Oct 23 15:03:10 2019 - [warning] secondary_check_script is not defined. It is highly recommended setting it to check master reachability from two or more routes.
Wed Oct 23 15:03:10 2019 - [info] Starting ping health check on server01(192.168.200.10:3306)..
Wed Oct 23 15:03:11 2019 - [info] Ping(SELECT) succeeded, waiting until MySQL doesn't respond.
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:95:d3:13 brd ff:ff:ff:ff:ff:ff
inet 192.168.200.10/24 brd 192.168.200.255 scope global noprefixroute ens32
valid_lft forever preferred_lft forever
inet 192.168.200.100/24 brd 192.168.200.255 scope global secondary ens32:1
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.200.10
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: master-bin.000001
Read_Master_Log_Pos: 1067
Relay_Log_File: slave-relay-bin.000002
Relay_Log_Pos: 1123
Relay_Master_Log_File: master-bin.000001
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:63:40:3a brd ff:ff:ff:ff:ff:ff
inet 192.168.200.11/24 brd 192.168.200.255 scope global noprefixroute ens32
valid_lft forever preferred_lft forever
inet 192.168.200.100/24 brd 192.168.200.255 scope global secondary ens32:1
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.200.11
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: master-bin.000003
Read_Master_Log_Pos: 1798
Relay_Log_File: slave-relay-bin.000002
Relay_Log_Pos: 530
Relay_Master_Log_File: master-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
[server default]
manager_log=/var/log/masterha/app1/manager.log
manager_workdir=/var/log/masterha/app1
master_binlog_dir=/var/lib/mysql
master_ip_failover_script=/usr/local/bin/master_ip_failover
password=123456
ping_interval=1
remote_workdir=/tmp
repl_password=123456
repl_user=repl
user=root
candidate_master=1
check_repl_delay=0
hostname=server02
port=3306
hostname=server03
port=3306
hostname=server04
port=3306
+-------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+-------------------+----------+--------------+------------------+
| master-bin.000004 | 1304 | | |
+-------------------+----------+--------------+------------------+
-----------------------------------忽略部分信息-----------------------------------
Thu Aug 31 22:20:30 2017 - [info] Alive Servers:
Thu Aug 31 22:20:30 2017 - [info] server01(192.168.200.10:3306)
Thu Aug 31 22:20:30 2017 - [info] server02(192.168.200.11:3306)
Thu Aug 31 22:20:30 2017 - [info] server03(192.168.200.12:3306)
Thu Aug 31 22:20:30 2017 - [info] server04(192.168.200.13:3306)
-----------------------------------忽略部分信息-----------------------------------
server02 (current master)
+--server01
+--server03
+--server04
-----------------------------------忽略部分信息-----------------------------------
MySQL Replication Health is OK.
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
inet 192.168.200.10/24 brd 192.168.200.255 scope global noprefixroute ens32
inet 192.168.200.100/24 brd 192.168.200.255 scope global secondary ens32:1
inet6 fe80::ae9d:ac2d:3eda:3e1/64 scope link tentative noprefixroute dadfailed
inet6 fe80::7f75:ddef:450b:883b/64 scope link noprefixroute
inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
Query OK, 0 rows affected, 1 warning (0.00 sec)
Query OK, 0 rows affected (0.01 sec)
Query OK, 0 rows affected (0.00 sec)
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.200.10
Master_User: repl
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: master-bin.000007
Read_Master_Log_Pos: 102168
Relay_Log_File: mariadb-relay-bin.000008
Relay_Log_Pos: 613
Relay_Master_Log_File: master-bin.000007
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Wed Oct 23 17:13:04 2019 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Wed Oct 23 17:13:05 2019 - [info] server01(192.168.200.10:3306)
Wed Oct 23 17:13:05 2019 - [info] server02(192.168.200.11:3306)
Wed Oct 23 17:13:05 2019 - [info] server03(192.168.200.12:3306)
Wed Oct 23 17:13:05 2019 - [info] server04(192.168.200.13:3306)
Wed Oct 23 17:13:14 2019 - [info] Slaves settings check done.
Wed Oct 23 17:13:14 2019 - [info]
server01 (current master)
+--server02
+--server03
+--server04
Wed Oct 23 17:13:14 2019 - [info] ok.
Wed Oct 23 17:13:14 2019 - [info] Checking replication health on server03..
Wed Oct 23 17:13:14 2019 - [info] ok.
Wed Oct 23 17:13:14 2019 - [info] Checking replication health on server04..
Wed Oct 23 17:13:14 2019 - [info] ok.
Wed Oct 23 17:13:14 2019 - [info] Checking master_ip_failover_script status:
Wed Oct 23 17:13:14 2019 - [info] /usr/local/bin/master_ip_failover --command=status --ssh_user=root --orig_master_host=server01 --orig_master_ip=192.168.200.10 --orig_master_port=3306
IN SCRIPT TEST====/sbin/ifconfig ens32:1 down==/sbin/ifconfig ens32:1 192.168.200.100===
Wed Oct 23 17:13:14 2019 - [info] OK.
Wed Oct 23 17:13:14 2019 - [warning] shutdown_script is not defined.
Wed Oct 23 17:13:14 2019 - [info] Got exit code 0 (Not master dead).