不要再研究 Pacemaker 或 Corosync 了,花了一大堆時間後才發見就算你把系統的自動化做得很好,Failover 也很 smart 但是一旦有問題的時候需要的知識跟管理門檻實在太高了。有的時候簡單的Solution才是最好的,Keepalived 不但設定簡單,而且你會一些Bash scripting的話,基本上功能不會輸給Pacemaker而且還更好學。就讓我用這篇實作來帶你入門吧。
http://blog.unicsolution.com/2015/01/kamailio-high-availability-with.html
請到我的部落格看詳細內容
http://blog.unicsolution.com/2015/01/kamailio-high-availability-with.html
!Configuration File for keepalived
vrrp_script check_sip {
script "/etc/keepalived/checksip.sh"
interval 5 # check every 5 seconds
fall 2 # require 2 failures for KO
rise 4 # require 4 successes for OK
}
vrrp_instance SBC_1 {
state BACKUP
interface eth0
virtual_router_id 56
# priority 100
nopreempt
advert_int 1
authentication {
auth_type PASS
auth_pass somepassword
}
virtual_ipaddress {
123.123.123.123/24 brd 123.123.123.255 dev eth0 label eth0:0
}
track_script {
check_sip
}
notify_master "/etc/keepalived/master-backup.sh MASTER"
notify_backup "/etc/keepalived/master-backup.sh BACKUP"
notify_fault "/etc/keepalived/master-backup.sh FAULT"
}