签到成功

知道了

CNDBA社区CNDBA社区

myql8 MHA安装

2019-11-08 16:58 4464 0 原创 mysql
作者: shmily

架构规划
| ip | 集群中作用 | 主机名 | server_id |
| 172.19.4.50 | master/mha node | mysql-master-4-50 | 9000 |
| 172.19.4.51 | slave/mha manager| mysql-master-4-51 | 9001 |
| 172.19.4.52 | slave/mha node | mysql-master-4-52 | 9002 |
vip:172.19.4.53http://www.cndba.cn/asker/article/3786

版本:
服务器:centos 7.5
mysql: 8.0.12
mha: 0.56http://www.cndba.cn/asker/article/3786

http://www.cndba.cn/asker/article/3786

实施部署
一 修改主机名
vim /etc/hostshttp://www.cndba.cn/asker/article/3786

172.19.4.50 mysql-master-4-50
172.19.4.51 mysql-manager-4-51
172.19.4.52 mysql-slave-4-52

二安装mysql(略,参考mysql8 安装文档)http://www.cndba.cn/asker/article/3786

三 配置主从(略,参考mysql8.0.12 主从搭建)http://www.cndba.cn/asker/article/3786http://www.cndba.cn/asker/article/3786

四 配置ssh等效
各节点执行

[root@localhost software]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
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:
SHA256:h6GQNUecVoEQfGiuvH8FzJqAdCtSOduJ7u87Rk9Gyvk root@localhost.localdomain
The key's randomart image is:
+---[RSA 2048]----+
|   . .=*o+o.     |
|  = .o+o*        |
| o Bo= =.        |
|. = =.o.+o       |
| o + *.oS..      |
|  . B =  ..      |
| . . *   .       |
|  . + E .        |
|   +++..         |
+----[SHA256]-----+

在master节点执行

ssh -p 11017 mysql-master-4-50 cat ~/.ssh/id_rsa.pub>>~/.ssh/authorized_keys
ssh -p 11017 mysql-manager-4-51 cat ~/.ssh/id_rsa.pub>>~/.ssh/authorized_keys
ssh -p 11017 mysql-slave-5-52 cat ~/.ssh/id_rsa.pub>>~/.ssh/authorized_keys
scp -P 11017 ~/.ssh/authorized_keys  mysql-manager-4-51:~/.ssh/
scp -P 11017 ~/.ssh/authorized_keys  mysql-slave-4-52:~/.ssh/

在各节点执行以下指令,检查ssh等效性

ssh -p 11017 mysql-master-4-50 date
ssh -p 11017 mysql-manager-4-51 date
ssh -p 11017 mysql-slave-4-52 date

所需软件:
mha4mysql-manager-0.56-0.el6.noarch.rpm
mha4mysql-node-0.56-0.el6.noarch.rpm
mha-helper-master.zip

创建mha目录

mkdir -p /appl/mysqlha

mha-node需要在集群所有节点安装
安装依赖包

yum install perl-DBD-MySQL
yum install perl-Log-Dispatch  
yum install perl-Params-Validate
yum install perl-TimeDate
yum install perl-Parallel-ForkManager
yum install MySQL-python
yum install perl-Config-Tiny
rpm -ivh mha4mysql-node-0.56-0.el6.noarch.rpm

安装 MHA Manager(manager节点)

rpm -ivh mha4mysql-manager-0.56-0.el6.noarch.rpm

所有主、从服务器安装:

unzip mha-helper-master.zip
mv mha-helper-master /usr/local/

修改manager配置文件
cd /usr/local/mha-helper-master/conf
vim manager.conf

[server default]
user                            = root
password                        = root001
ssh_user                        = root
ssh_options                     = '-i /root/.ssh/id_rsa'
ssh_port                        = 11017
repl_user                       = rep
repl_password                   = Dky78&cF
manager_workdir                 = /appl/mysqlha
manager_log                     = /appl/mysqlha/manager.log
remote_workdir                  = /appl/mysqlha
log_level                       = debug
master_ip_failover_script       = /usr/local/mha-helper-master/scripts/master_ip_failover
master_ip_online_change_script  = /usr/local/mha-helper-master/scripts/master_ip_online_change
report_script                   = /usr/local/mha-helper-master/scripts/failover_report
[server1]
hostname=172.19.4.50
port=3306
master_binlog_dir=/appl/mysql/data
candidate_master=1
check_repl_delay=0
[server2]
hostname=172.19.4.52
port=3306
master_binlog_dir=/appl/mysql/data
candidate_master=1
check_repl_delay=0
[server3]
hostname=172.19.4.51
master_binlog_dir=/appl/mysql/data
no_master=1
ignore_fail=1

