请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

部署MHA 架构遇到问题

系统:centos 

[root@c7-mysql-5 ~]# cat /etc/redhat-release 

CentOS Linux release 7.2.1511 (Core) 

数据库:

mysql> select version();

+------------+

| version()  |

+------------+

| 5.7.17-log |

+------------+

1 row in set (0.00 sec)


部署MHA步骤:

1 主从复制配置


2 MHA安装

2.1 免验证登录ssh


2.2 安装

部署node(所有节点)

yum install -y epel-release

yum install -y perl-DBD-MySQL.x86_64 perl-DBI.x86_64 ncftp.x86_64

        

部署manager

yum install -y epel-release

yum install -y perl-Config-Tiny.noarch perl-Time-HiRes.x86_64 perl-Parallel-ForkManager.noarch 

perl-Log-Dispatch perl-DBD-MySQL.x86_64  ncftp.x86_64


 所有节点创建mha用户

 create user 'mha'@'192.168.40.%' identified by '123456';

 grant all privileges on *.* to 'mha'@'192.168.40.%';



 所有节点创建

 mkdir -p /home/mysql_mha


 将/usr/bin/master_ip_failover 复制到manager的/usr/bin


配置manager

[root@c7-mysql-5 mha]# pwd

/etc/mha

[root@c7-mysql-5 mha]# cat mysql_mha.cnf

[server default]

user=mha

password=123456

manager_workdir=/home/mysql_mha

manager_log=/home/mysql_mha/manager.log

remote_workdir=/home/mysql_mha

ssh_user=root

repl_user=repl

repl_password=123456

ping_interval=1

master_binlog_dir=/usr/local/mysql/data

master_ip_failover_script=/usr/bin/master_ip_failover

secondary_check_script=/usr/bin/masterha_secondary_check -s 192.168.40.10 -s 192.168.40.11 -s 192.168.40.12


[server1]

hostname=192.168.40.10

candidate_master=1


[server2]

hostname=192.168.40.11

candidate_master=1


[server3]

hostname=192.168.40.12

no_master=1


[root@c7-mysql-5 bin]# masterha_check_repl --conf=/etc/mha/mysql_mha.cnf

Thu Jul 26 22:19:27 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.

Thu Jul 26 22:19:27 2018 - [info] Reading application default configuration from /etc/mha/mysql_mha.cnf..

Thu Jul 26 22:19:27 2018 - [info] Reading server configuration from /etc/mha/mysql_mha.cnf..

Thu Jul 26 22:19:27 2018 - [info] MHA::MasterMonitor version 0.57.

Thu Jul 26 22:19:28 2018 - [info] GTID failover mode = 1

Thu Jul 26 22:19:28 2018 - [info] Dead Servers:

Thu Jul 26 22:19:28 2018 - [info]   192.168.40.11(192.168.40.11:3306)

Thu Jul 26 22:19:28 2018 - [info] Alive Servers:

Thu Jul 26 22:19:28 2018 - [info]   192.168.40.10(192.168.40.10:3306)

Thu Jul 26 22:19:28 2018 - [info]   192.168.40.12(192.168.40.12:3306)

Thu Jul 26 22:19:28 2018 - [info] Alive Slaves:

Thu Jul 26 22:19:28 2018 - [info]   192.168.40.12(192.168.40.12:3306)  Version=5.7.17-log (oldest major version between slaves) log-bin:enabled

Thu Jul 26 22:19:28 2018 - [info]     GTID ON

Thu Jul 26 22:19:28 2018 - [info]     Replicating from 192.168.40.10(192.168.40.10:3306)

Thu Jul 26 22:19:28 2018 - [info]     Not candidate for the new Master (no_master is set)

Thu Jul 26 22:19:28 2018 - [info] Current Alive Master: 192.168.40.10(192.168.40.10:3306)

Thu Jul 26 22:19:28 2018 - [info] Checking slave configurations..

Thu Jul 26 22:19:28 2018 - [info]  read_only=1 is not set on slave 192.168.40.12(192.168.40.12:3306).

Thu Jul 26 22:19:28 2018 - [info] Checking replication filtering settings..

Thu Jul 26 22:19:28 2018 - [info]  binlog_do_db= , binlog_ignore_db= 

Thu Jul 26 22:19:28 2018 - [info]  Replication filtering check ok.

Thu Jul 26 22:19:28 2018 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln364] None of slaves can be master. Check failover configuration file or log-bin settings in my.cnf

Thu Jul 26 22:19:28 2018 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln427] Error happened on checking configurations.  at /usr/bin/masterha_check_repl line 48.

Thu Jul 26 22:19:28 2018 - [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln525] Error happened on monitoring servers.

Thu Jul 26 22:19:28 2018 - [info] Got exit code 1 (Not master dead).


MySQL Replication Health is NOT OK!


正在回答 回答被采纳积分+3

2回答

sqlercn 2018-07-26 22:54:16

40.11的mysql连接不上呀

0 回复 有任何疑惑可以回复我~
提问者 慕粉3361838 2018-07-26 22:38:15

[root@c7-mysql-5 bin]# masterha_check_ssh --conf=/etc/mha/mysql_mha.cnf 

Thu Jul 26 22:28:17 2018 - [warning] Global configuration file /etc/masterha_default.cnf not found. Skipping.

Thu Jul 26 22:28:17 2018 - [info] Reading application default configuration from /etc/mha/mysql_mha.cnf..

Thu Jul 26 22:28:17 2018 - [info] Reading server configuration from /etc/mha/mysql_mha.cnf..

Thu Jul 26 22:28:17 2018 - [info] Starting SSH connection tests..

Thu Jul 26 22:28:18 2018 - [debug] 

Thu Jul 26 22:28:17 2018 - [debug]  Connecting via SSH from root@192.168.40.10(192.168.40.10:22) to root@192.168.40.11(192.168.40.11:22)..

Thu Jul 26 22:28:17 2018 - [debug]   ok.

Thu Jul 26 22:28:17 2018 - [debug]  Connecting via SSH from root@192.168.40.10(192.168.40.10:22) to root@192.168.40.12(192.168.40.12:22)..

Thu Jul 26 22:28:17 2018 - [debug]   ok.

Thu Jul 26 22:28:18 2018 - [debug] 

Thu Jul 26 22:28:17 2018 - [debug]  Connecting via SSH from root@192.168.40.11(192.168.40.11:22) to root@192.168.40.10(192.168.40.10:22)..

Thu Jul 26 22:28:18 2018 - [debug]   ok.

Thu Jul 26 22:28:18 2018 - [debug]  Connecting via SSH from root@192.168.40.11(192.168.40.11:22) to root@192.168.40.12(192.168.40.12:22)..

Thu Jul 26 22:28:18 2018 - [debug]   ok.

Thu Jul 26 22:28:19 2018 - [debug] 

Thu Jul 26 22:28:18 2018 - [debug]  Connecting via SSH from root@192.168.40.12(192.168.40.12:22) to root@192.168.40.10(192.168.40.10:22)..

Thu Jul 26 22:28:18 2018 - [debug]   ok.

Thu Jul 26 22:28:18 2018 - [debug]  Connecting via SSH from root@192.168.40.12(192.168.40.12:22) to root@192.168.40.11(192.168.40.11:22)..

Thu Jul 26 22:28:18 2018 - [debug]   ok.

Thu Jul 26 22:28:19 2018 - [info] All SSH connection tests passed successfully.


0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信