主服务器
- ! 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 eth0
- virtual_router_id 51
- priority 100
- advert_int 1
- authentication {
- auth_type PASS
- auth_pass 1111
- }
- #master默认只需要修改使用VIP即可
- virtual_ipaddress {
- 192.168.17.200
- }
- }
备服务器
- ! 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 BACKUP
- interface eth0
- virtual_router_id 51
- priority 100
- advert_int 1
- authentication {
- auth_type PASS
- auth_pass 1111
- }
- #注意修改VIP
- virtual_ipaddress {
- 192.168.17.200
- }
- }
③分别按照顺序启动主服务器和备服务器的keepalived
- shell > service keepalived start
④查看主备服务器的网卡信息
#需要通过ip a命令查看 分别在server01和server03查看 shell > ip a
2.4、模拟故障
模拟服务器故障宕机,查看是否可以切换服务到备用机器。 (编辑:惠州站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|