vim global.confhttp://www.cndba.cn/asker/article/3786

[default]
requires_sudo       = yes
manage_vip          = yes
writer_vip_cidr     = 172.19.4.53/24
writer_vip          = 172.19.4.53
cluster_interface   = ens192
[172.19.4.50]
cluster_conf_path   = /usr/local/mha-helper-master/conf/manager.conf
[172.19.4.51]
cluster_conf_path   = /usr/local/mha-helper-master/conf/manager.conf
[172.19.4.52]
cluster_conf_path   = /usr/local/mha-helper-master/conf/manager.conf

修改脚本文件中配置文件路径
cd /usr/local/mha-helper-master/scripts/lib
vi mha_config_helper.py

CONFIG_PATH = "/usr/local/mha-helper-master/conf/global.conf"

cd /usr/local/mha-helper-master/support-files
vi mha_manager_daemon

sys.path.append("/usr/local/mha-helper-master/scripts/")

所有mysql主从服务器进行授权

CREATE USER 'root'@'172.%' identified with mysql_native_password by 'root001';
GRANT ALL PRIVILEGES ON *.* to 'root'@'172.%' WITH GRANT OPTION;
flush privileges;

Manager上进行ssh登陆检查
masterha_check_ssh —conf=/usr/local/mha-helper-master/conf/manager.confhttp://www.cndba.cn/asker/article/3786

Fri Nov  8 15:20:54 2019 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Fri Nov  8 15:20:54 2019 - [info] Reading application default configuration from /usr/local/mha-helper-master/conf/manager.conf..
Fri Nov  8 15:20:54 2019 - [info] Reading server configuration from /usr/local/mha-helper-master/conf/manager.conf..
Fri Nov  8 15:20:54 2019 - [info] Starting SSH connection tests..
Fri Nov  8 15:20:55 2019 - [debug]
Fri Nov  8 15:20:54 2019 - [debug]  Connecting via SSH from root@172.19.4.50(172.19.4.50:11017) to root@172.19.4.52(172.19.4.52:11017)..
Warning: Permanently added '[172.19.4.50]:11017' (ECDSA) to the list of known hosts.
Fri Nov  8 15:20:54 2019 - [debug]   ok.
Fri Nov  8 15:20:54 2019 - [debug]  Connecting via SSH from root@172.19.4.50(172.19.4.50:11017) to root@172.19.4.51(172.19.4.51:11017)..
Fri Nov  8 15:20:55 2019 - [debug]   ok.
Fri Nov  8 15:20:56 2019 - [debug]
Fri Nov  8 15:20:55 2019 - [debug]  Connecting via SSH from root@172.19.4.52(172.19.4.52:11017) to root@172.19.4.50(172.19.4.50:11017)..
Warning: Permanently added '[172.19.4.52]:11017' (ECDSA) to the list of known hosts.
Warning: Permanently added '[172.19.4.50]:11017' (ECDSA) to the list of known hosts.
Fri Nov  8 15:20:55 2019 - [debug]   ok.
Fri Nov  8 15:20:55 2019 - [debug]  Connecting via SSH from root@172.19.4.52(172.19.4.52:11017) to root@172.19.4.51(172.19.4.51:11017)..
Warning: Permanently added '[172.19.4.51]:11017' (ECDSA) to the list of known hosts.
Fri Nov  8 15:20:55 2019 - [debug]   ok.
Fri Nov  8 15:20:57 2019 - [debug]
Fri Nov  8 15:20:55 2019 - [debug]  Connecting via SSH from root@172.19.4.51(172.19.4.51:11017) to root@172.19.4.50(172.19.4.50:11017)..
Warning: Permanently added '[172.19.4.51]:11017' (ECDSA) to the list of known hosts.
Fri Nov  8 15:20:55 2019 - [debug]   ok.
Fri Nov  8 15:20:55 2019 - [debug]  Connecting via SSH from root@172.19.4.51(172.19.4.51:11017) to root@172.19.4.52(172.19.4.52:11017)..
Fri Nov  8 15:20:56 2019 - [debug]   ok.
Fri Nov  8 15:20:57 2019 - [info] All SSH connection tests passed successfully.

Manager上进行复制情况检查
masterha_check_repl —conf=/usr/local/mha-helper-master/conf/manager.conf

