最新消息:

Keepalived设置非抢占模式

Linux ipcpu 4651浏览

Keepalived设置非抢占模式.md

概述

有时候我们使用keepalived来处理数据库等系统的高可用,最不希望看到的情况就是已经死掉的机器又活了过来,因此非抢占是一个重要的配置。

Keepalived非抢占配置文件

  1. #@MASTER配置
  2. vrrp_instance VI_1 {
  3. state BACKUP #master or slave
  4. interface eth0 #interface
  5. virtual_router_id 51 #router-id
  6. priority 101 #priority
  7. nopreempt
  8. advert_int 1
  9. authentication {
  10. auth_type PASS
  11. auth_pass ipcpu.com
  12. }
  13. virtual_ipaddress {
  14. 211.81.175.208 label eth0:1
  15. }
  16. }
  17. #@BACKUP配置
  18. vrrp_instance VI_1 {
  19. state BACKUP #master or slave
  20. interface eth0 #interface
  21. virtual_router_id 51 #router-id
  22. priority 100 #priority
  23. advert_int 1
  24. authentication {
  25. auth_type PASS
  26. auth_pass ipcpu.com
  27. }
  28. virtual_ipaddress {
  29. 211.81.175.208 label eth0:1
  30. }
  31. }

总结

Keepalived不抢占有两种写法,第一种就是上面的举例:
主 backup priority100 nopreempt
备 backup priority50

第二种就是讲优先级设置成一样的,这样后面启动的不会抢占。
主 backup priority100
备 backup priority100

转载请注明:IPCPU-网络之路 » Keepalived设置非抢占模式