keepalived模块功能:
1、check模块:主要负责节点池中节点的健康检测
2、VRRP模块:实现主从之间的高可用功能
请问高可用是如何实现的
通过vip漂移
什么叫做脑裂,什么情况下容易出现脑裂
一个高可用集群中,多个主机同时出现vip,被称为脑裂
心跳线接触不良
防火墙将心跳包拦截
keepalived实现LVS-NAT模式
1、调度机两块网卡,配好IP地址,master:ens32:192.168.100.100,ens34:192.168.200.100
slave:ens32:192.168.100.101,ens34:192.168.200.101
2、安装keepalived,ipvsadm,加载模块ip_vs
3、修改keepalived主配置文件
! Configuration File for keepalived
global_defs {
notification_email {
acassen@firewall.loc
failover@firewall.loc
sysadmin@firewall.loc
}
notification_email_from Alexandre.Cassen@firewall.loc
smtp_server 192.168.200.1
smtp_connect_timeout 30
router_id LVS_DEVEL
}
vrrp_instance VI_1 {
state MASTER
interface ens32
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.100.150
}
}
vrrp_instance VI_2 {
state MASTER
interface ens34
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.200.150
}
}
virtual_server 192.168.200.150 80 {
delay_loop 2
lb_algo rr
lb_kind NAT
nat_mask 255.255.255.0
! persistence_timeout 50
protocol TCP
real_server 192.168.100.102 80 {
weight 1
TCP_CHECK {
connect_timeout 10
nb_get_retry 2
delay_before_retry 2
connect_port 80
}
}
real_server 192.168.100.103 80 {
weight 1
TCP_CHECK {
connect_timeout 10
nb_get_retry 2
delay_before_retry 2
connect_port 80
}
}
}
4、启动keepalived,并将配置文件复制给从
5、在从机上,将主机类型修改为SLAVE,优先级降低
6、测试