Fri Nov  8 15:44:46 2019 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Fri Nov  8 15:44:46 2019 - [info] Reading application default configuration from /usr/local/mha-helper-master/conf/manager.conf..
Fri Nov  8 15:44:46 2019 - [info] Reading server configuration from /usr/local/mha-helper-master/conf/manager.conf..
Fri Nov  8 15:44:46 2019 - [info] MHA::MasterMonitor version 0.56.
Fri Nov  8 15:44:46 2019 - [debug] Connecting to servers..
Fri Nov  8 15:44:47 2019 - [debug]  Connected to: 172.19.4.50(172.19.4.50:3306), user=root
Fri Nov  8 15:44:47 2019 - [debug]  Number of slave worker threads on host 172.19.4.50(172.19.4.50:3306): 0
Fri Nov  8 15:44:47 2019 - [debug]  Connected to: 172.19.4.52(172.19.4.52:3306), user=root
Fri Nov  8 15:44:47 2019 - [debug]  Number of slave worker threads on host 172.19.4.52(172.19.4.52:3306): 0
Fri Nov  8 15:44:47 2019 - [debug]  Connected to: 172.19.4.51(172.19.4.51:3306), user=root
Fri Nov  8 15:44:47 2019 - [debug]  Number of slave worker threads on host 172.19.4.51(172.19.4.51:3306): 0
Fri Nov  8 15:44:47 2019 - [debug]  Comparing MySQL versions..
Fri Nov  8 15:44:47 2019 - [debug]   Comparing MySQL versions done.
Fri Nov  8 15:44:47 2019 - [debug] Connecting to servers done.
Fri Nov  8 15:44:47 2019 - [info] GTID failover mode = 0
Fri Nov  8 15:44:47 2019 - [info] Dead Servers:
Fri Nov  8 15:44:47 2019 - [info] Alive Servers:
Fri Nov  8 15:44:47 2019 - [info]   172.19.4.50(172.19.4.50:3306)
Fri Nov  8 15:44:47 2019 - [info]   172.19.4.52(172.19.4.52:3306)
Fri Nov  8 15:44:47 2019 - [info]   172.19.4.51(172.19.4.51:3306)
Fri Nov  8 15:44:47 2019 - [info] Alive Slaves:
Fri Nov  8 15:44:47 2019 - [info]   172.19.4.52(172.19.4.52:3306)  Version=8.0.12 (oldest major version between slaves) log-bin:enabled
Fri Nov  8 15:44:47 2019 - [debug]    Relay log info repository: TABLE
Fri Nov  8 15:44:47 2019 - [info]     Replicating from 172.19.4.50(172.19.4.50:3306)
Fri Nov  8 15:44:47 2019 - [info]     Primary candidate for the new Master (candidate_master is set)
Fri Nov  8 15:44:47 2019 - [info]   172.19.4.51(172.19.4.51:3306)  Version=8.0.12 (oldest major version between slaves) log-bin:enabled
Fri Nov  8 15:44:47 2019 - [debug]    Relay log info repository: TABLE
Fri Nov  8 15:44:47 2019 - [info]     Replicating from 172.19.4.50(172.19.4.50:3306)
Fri Nov  8 15:44:47 2019 - [info]     Not candidate for the new Master (no_master is set)
Fri Nov  8 15:44:47 2019 - [info] Current Alive Master: 172.19.4.50(172.19.4.50:3306)
Fri Nov  8 15:44:47 2019 - [info] Checking slave configurations..
Fri Nov  8 15:44:47 2019 - [info] Checking replication filtering settings..
Fri Nov  8 15:44:47 2019 - [info]  binlog_do_db= traindb, binlog_ignore_db= information_schema,mysql,performance_schema,sys
Fri Nov  8 15:44:47 2019 - [info]  Replication filtering check ok.
Fri Nov  8 15:44:47 2019 - [info] GTID (with auto-pos) is not supported
Fri Nov  8 15:44:47 2019 - [info] Starting SSH connection tests..
Fri Nov  8 15:44:48 2019 - [debug]
Fri Nov  8 15:44:47 2019 - [debug]  Connecting via SSH from root@172.19.4.50(172.19.4.50:11017) to root@172.19.4.52(172.19.4.52:11017)..
Fri Nov  8 15:44:47 2019 - [debug]   ok.
Fri Nov  8 15:44:47 2019 - [debug]  Connecting via SSH from root@172.19.4.50(172.19.4.50:11017) to root@172.19.4.51(172.19.4.51:11017)..
Fri Nov  8 15:44:48 2019 - [debug]   ok.
Fri Nov  8 15:44:49 2019 - [debug]
Fri Nov  8 15:44:48 2019 - [debug]  Connecting via SSH from root@172.19.4.52(172.19.4.52:11017) to root@172.19.4.50(172.19.4.50:11017)..
Fri Nov  8 15:44:48 2019 - [debug]   ok.
Fri Nov  8 15:44:48 2019 - [debug]  Connecting via SSH from root@172.19.4.52(172.19.4.52:11017) to root@172.19.4.51(172.19.4.51:11017)..
Fri Nov  8 15:44:48 2019 - [debug]   ok.
Fri Nov  8 15:44:50 2019 - [debug]
Fri Nov  8 15:44:48 2019 - [debug]  Connecting via SSH from root@172.19.4.51(172.19.4.51:11017) to root@172.19.4.50(172.19.4.50:11017)..
Fri Nov  8 15:44:48 2019 - [debug]   ok.
Fri Nov  8 15:44:48 2019 - [debug]  Connecting via SSH from root@172.19.4.51(172.19.4.51:11017) to root@172.19.4.52(172.19.4.52:11017)..
Fri Nov  8 15:44:49 2019 - [debug]   ok.
Fri Nov  8 15:44:50 2019 - [info] All SSH connection tests passed successfully.
Fri Nov  8 15:44:50 2019 - [info] Checking MHA Node version..
Fri Nov  8 15:44:50 2019 - [info]  Version check ok.
Fri Nov  8 15:44:50 2019 - [info] Checking SSH publickey authentication settings on the current master..
Fri Nov  8 15:44:50 2019 - [debug] SSH connection test to 172.19.4.50, option -o StrictHostKeyChecking=no -o PasswordAuthentication=no -o BatchMode=yes -o ConnectTimeout=5 -i /root/.ssh/id_rsa, timeout 5
Fri Nov  8 15:44:50 2019 - [info] HealthCheck: SSH to 172.19.4.50 is reachable.
Fri Nov  8 15:44:50 2019 - [info] Master MHA Node version is 0.56.
Fri Nov  8 15:44:50 2019 - [info] Checking recovery script configurations on 172.19.4.50(172.19.4.50:3306)..
Fri Nov  8 15:44:50 2019 - [info]   Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/appl/mysql/data --output_file=/appl/mysqlha/save_binary_logs_test --manager_version=0.56 --start_file=mysql-bin-9000.000001 --debug  
Fri Nov  8 15:44:50 2019 - [info]   Connecting to root@172.19.4.50(172.19.4.50:11017)..
  Creating /appl/mysqlha if not exists..    ok.
  Checking output directory is accessible or not..
   ok.
  Binlog found at /appl/mysql/data, up to mysql-bin-9000.000001
