一、軟件安裝
yum install -y keepalived
二晴氨、查詢已安裝的軟件及路徑
rpm -qc keepalived
/etc/keepalived/keepalived.conf
/etc/sysconfig/keepalived
三臂港、配置搶占式高可用
搶占式主配置
vim /etc/keepalived/keepalived.conf
global_defs {
router_id keepalived01
}
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 50
priority 150
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.3
}
}
搶占式備配置
vim /etc/keepalived/keepalived.conf
global_defs {
router_id keepalived02
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 50
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.3
}
}
四仲智、配置非搶占式高可用
非搶占式主配置
vim /etc/keepalived/keepalived.conf
global_defs {
router_id keepalived01
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 50
priority 150
nopreempt
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.3
}
}
非搶占式備配置
vim /etc/keepalived/keepalived.conf
global_defs {
router_id keepalived02
}
vrrp_instance VI_1 {
state BACKUP
interface eth0
virtual_router_id 50
priority 100
nopreempt
advert_int 1
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
10.0.0.3
}
}