MySQL 有关MHA搭建与切换的几个错误log汇总

1:masterha_check_repl 副本集方面报错  replicates is not defined in the configuration file!

具体信息如下:

# /usr/local/bin/masterha_check_repl --conf=/etc/mha/app1.cnf
Thu Nov 21 15:33:15 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Thu Nov 21 15:33:15 2018 - [info] Reading application default configuration from /etc/mha/app1.cnf..
Thu Nov 21 15:33:15 2018 - [info] Reading server configuration from /etc/mha/app1.cnf..
Thu Nov 21 15:33:15 2018 - [info] MHA::MasterMonitor version 0.56.
Thu Nov 21 15:33:16 2018- [error][/usr/local/share/perl5/MHA/ServerManager.pm, ln671] Master 179.179.19.179:3306 from which slave 179.179.19.180(179.179.19.180:3306) replicates is not defined in the configuration file!
Thu Nov 21 15:33:16 2018 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations. at /usr/local/share/perl5/MHA/MasterMonitor.pm line 326.
Thu Nov 21 15:33:16 2018 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln523] Error happened on monitoring servers.
Thu Nov 21 15:33:16 2018 - [info] Got exit code 1 (Not master dead).

MySQL Replication Health is NOT OK!

分析:MHA 漂移过后,我们知道配置信息中 主节点的信息就不在了,我们需要及时维护,否则/usr/local/bin/masterha_check_repl --conf=/etc/mha/XXX.cnf 检查副本集状态报错。

2. masterha_master_switch 在线切换方面 报错 We should not start online master switch when one of connections are running long updates on the current master

具体信息如下:

# /usr/local/bin/masterha_master_switch --master_state=alive --conf=/etc/mha/app1.cnf

It is better to execute FLUSH NO_WRITE_TO_BINLOG TABLES on the master before switching. Is it ok to execute on 179.179.19.184(179.179.19.184:3306)? (YES/no): y

Tue Nov 19 17:19:09 2018 - [info] Executing FLUSH NO_WRITE_TO_BINLOG TABLES. This may take long time..
Tue Nov 19 17:19:09 2018 - [info] ok.
Tue Nov 19 17:19:09 2018 - [info] Checking MHA is not monitoring or doing failover..
Tue Nov 19 17:19:09 2018 - [info] Checking replication health on 179.179.19.185..
Tue Nov 19 17:19:09 2018 - [info] ok.
Tue Nov 19 17:19:09 2018 - [error][/usr/local/share/perl5/MHA/MasterRotate.pm, ln161] We should not start online master switch when one of connections are running long updates on the current master(179.179.19.184(179.179.19.184:3306)). Currently 1 update thread(s) are running.
Details:
{'Time' => '12815','db' => undef,'Id' => '1','User' => 'event_scheduler','State' => 'Waiting on empty queue','Command' => 'Daemon','Info' => undef,'Host' => 'localhost'}
Tue Nov 19 17:19:09 2018 - [error][/usr/local/share/perl5/MHA/ManagerUtil.pm, ln177] Got ERROR: at /usr/local/bin/masterha_master_switch line 53.

分析:set global event_scheduler=off; 主从都要关闭

3. masterha_master_switch 在线切换方面 报错 Got Error: DBI .....failed: Access denied for user

# /usr/local/bin/masterha_master_switch --master_state=alive --conf=/etc/mha/app1.cnf

Starting master switch from 179.179.19.185(179.179.19:3306) to 179.179.19.184(179.179.19.184:3306)? (yes/NO): yes

Tue Nov 19 18:52:04 2018 - [info] Checking whether 179.179.19.184(179.179.19.184:3306) is ok for the new master..
Tue Nov 19 18:52:04 2018 - [info] ok.
Tue Nov 19 18:52:04 2018 - [info] ** Phase 1: Configuration Check Phase completed.
Tue Nov 19 18:52:04 2018 - [info]
Tue Nov 19 18:52:04 2018 - [info] * Phase 2: Rejecting updates Phase..
Tue Nov 19 18:52:04 2018 - [info]
Tue Nov 19 18:52:04 2018 - [info] Executing master ip online change script to disable write on the current master:
Tue Nov 19 18:52:04 2018 - [info]  /usr/local/bin/master_ip_online_change_appuanalysis --command=stop --orig_master_host=179.179.19.185 --orig_master_ip=179.179.19.185 --orig_master_port=3306--orig_master_user='weixinLX391P_xldbmha' --orig_master_password='weixinLX391P_xldbmha\)qlk' --new_master_host=179.179.19.184 --new_master_ip=179.179.19.184 --new_master_port=55988 --new_master_user='us_mha' --new_master_password='weixinLX391P_xldbmha\)qlk' --orig_master_ssh_user=root --new_master_ssh_user=root
Got Error: DBI connect(';host=179.179.19.184;port=3306;mysql_connect_timeout=4','weixinLX391P_xldbmha',...) failed: Access denied for user 'weixinLX391P_xldbmha'@'179.179.19.166' (using password: YES) at /usr/local/share/perl5/MHA/DBHelper.pm line 205.
 at /usr/local/bin/master_ip_online_change_app1 line 119.