Fri Nov  8 15:44:51 2019 - [info] Binlog setting check done.
Fri Nov  8 15:44:51 2019 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Fri Nov  8 15:44:51 2019 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=172.19.4.52 --slave_ip=172.19.4.52 --slave_port=3306 --workdir=/appl/mysqlha --target_version=8.0.12 --manager_version=0.56 --relay_dir=/appl/mysql/log --current_relay_log=mysql-relay-bin.000004  --debug  --ssh_options='-o ServerAliveInterval=60 -o ServerAliveCountMax=20 -o StrictHostKeyChecking=no -o ConnectionAttempts=5 -o PasswordAuthentication=no -o BatchMode=yes -i /root/.ssh/id_rsa'  --slave_pass=xxx
Fri Nov  8 15:44:51 2019 - [info]   Connecting to root@172.19.4.52(172.19.4.52:11017)..
  Checking slave recovery environment settings..
    Relay log found at /appl/mysql/log, up to mysql-relay-bin.000004
    Temporary relay log file is /appl/mysql/log/mysql-relay-bin.000004
    Testing mysql connection and privileges..mysql: [Warning] Using a password on the command line interface can be insecure.
done.
    Testing mysqlbinlog output.. done.
    Cleaning up test file(s).. done.
Fri Nov  8 15:44:51 2019 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=172.19.4.51 --slave_ip=172.19.4.51 --slave_port=3306 --workdir=/appl/mysqlha --target_version=8.0.12 --manager_version=0.56 --relay_dir=/appl/mysql/log --current_relay_log=mysql-relay-bin.000004  --debug  --ssh_options='-o ServerAliveInterval=60 -o ServerAliveCountMax=20 -o StrictHostKeyChecking=no -o ConnectionAttempts=5 -o PasswordAuthentication=no -o BatchMode=yes -i /root/.ssh/id_rsa'  --slave_pass=xxx
Fri Nov  8 15:44:51 2019 - [info]   Connecting to root@172.19.4.51(172.19.4.51:11017)..
  Checking slave recovery environment settings..
    Relay log found at /appl/mysql/log, up to mysql-relay-bin.000004
    Temporary relay log file is /appl/mysql/log/mysql-relay-bin.000004
    Testing mysql connection and privileges..mysql: [Warning] Using a password on the command line interface can be insecure.
