admin管理员组

文章数量:1642336

两台服务器:192.168,1,212,192.168.1.110(centos7-01)

防火墙、selinux都关闭了,vrrp也都能正常接收,但是两台服务器都获取到了vip

192.168.1.110的keepalived.conf

global_defs {

notification_email {

997914490@qq

}

notification_email_from sns-lvs@gmail

#smtp_server smtp.hysec

#smtp_connection_timeout 30

router_id mycat_master # 设置mycat master的id,在一个网络应该是唯一的

}

vrrp_script chk_http_port {

script "/usr/local/src/mycat/check_pid.sh" # 返回状态码为0表示正常,检测脚本为true;返回状态码非0表示异常,检测脚本为false

interval 2 # 检测脚本执行的间隔,单位是秒

weight 20

}

vrrp_instance VI_1 {

state MASTER # 指定keepalived的角色,MASTER为主,BACKUP为备

interface enp0s3 # 当前进行vrrp通讯的网络接口卡(当前centos的网卡)

virtual_router_id 66 # 虚拟路由编号,主从要一致

priority 100 # 优先级,数值越大,获取处理请求的优先级越高

advert_int 1 # 检查间隔,默认为1s(vrrp组播周期秒数)

authentication {

auth_type PASS

auth_pass 1111

}

track_script {

chk_http_port # 调用检测脚本

}

virtual_ipaddress {

192.168.0.200 # 定义虚拟ip(VIP),可多设,每行一个

}

}

192.168.1.212的keepalived.conf

global_defs {

notification_email {

997914490@qq

}

notification_email_from sns-lvs@gmail

#smtp_server smtp.hysec

#smtp_connection_timeout 30

router_id mycat_backup # 设置mycat master的id,在一个网络应该是唯一的

}

vrrp_script chk_mycat_alive {

script "/usr/local/src/mycat/check_pid.sh" #mycat检测脚本

interval 2 #(检测脚本执行的间隔,单位是秒)

weight 20

}

vrrp_instance VI_1 {

state BACKUP # 指定keepalived的角色,MASTER为主,BACKUP为备

interface eth0 # 当前进行vrrp通讯的网络接口卡(当前centos的网卡)

virtual_router_id 65 # 虚拟路由编号,同集群,主备必须一致,但同一内网内不能相同

priority 90 # 优先级,数值越大,获取处理请求的优先级越高

advert_int 1 # 检查间隔,默认为1s(vrrp组播周期秒数)

authentication {

auth_type PASS

auth_pass 1111

}

track_script {

chk_mycat_alive #(调用检测脚本)

}

virtual_ipaddress {

192.168.1.200 # 定义虚拟ip(VIP),可多设,每行一个

}

}

vip情况:

192.168.1.110:

enp0s3: mtu 1500 qdisc pfifo_fast state UP group default qlen 1000

link/ether 08:00:27:0b:58:6a brd ff:ff:ff:ff:ff:ff

inet 192.168.1.110/24 brd 192.168.1.255 scope global noprefixroute enp0s3

valid_lft forever preferred_lft forever

inet 192.168.0.200/32 scope global enp0s3

valid_lft forever preferred_lft forever

inet6 fe80::c5f5:ede0:1d3f:bb29/64 scope link noprefixroute

valid_lft forever preferred_lft forever

192.168.1.212:

1: lo: mtu 65536 qdisc noqueue state UNKNOWN

link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

inet 127.0.0.1/8 scope host lo

inet6 ::1/128 scope host

valid_lft forever preferred_lft forever

2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000

link/ether 08:00:27:94:55:54 brd ff:ff:ff:ff:ff:ff

inet 192.168.1.212/24 brd 192.168.1.255 scope global eth0

inet 192.168.1.200/32 scope global eth0

inet6 fe80::a00:27ff:fe94:5554/64 scope link

valid_lft forever preferred_lft forever

vrrp包收发情况

192.168,1,212:

20:49:54.250324 IP 192.168.1.110 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:49:54.496484 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:49:55.251307 IP 192.168.1.110 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:49:55.497229 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:49:56.253742 IP 192.168.1.110 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:49:56.497428 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:49:57.254872 IP 192.168.1.110 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:49:57.497577 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:49:58.256511 IP 192.168.1.110 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:49:58.497749 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:49:59.257411 IP 192.168.1.110 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:49:59.498256 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:50:00.257712 IP 192.168.1.110 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:50:00.498530 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:50:01.259205 IP 192.168.1.110 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:50:01.499458 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:50:02.259715 IP 192.168.1.110 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:50:02.499701 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:50:03.260102 IP 192.168.1.110 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:50:03.500302 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:50:04.261139 IP 192.168.1.110 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:50:04.501101 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:50:05.262698 IP 192.168.1.110 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:50:05.501962 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:50:06.263961 IP 192.168.1.110 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:50:06.502962 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

192.168.1.110(centos7-01):

20:50:58.765166 IP centos7-01 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:50:58.984738 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:50:59.766464 IP centos7-01 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:50:59.985413 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:51:00.767135 IP centos7-01 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:51:00.985734 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:51:01.768713 IP centos7-01 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:51:01.986506 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:51:02.769970 IP centos7-01 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:51:02.986950 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:51:03.771075 IP centos7-01 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:51:03.987944 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:51:04.772196 IP centos7-01 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:51:04.988894 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:51:05.773516 IP centos7-01 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:51:05.989476 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:51:06.775016 IP centos7-01 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:51:06.990712 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:51:07.776373 IP centos7-01 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:51:07.991712 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:51:08.778009 IP centos7-01 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:51:08.992410 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

20:51:09.778840 IP centos7-01 > vrrp.mcast: VRRPv2, Advertisement, vrid 66, prio 100, authtype simple, intvl 1s, length 20

20:51:09.992503 IP 192.168.1.212 > vrrp.mcast: VRRPv2, Advertisement, vrid 65, prio 90, authtype simple, intvl 1s, length 20

本文标签: KeepalivedLVSmysql脑裂