Tue Nov 19 18:52:04 2018 - [error][/usr/local/share/perl5/MHA/ManagerUtil.pm, ln177] Got ERROR: at /usr/local/bin/masterha_master_switch line 53.

分析:账号密码有需要转移字符的。app1.cnf 文件中user账号相应的密码 password 不能有待转移的字符,例如本例中的')',但是 账号 repl_user 相应的密码repl_password 没有此限制。

4.如果使用的是xtrabackup,注意从节点会把event还原上去,可能会造成数据不一致,同步失败的问题。

如果主节点有event,需要手动关闭从节点的event。例如,主节点有归档删除数据的event,从节点需要关闭,否则报错。类似如下错误:

Could not execute Delete_rows event on table ????DB.*****table; Can't find record in '*****', Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND; the event's master log FIRST, end_log_pos XXXXXXX

5 .GTID 模式转换为传统模式后,MHA 机制下数据库主从检查报错。

检查的命令:

/usr/local/bin/masterha_check_repl --conf=/etc/mha/qqweixinordb.cnf

主要的报错信息

Can't exec "mysqlbinlog": No such file or directory at /usr/local/share/perl5/MHA/BinlogManager.pm line 106.
mysqlbinlog version command failed with rc 1:0, please verify PATH, LD_LIBRARY_PATH, and client options
 at /usr/local/bin/apply_diff_relay_logs line 493.
Fri Aug 28 04:38:22 2019 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln205] Slaves settings check failed!
Fri Aug 28 04:38:22 2019 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln413] Slave configuration failed.
Fri Aug 28 04:38:22 2019 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln424] Error happened on checking configurations.  at /usr/local/bin/masterha_check_repl line 48.
Fri Aug 28 04:38:22 2019 - [error][/usr/local/share/perl5/MHA/MasterMonitor.pm, ln523] Error happened on monitoring servers.
Fri Aug 28 04:38:22 2019 - [info] Got exit code 1 (Not master dead).
 
MySQL Replication Health is NOT OK!

解决方案--在每个DB节点执行以下命令

ln -s /usr/local/mysql/bin/mysqlbinlog /usr/local/bin/mysqlbinlog
 
ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql

再次检查,报错信息消失,OK。

6.root 账号密码过期

以root账号设置的ssh免密登陆,而ssh有过期限制,则mha ssh检查时报错:

/usr/local/bin/masterha_check_ssh --conf=/etc/mha/qqorder.cnf
Thu Nov 5 10:09:09 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.
Thu Nov 5 10:09:09 2018 - [info] Reading application default configuration from /etc/mha/pms20epime.cnf..
Thu Nov 5 10:09:09 2018 - [info] Reading server configuration from /etc/mha/pms20epime.cnf..
Thu Nov 5 10:09:09 2018 - [info] Starting SSH connection tests..
Thu Nov 5 10:09:09 2018 - [error][/usr/local/share/perl5/MHA/SSHCheck.pm, ln63]
Thu Nov 5 10:09:09 2018 - [debug] Connecting via SSH from root@172.181.191.191(172.181.191.191:22) to root@172.181.191.192(172.181.191.192:22)..

WARNING: Your password has expired.
Password change required but no TTY available.
Thu Nov 5 10:09:09 2018 - [error][/usr/local/share/perl5/MHA/SSHCheck.pm, ln111] SSH connection from root@172.181.191.191(172.181.191.191:22) to root@172.181.191.192(172.181.191.192:22) failed!
Thu Nov 5 10:09:10 2018 - [error][/usr/local/share/perl5/MHA/SSHCheck.pm, ln63]
Thu Nov 5 10:09:09 2018 - [debug] Connecting via SSH from root@172.181.191.192(172.181.191.192:22) to root@172.181.191.191(172.181.191.191:22)..

