主:router
! Configuration File for keepalived
global_defs {
notification_email {
#admin@michael-demo.com
}
#notification_email_from admin@michael-demo.com
#smtp_server 127.0.0.1
#smtp_connect_timeout 30
router_id LVS_1
}
vrrp_instance VI_1 {
state MASTER # 另一種爲BACKUP
interface em1 # 綁定虛擬IP的網卡
virtual_router_id LVS_1
priority 100 # 主機能夠設置爲100
# nopreempt #設置了這個參數,則state MASTER不起做用而是根據權重(priority)來搶佔
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
58.211.8.119 # 虛擬IP地址
}
} server
從:ip
! Configuration File for keepalived
global_defs {
notification_email {
#admin@michael-demo.com
}
#notification_email_from admin@michael-demo.com
#smtp_server 127.0.0.1
#smtp_connect_timeout 30
router_id LVS_1
}
vrrp_instance VI_1 {
state BACKUP # 另一種爲BACKUP
interface eth2 # 綁定虛擬IP的網卡
virtual_router_id LVS_1
priority 1 # 主機能夠設置爲100
# nopreempt #設置了這個參數,則state MASTER不起做用而是根據權重(priority)來搶佔
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
58.211.8.119 # 虛擬IP地址
}
} it