2018.02.06-Keepalived配置
@(技术-Linux)[Linux, Keepalived]
①配置Keepalived的Master
! Configuration File for keepalived
global_defs {
router_id LVS_DEVEL
}
vrrp_script chk_http_port {
script "</dev/tcp/127.0.0.1/80"
interval 1
weight -2
}
vrrp_instance VI_1 {
state MASTER
interface enp0s31f6
virtual_router_id 51
priority 150
advert_int 1
mcast_src_ip 192.168.31.202
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.31.120
}
track_script {
chk_http_port
}
}
②配置Keepalived的Backup
! Configuration File for keepalived
global_defs {
router_id LVS_DEVEL
}
vrrp_script chk_http_port {
script "</dev/tcp/127.0.0.1/80"
interval 1
weight -2
}
vrrp_instance VI_1 {
state BACKUP
interface enp0s31f6
virtual_router_id 51
priority 100
advert_int 1
mcast_src_ip 192.168.31.201
authentication {
auth_type PASS
auth_pass 1111
}
virtual_ipaddress {
192.168.31.120
}
track_script {
chk_http_port
}
}
③Keepalived启动
/usr/local/keepalived/sbin/keepalived -D -f /usr/local/keepalived/etc/keepalived/keepalived.conf
④查看运行情况
ip addr
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。