CentOS6.5环境 keepalived高可用服务单实例配置

一、环境说明MASTER节点 192.168.89.100BACKUP节点 192.168.89.101VIP:192.168.89.102二、MASTER节点的配置文件1、主节点配置文件! Configuration File for keepalivedglobal_defs { notification_email { acassen@firewall.loc failover@firewall.loc sysadmin@firewall.loc } notification_email_from Alexandre.Cassen@firewall.loc smtp_server 127.0.0.1 smtp_connect_timeout 30 router_id 1b01}vrrp_instance VI_1 { state MASTER interface eth0 virtual_router_id 51 priority 150 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.89.102/24 dev eth0 label eth0:1 }}2、启动keepalived[root@kep1 keepalived]# /etc/init.d/keepalived start3、查看虚拟IP[root@kep1 keepalived]# ip addr | grep 192.168.89.102 inet 192.168.89.102/24 scope global secondary eth0三、BACKUP节点配置文件1、配置文件! Configuration File for keepalivedglobal_defs { notification_email { acassen@firewall.loc failover@firewall.loc sysadmin@firewall.loc } notification_email_from Alexandre.Cassen@firewall.loc smtp_server 127.0.0.1 smtp_connect_timeout 30 router_id 1b02}vrrp_instance VI_1 { state BACKUP interface eth0 virtual_router_id 51 priority 100 advert_int 1 authentication { auth_type PASS auth_pass 1111 } virtual_ipaddress { 192.168.89.102/24 dev eth0 label eht0:1 }}2、启动keepalived[root@kep2 keepalived]# /etc/init.d/keepalived start3、检查虚拟IP[root@kep2 keepalived]# ip addr | grep 192.168.89.102注意:如果MASTER活着的神话,BACKUP不会接管虚拟IP,所以这里没有输出IP是正常的如果备节点有出现虚拟IP,那么说明高可用脑裂了,脑裂是两台服务器争抢统一资源导致的,如果发生脑裂,排除思路如下:1、主备是否通信正常?防火墙是否阻挡?2、主备两台的keepalived配置文件是否正确?virtual_router_id是否一样?四、进行高可用主备服务器切换测试1、停掉主节点上的keepalived服务,然后在BACKUP节点查看是否接管虚拟IP2、重新启动主节点上的keepalived服务,看看这时候主节点会不会重新接管VIP,BACKUP节点会不会释放VIP如果上面两个测试正常,说明配置没有问题。注意,如果发生脑裂问题,需要注意一下启动顺序

相关文章

Centos下搭建性能监控Spotlight
CentOS 6.3下Strongswan搭建IPSec VPN
在CentOS6.5上安装Skype与QQ
阿里云基于centos6.5主机VPN配置
CentOS 6.3下配置multipah
CentOS安装、配置APR和tomcat-native