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

前端之家收集整理的这篇文章主要介绍了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相关文章