WARNING: Your password has expired.
Password change required but no TTY available.
Thu Nov 5 10:09:10 2018 - [error][/usr/local/share/perl5/MHA/SSHCheck.pm, ln111] SSH connection from root@172.181.191.192(172.181.191.192:22) to root@172.181.191.191(172.181.191.191:22) failed!
SSH Configuration Check Failed!
 at /usr/local/bin/masterha_check_ssh line 44.

另外一种表现,就是第二次执行账号切换时报错  sudo su -

解决方案在root账号下,执行以下命令:

chage -M 99999 root

以上就是MySQL 有关MHA搭建与切换的几个错误log汇总的详细内容,更多关于MySQL MHA搭建与切换的资料请关注我们其它相关文章!

(0)

相关推荐

  • MySQL读取Binlog日志常见的3种错误

    1. mysqlbinlog: [ERROR] unknown variable 'default-character-set=utf8mb4' 当我们在my.cnf中添加default-character-set=utf8mb4选项,那么在mysqlbinlog查看binlog时就会报错. 解决方案:.mysqlbinlog 后面添加 --no-defaults 选项 例如: mysql bin可执行文件所在路径/bin/mysqlbinlog --no-defaults binlog所在目录

  • Mysql GTID Mha配置方法

    Gtid + Mha +Binlog server配置: 1:测试环境 OS:CentOS 6.5 Mysql:5.6.28 Mha:0.56 192.168.1.21 mysql1 M1 192.168.1.22 mysql2 S1 192.168.1.23 mysql3 S2 Mha manage.Binlog server 2:配置/etc/my.cnf相关参数,在3各节点中分别配置 binlog-format=ROW log-slave-updates=true gtid-mode=on

  • MySQL下高可用故障转移方案MHA的超级部署教程

    MHA介绍 MHA是一位日本MySQL大牛用Perl写的一套MySQL故障切换方案,来保证数据库系统的高可用.在宕机的时间内(通常10-30秒内),完成故障切换,部署MHA,可避免主从一致性问题,节约购买新服务器的费用,不影响服务器性能,易安装,不改变现有部署.      还支持在线切换,从当前运行master切换到一个新的master上面,只需要很短的时间(0.5-2秒内),此时仅仅阻塞写操作,并不影响读操作,便于主机硬件维护.   在有高可用,数据一致性要求的系统上,MHA 提供了有用的功能

  • MHA实现mysql主从数据库手动切换的方法

    本文实例讲述了MHA实现mysql主从数据库手动切换的方法,分享给大家供大家参考.具体方法如下: 一.准备工作 1.分别在Master和Slave执行如下,方便mha检查复制: 复制代码 代码如下: grant all privileges on *.* to 'root'@'10.1.1.231' identified by 'rootpass'; grant all privileges on *.* to 'root'@'10.1.1.234' identified by 'rootpas

  • mysql 有关“InnoDB Error ib_logfile0 of different size”错误

    1,查看Mysqld(/var/log/mysqld.log)日志,发现以下错误:InnoDB: Error: log file /usr/local/mysql/data/ib_logfile0 is of different size 05242880 bytesInnoDB: than specified in the .cnf file 0 104857600 bytes!030826 1:42:15 Can't init databases030826 1:42:15 Aborting

  • MySQL5.1主从同步出现Relay log read failure错误解决方法

    众所周知MySQL5.1的Replication是比较烂的.MySQL的每一个版本更新关于同步方面每次都是可以看到一大堆.但MySQL 5.1性能是比较突出的.所以经不住诱惑使用MySQL 5.1.所以也要经常遇到一些Bug.如: 复制代码 代码如下: mysql> show slave status\G *************************** 1. row ***************************                Slave_IO_State: Wa

  • MySQL 有关MHA搭建与切换的几个错误log汇总

    1:masterha_check_repl 副本集方面报错  replicates is not defined in the configuration file! 具体信息如下: # /usr/local/bin/masterha_check_repl --conf=/etc/mha/app1.cnf Thu Nov 21 15:33:15 2018 - [warning] Global configuration file /etc/masterha_default.cnf not fou

  • mysql 8.0.18 mgr 搭建及其切换功能

    一.系统安装包 yum -y install make gcc-c++ cmake bison-devel ncurses-devel readline-devel libaio-devel perl libaio wget lrzsz vim libnuma* bzip2 xz 二.关闭防火墙和selinux sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config setenforce 0 /etc/init.d/i

  • MySQL之MHA高可用配置及故障切换实现详细部署步骤

    一.MHA介绍 (一).什么是MHA MHA(MasterHigh Availability)是一套优秀的MySQL高可用环境下故障切换和主从复制的软件. MHA 的出现就是解决MySQL 单点的问题. MySQL故障切换过程中,MHA能做到0-30秒内自动完成故障切换操作. MHA能在故障切换的过程中最大程度上保证数据的一致性,以达到真正意义上的高可用. (二).MHA 的组成 MHA Node(数据节点) MHA Node 运行在每台 MySQL 服务器上. MHA Manager(管理节点

  • MySQL主从数据库搭建方法详解

    本文实例讲述了MySQL主从数据库搭建方法.分享给大家供大家参考,具体如下: 主从服务器是mysql实时数据同步备份的一个非常好的方案了,现在各大中小型网都都会使用mysql数据库主从服务器功能来对网站数据库进行异步备份了,下面我们来给大家介绍主从服务器配置步骤. Mysql的主从复制至少是需要两个Mysql的服务,当然Mysql的服务是可以分布在不同的服务器上,也可以在一台服务器上启动多个服务. (1)首先确保主从服务器上的Mysql版本相同 (2)在主服务器上,设置一个从数据库的账户,使用R

  • 详解MySQL集群搭建

    概述 MySQL Cluster 是MySQL 适合于分布式计算环境的高实用.可拓展.高性能.高冗余版本,其研发设计的初衷就是要满足许多行业里的最严酷应用要求,这些应用中经常要求数据库运行的可靠性要达到99.999%.MySQL Cluster允许在无共享的系统中部署"内存中"数据库集群,通过无共享体系结构,系统能够使用廉价的硬件,而且对软硬件无特殊要求.此外,由于每个组件有自己的内存和磁盘,不存在单点故障. 实际上,MySQL集群是把一个叫做NDB的内存集群存储引擎集成与标准的MyS

  • MySQL大库搭建主从的一种思路分享

    这个周忙的就像打仗一样,感觉有点被别人牵着鼻子走了,每天都是早出晚归,干不完的活儿,有时候感觉DBA这碗饭真的不好吃,要有强大的抗压能力和心理承受能力.今天下午吃饭的时候,真的感觉整个人快要垮掉了,吃完饭就依然决然的下班了,走在路上,看着下班的人群,心想这不就是正常的下班时间么,为什么我还有种早走惭愧的感觉?可能整个人都被洗脑了吧. 这个周的公众号内容更新也是耽搁了两天,周二那天实在是太累了,就直接休息了. 昨晚要走的时候,大概九点多,工作了一天比较累,然后就大脑不听使唤,弄了一个故障,把线上一

  • 基于Docker的Mysql主备搭建的实现步骤

    目录 前期规划: 配置过程: Docker mysql主从配置.我们会在一台centos的虚拟机上,配置mysql主备 前期规划: docker mysql版本 mysql:5.7 docker网络配置,我们会创建名称为mysql的网络,子网掩码为 172.88.0.0/16 docker mysql主对应的容器名称:mysql-master, ip地址:172.88.0.11,映射端口:3307,文件卷配置(配置文件和数据文件持久化)mysql配置文件地址:/usr/local/docker/

  • Mysql双主搭建的方法步骤

    目录 1. Mysql binlog参数配置 2. Mysql binlog查看详细内容 3. Mysql双主搭建 4. Mysql双主解决数据回环 4.1 双主同步测试一 4.2 双主同步测试二 4.3 双主同步测试三 1. Mysql binlog参数配置 log-bin=mysql-bin 打开二进制日志功能,默认在datadir下 binlog-ignore-db binlog-ignore-db=mysql binlog-ignore-db=information_schema bin

  • mysql 5.7安装 MySQL 服务无法启动但是服务没有报告任何错误

    MySQL 5.7的安装有两种方式,一种是下载安装程序,点击安装,另一种是下载压缩包,直接解压,配置一下就可以运行了 个人更喜欢压缩包的形式,所以本文记录的也是压死包形式的安装(配置) https://dev.mysql.com/downloads/mysql/ 我下载的最新的是 mysql-5.7.17-win32.zip 加压到mysql-5.7.17-win32文件夹,后文提到的文件和文件夹都以此为更目录 把bin目录配置到环境变量path的后面 我的是  ;D:\mysql-5.7.17

随机推荐