done.
    Testing mysqlbinlog output.. done.
    Cleaning up test file(s).. done.
Fri Nov  8 15:44:52 2019 - [info] Slaves settings check done.
Fri Nov  8 15:44:52 2019 - [info]
172.19.4.50(172.19.4.50:3306) (current master)
+--172.19.4.52(172.19.4.52:3306)
+--172.19.4.51(172.19.4.51:3306)
Fri Nov  8 15:44:52 2019 - [info] Checking replication health on 172.19.4.52..
Fri Nov  8 15:44:52 2019 - [info]  ok.
Fri Nov  8 15:44:52 2019 - [info] Checking replication health on 172.19.4.51..
Fri Nov  8 15:44:52 2019 - [info]  ok.
Fri Nov  8 15:44:52 2019 - [info] Checking master_ip_failover_script status:
Fri Nov  8 15:44:52 2019 - [info]   /usr/local/mha-helper-master/scripts/master_ip_failover --command=status --ssh_user=root --orig_master_host=172.19.4.50 --orig_master_ip=172.19.4.50 --orig_master_port=3306  --orig_master_ssh_port=11017 --ssh_options='-o ServerAliveInterval=60 -o ServerAliveCountMax=20 -o StrictHostKeyChecking=no -o ConnectionAttempts=5 -o PasswordAuthentication=no -o BatchMode=yes -i /root/.ssh/id_rsa'
[2019-11-8 15:44:52] Doing sanity checks
Fri Nov  8 15:44:52 2019 - [info]  OK.
Fri Nov  8 15:44:52 2019 - [warning] shutdown_script is not defined.
Fri Nov  8 15:44:52 2019 - [debug]  Disconnected from 172.19.4.50(172.19.4.50:3306)
Fri Nov  8 15:44:52 2019 - [debug]  Disconnected from 172.19.4.52(172.19.4.52:3306)
Fri Nov  8 15:44:52 2019 - [debug]  Disconnected from 172.19.4.51(172.19.4.51:3306)
Fri Nov  8 15:44:52 2019 - [info] Got exit code 0 (Not master dead).
MySQL Replication Health is OK.

第一次运行,在主库上配置VIP

/sbin/ip addr add 172.19.4.53/24 dev ens192

启动MHA进程

cd /usr/local/mha-helper-master/support-files
./mha_manager_daemon --conf= /usr/local/mha-helper-master/conf/manager.conf start

检查集群状态

[root@localhost support-files]# ./mha_manager_daemon --conf=/usr/local/mha-helper-master/conf/manager.conf status
manager (pid:16504) is running(0:PING_OK), master:172.19.4.50

报错统计
报错一http://www.cndba.cn/asker/article/3786

[root@localhost data]# yum install perl-Log-Dispatch
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
No package perl-Log-Dispatch available.
Error: Nothing to do

解决方法 先安装epel

yum install epel*

在安装perl-Log-Dispatch,perl-Parallel-ForkManager,不推荐下载rpm包安装
rpm包搜索下载网址
http://rpm.pbone.net/,尝试了下找对应的rpm包安装,一路走下去找了10几个依赖包还没找全。。。

报错2:复制情况检查

