2008年6月30日 星期一

OpenSer and HA/LoadBalancing

This document mentions Load Balancing about OpenSer.

This also mention this feature.

Here provides a sample configuration file.

# Made by Deillon Thomas
debug=3 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=yes # (cmd line: -E)
children=4
check_via=no
dns=no
rev_dns=no
port=5060

#set module path
mpath="/usr/local/lib64/openser/modules/"

# ------------------ module loading ----------------------------------
loadmodule "maxfwd.so"
loadmodule "sl.so"
loadmodule "dispatcher.so"
loadmodule "tm.so"
loadmodule "mi_fifo.so"
loadmodule "textops.so"
loadmodule "xlog.so"

modparam("mi_fifo","fifo_name", "/tmp/openser_fifo")
#Timer which hits if no final reply for a request
#or ACK for a negative INVITE reply arrives
modparam("tm", "fr_timer", 5)

modparam("dispatcher", "list_file", "dispatcher.list")
modparam("dispatcher", "flags", 2) # fial-over mode
modparam("dispatcher", "dst_avp", "$avp(i:271)")
modparam("dispatcher", "grp_avp", "$avp(i:272)")
modparam("dispatcher", "cnt_avp", "$avp(i:273)")
modparam("dispatcher", "force_dst", 1)

route
{
[...]
if (method=="INVITE") #To complete of course
{
ds_select_dst("1","4"); # 4 = round-robin
t_on_failure("1"); # If there is no response after 5 sec
t_relay();
exit;
}
}

failure_route[1] {
if(t_check_status("408"){ # if timeout
ds_mark_dst(); # do not use this destination anymore
ds_next_dst(); # use next
t_on_failure("1"); # if the next one is dead to !!
t_relay();
}
else {
t_reply("501", "Not Implemented");
}
}

沒有留言: