mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
This patch enable redundant virtual routers. 1. To enable this feature, db need to be updated using follow SQL by now(we would get a UI way later): UPDATE network_offerings SET redundant_router=1 WHERE guest_type="Virtual" AND system_only=0; 2. System would try to start up two routers at different hosts. But if there is only one host in the zone, system would start up two routers on it. 3. The failover part is using keepalived, and connection tracking part is using conntrackd. There would be one master router and one backup router. The status of router(master or backup) can be query from the database table domain_router now. Management server would update the status every 30s by default. 4. The routers for the same zone would use same external NIC(same ip and mac). The script used for fail-over would ensure only one external NIC present in the network at any time. 5. Currently management server don't got the ability to stop one of router is both of them reported as master. The feature is in the todo list. After two routers start up, disconnect anyone of them, the guest network shouldn't be affected, and established connection(http, ssh, etc.) should still works. The fail-over on gateway part should be 3~4 seconds. Currently the patch works with KVM. Would deal with vmware and XenServer soon.
57 lines
1.3 KiB
Plaintext
57 lines
1.3 KiB
Plaintext
! Configuration File for keepalived
|
|
|
|
global_defs {
|
|
router_id [ROUTER_ID]
|
|
}
|
|
|
|
vrrp_sync_group VG_1 {
|
|
group {
|
|
inside_network # name of vrrp_instance (below)
|
|
outside_network # One for each moveable IP.
|
|
}
|
|
|
|
# notify scripts and alerts are optional
|
|
#
|
|
# filenames of scripts to run on transitions
|
|
# can be unquoted (if just filename)
|
|
# or quoted (if has parameters)
|
|
# to MASTER transition
|
|
notify_master "/root/redundant_router/master.sh"
|
|
# to BACKUP transition
|
|
notify_backup "/root/redundant_router/backup.sh"
|
|
# FAULT transition
|
|
notify_fault "/root/redundant_router/fault.sh"
|
|
|
|
# for ANY state transition.
|
|
# "notify" script is called AFTER the
|
|
# notify_* script(s) and is executed
|
|
# with 3 arguments provided by keepalived
|
|
# (ie don't include parameters in the notify line).
|
|
# arguments
|
|
# $1 = "GROUP"|"INSTANCE"
|
|
# $2 = name of group or instance
|
|
# $3 = target state of transition
|
|
# ("MASTER"|"BACKUP"|"FAULT")
|
|
#notify /root/redundant_router/notify.sh
|
|
}
|
|
|
|
|
|
vrrp_instance inside_network {
|
|
state BACKUP
|
|
interface eth0
|
|
virtual_router_id 51
|
|
priority [PRIORITY]
|
|
|
|
advert_int 1
|
|
authentication {
|
|
auth_type PASS
|
|
auth_pass WORD
|
|
}
|
|
|
|
virtual_ipaddress {
|
|
[ROUTER_IP] brd [BOARDCAST] dev eth0
|
|
}
|
|
|
|
nopreempt
|
|
}
|