gtid集群搭建好后,检测通过不了,哪位大师帮我分析一下原因

来源:5-20 MaxScale实例演示

宝慕林2132329

2020-01-29

[root@rep3 mha]# cat mha_mysql.cnf
[server default]
user=mha
password=123456
manager_workdir=/mysql/mha_mysql
manager_log=/mysql/mha_mysql/manager.log
remote_workdir=/mysql/mha_mysql
ssh_user=root
repl_user=rep
repl_password=123456
ping_interval=1
master_binlog_dir=/var/lib/mysql
master_ip_failover_script=/usr/bin/master_ip_failover
secondary_check_script=/usr/bin/masterha_secondary_check -s 192.168.0.200 -s 192.168.0.201 -s 192.168.0.202
[server1]
hostname=192.168.0.200
candidate_master=1
[server2]
hostname=192.168.0.201
candidate_master=1
[server3]
hostname=192.168.0.202
no_master=1

cat /usr/bin/master_ip_failover

my $vip = ‘192.168.0.220/24’;
my $key = ‘1’;
my sshstartvip="sudo/sbin/ifconfigenp0s3:ssh_start_vip = "sudo /sbin/ifconfig enp0s3:sshstartvip="sudo/sbin/ifconfigenp0s3:key $vip";
my sshstopvip="sudo/sbin/ifconfigenp0s3:ssh_stop_vip = "sudo /sbin/ifconfig enp0s3:sshstopvip="sudo/sbin/ifconfigenp0s3:key down";
my $ssh_Bcast_arp= “sudo /sbin/arping -I bond0 -c 3 -A #vip#”;

[root@rep1 ~]# ifconfig -a
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.200 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::a00:27ff:fe84:9f2b prefixlen 64 scopeid 0x20
ether 08:00:27:84:9f:2b txqueuelen 1000 (Ethernet)
RX packets 1171111 bytes 1467540502 (1.3 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 503664 bytes 906803599 (864.7 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

enp0s3:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.220 netmask 255.255.255.0 broadcast 192.168.0.255
ether 08:00:27:84:9f:2b txqueuelen 1000 (Ethernet)

mysql> show slave status \G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.0.200
Master_User: rep
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: master-bin.000008
Read_Master_Log_Pos: 1147
Relay_Log_File: relay-bin.000004
Relay_Log_Pos: 1322
Relay_Master_Log_File: master-bin.000008
Slave_IO_Running: Yes
Slave_SQL_Running: Yes

Replicate_Do_DB:
Replicate_Ignore_DB:

写回答

1回答

sqlercn

2020-01-29

  1. 在master_ip_failover脚本中需要把my $ssh_Bcast_arp= “sudo /sbin/arping -I bond0 -c 3 -A #vip#”;中的#vip#替换为你的vip 192.168.0.220

  2. 在配置中200和201是可为主的,202不可为主。结合你之前的检测结果

    Tue Jan 28 07:00:39 2020 - [info] Dead Servers:
    Tue Jan 28 07:00:39 2020 - [info]   192.168.0.201(192.168.0.201:3306)
    Tue Jan 28 07:00:39 2020 - [info] Alive Servers:
    Tue Jan 28 07:00:39 2020 - [info]   192.168.0.200(192.168.0.200:3306)
    Tue Jan 28 07:00:39 2020 - [info]   192.168.0.202(192.168.0.202:3306)

    这里201已经不可访问了。当200再宕机后由于202不可为主所以就会报

    Tue Jan 28 07:00:39 2020 - [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

0
0

MySQL提升课程 全面讲解MySQL架构设计

面面俱到讲解影响MySQL性能的各个因素,让MySQL架构了然于胸。

4419 学习 · 547 问题

查看课程