1. 通过命令 vim keepalived.conf 打开配置文件

  1. global_defs {
  2. router_id keep_172
  3. }
  4. vrrp_instance VI_1 {
  5. # 备用机设置为BACKUP
  6. state BACKUP
  7. interface ens33
  8. virtual_router_id 51
  9. # 权重低于MASTER
  10. priority 80
  11. advert_int 2
  12. authentication {
  13. auth_type PASS
  14. auth_pass 1111
  15. }
  16. virtual_ipaddress {
  17. # 注意:主备两台的vip都是一样的,绑定到同一个vip
  18. 192.168.1.161
  19. }
  20. }

2. 启动 Keepalived

  1. # 启动keepalived
  2. systemctl start keepalived
  3. # 停止keepalived
  4. systemctl stop keepalived
  5. # 重启keepalived
  6. systemctl restart keepalived

3. 查看进程

  1. ps -ef|grep keepalived

配置 Keepalived - 备 - 图1