Fri Nov  8 15:21:25 2019 - [info] Binlog setting check done.
Fri Nov  8 15:21:25 2019 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Fri Nov  8 15:21:25 2019 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=172.19.4.52 --slave_ip=172.19.4.52 --slave_port=3306 --workdir=/appl/mysqlha --target_version=8.0.12 --manager_version=0.56 --relay_dir=/appl/mysql/log --current_relay_log=mysql-relay-bin.000002  --debug  --ssh_options='-o ServerAliveInterval=60 -o ServerAliveCountMax=20 -o StrictHostKeyChecking=no -o ConnectionAttempts=5 -o PasswordAuthentication=no -o BatchMode=yes -i /root/.ssh/id_rsa'  --slave_pass=xxx
Fri Nov  8 15:21:25 2019 - [info]   Connecting to root@172.19.4.52(172.19.4.52:11017)..
Can't exec "mysqlbinlog": No such file or directory at /usr/share/perl5/vendor_perl/MHA/BinlogManager.pm line 106.
mysqlbinlog version command failed with rc 1:0, please verify PATH, LD_LIBRARY_PATH, and client options
at /usr/bin/apply_diff_relay_logs line 493.
Fri Nov  8 15:21:25 2019 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln205] Slaves settings check failed!
Fri Nov  8 15:21:25 2019 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln413] Slave configuration failed.
Fri Nov  8 15:21:25 2019 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations.  at /usr/bin/masterha_check_repl line 48.
Fri Nov  8 15:21:25 2019 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln523] Error happened on monitoring servers.
Fri Nov  8 15:21:25 2019 - [info] Got exit code 1 (Not master dead).
MySQL Replication Health is NOT OK!

解决:

[root@localhost lib]# type mysqlbinlog
mysqlbinlog is /appl/mysql/bin/mysqlbinlog
[root@localhost lib]# ln -s /appl/mysql/bin/mysqlbinlog /usr/bin/mysqlbinlog

报错3:复制情况检查

Fri Nov  8 15:31:42 2019 - [info]   Executing command: save_binary_logs --command=test --start_pos=4 --binlog_dir=/appl/mysql/data --output_file=/appl/mysqlha/save_binary_logs_test --manager_version=0.56 --start_file=mysql-bin-9000.000001 --debug  
Fri Nov  8 15:31:42 2019 - [info]   Connecting to root@172.19.4.50(172.19.4.50:11017)..
  Creating /appl/mysqlha if not exists..    ok.
  Checking output directory is accessible or not..
   ok.
  Binlog found at /appl/mysql/data, up to mysql-bin-9000.000001
Fri Nov  8 15:31:42 2019 - [info] Binlog setting check done.
Fri Nov  8 15:31:42 2019 - [info] Checking SSH publickey authentication and checking recovery script configurations on all alive slave servers..
Fri Nov  8 15:31:42 2019 - [info]   Executing command : apply_diff_relay_logs --command=test --slave_user='root' --slave_host=172.19.4.52 --slave_ip=172.19.4.52 --slave_port=3306 --workdir=/appl/mysqlha --target_version=8.0.12 --manager_version=0.56 --relay_dir=/appl/mysql/log --current_relay_log=mysql-relay-bin.000002  --debug  --ssh_options='-o ServerAliveInterval=60 -o ServerAliveCountMax=20 -o StrictHostKeyChecking=no -o ConnectionAttempts=5 -o PasswordAuthentication=no -o BatchMode=yes -i /root/.ssh/id_rsa'  --slave_pass=xxx
Fri Nov  8 15:31:42 2019 - [info]   Connecting to root@172.19.4.52(172.19.4.52:11017)..
Creating directory /appl/mysqlha.. done.
  Checking slave recovery environment settings..
    Relay log found at /appl/mysql/log, up to mysql-relay-bin.000002
    Temporary relay log file is /appl/mysql/log/mysql-relay-bin.000002
    Testing mysql connection and privileges..sh: mysql: command not found
mysql command failed with rc 127:0!
at /usr/bin/apply_diff_relay_logs line 375.
        main::check() called at /usr/bin/apply_diff_relay_logs line 497
        eval {...} called at /usr/bin/apply_diff_relay_logs line 475
        main::main() called at /usr/bin/apply_diff_relay_logs line 120
Fri Nov  8 15:31:42 2019 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln205] Slaves settings check failed!
Fri Nov  8 15:31:42 2019 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln413] Slave configuration failed.
Fri Nov  8 15:31:42 2019 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations.  at /usr/bin/masterha_check_repl line 48.
Fri Nov  8 15:31:42 2019 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln523] Error happened on monitoring servers.
Fri Nov  8 15:31:42 2019 - [info] Got exit code 1 (Not master dead).
MySQL Replication Health is NOT OK!

解决:

ln -s /appl/mysql/bin/mysql /usr/bin/mysql

版权声明:本文为博主原创文章,未经博主允许不得转载。

mysql8 MHA安装

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
shmily

shmily

关注
  • 22
    原创
  • 0
    翻译
  • 2
    转载
  • 11
    评论
  • 访问:142150次
  • 积分:141
  • 等级:初级会员
  • 排名:第23名
精华文章
    热门文章
      Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

      AI QQ群