本次搭建 keepalived
1、在Docker 搭建pxc集群 + haproxy + keepalived 高可用(二)基础上我们继续进入h1容器
docker exec -it h1 bash
2、更新apt-get
apt-get update
3、安装keepalived
apt-get install keepalived
4、安装vim
apt-get install vim
5、新建keepalived.conf配置文件
vim /etc/keepalived/keepalived.conf
配置文件内容如下:
vrrp_instance VI_1 {
state MASTER
interface eth0
virtual_router_id 51
priority 100
advert_int 1
authentication {
auth_type PASS
auth_pass 123456
}
virtual_ipaddress {
172.18.0.201
}
}
6、启动keepalived
service keepalived start
7、然后在宿主机上ping 172.18.0.201 看看是否能ping通。
说明搭建成功