[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openser-users
Subject:    Re: [SR-Users] using kamailio as load balancer
From:       Daniel-Constantin Mierla <miconda () gmail ! com>
Date:       2011-11-29 15:35:36
Message-ID: 4ED4FBC8.9000401 () gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hello,

you have to do load balancing only for initial requests, not for 
requests within dialog. For requests within dialog (like NOTIFY) is 
better to rely on record routing.

A good way to build your load balancing config for kamailio is to start 
from disptacher module example:

http://kamailio.org/docs/modules/stable/modules_k/dispatcher.html#id2523004

Remove route[REGISTRAR], route[PRESENCE] and the $rU==$null condition, 
then update route[DISPATCH] to fit your needs.

Cheers,
Daniel

On 11/29/11 4:16 PM, Albert Petit wrote:
> Hello,
>
> I'm trying to setup kamailio as load  balancer  Behind that load 
> balancer I've a registrar and a presence server.
>
> When I start a client for the REGISTER and subscribe messages all 
> looks to work fine. The messages from clients are properly balanced to 
> the backend and responses are forwarded properly to the clients.
>
> However when my presence server sends a NOTIFY I find the load 
> balancer module answers 404 message to the presence server.
> I'm thinking the problem is front-end kamailio cannot locate users.  I 
> am quite newbie to use Kamailio for this purpose so sorry if what i'm 
> saying contains a big mistake.
>
> My load balancer script looks as following:
>
> log_facility=LOG_LOCAL0
>
> fork=yes
> children=4
>
> listen=10.1.1.63:6666 <http://10.1.1.63:6666>
> listen=10.1.1.63:5060 <http://10.1.1.63:5060>
> alias=dev.myenvironment.net <http://dev.genaker.net>
>
> mpath="/usr/local/lib/kamailio/modules_k/:/usr/local/lib/kamailio/modules/"
>
> loadmodule "xlog.so"
>
>
>
> # ----------------- setting module-specific parameters ---------------
>
> #!define WITH_DISP
>
> #!ifdef WITH_DISP
> loadmodule "dispatcher.so"
> loadmodule "db_mysql.so"
> #!endif
>
>
>
> # ----- dispatcher -----
> #!ifdef WITH_DISP
> # Set database used for dispatcher servers. As we will use default 
> values, no further
> # information is needed
> modparam("dispatcher", 
> "db_url","mysql://openser:openserrw@10.1.1.50/openser 
> <http://openser:openserrw@10.1.1.50/openser>")
> #!endif
>
> ####### Routing Logic ########
> route{
> #!ifdef WITH_DISP
> if( uri=~"sip:.*session=chat.*" ) {
>         xlog("L_DEBUG", "PoC:relaying chat session by Request URI");
>         ds_select_dst("1", "3");
>
>         forward();
> } else {
>         xlog("L_DEBUG", "PoC:relaying PoC Session by round-robin");
>         ds_select_dst("1", "4");
>         forward();
> }
> #!else
> xlog("L_DEBUG", "PoC: Relaying by hardcoded route");
> t_relay("10.1.1.50", "6666");
> #!endif
> }
> ~
>
> So the questions are: Does this module need to locate users? Should I 
> include usrloc module iin that sip proxy node in order to be able to 
> locate the users??
>
> Thanks
> Albert
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users@lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Dec 5-8, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda


[Attachment #5 (text/html)]

<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    you have to do load balancing only for initial requests, not for
    requests within dialog. For requests within dialog (like NOTIFY) is
    better to rely on record routing.<br>
    <br>
    A good way to build your load balancing config for kamailio is to
    start from disptacher module example:<br>
    <br>
<a class="moz-txt-link-freetext" \
href="http://kamailio.org/docs/modules/stable/modules_k/dispatcher.html#id2523004">http://kamailio.org/docs/modules/stable/modules_k/dispatcher.html#id2523004</a><br>
  <br>
    Remove route[REGISTRAR], route[PRESENCE] and the $rU==$null
    condition, then update route[DISPATCH] to fit your needs.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    On 11/29/11 4:16 PM, Albert Petit wrote:
    <blockquote
cite="mid:CAPFor4jXSHyi2wgQ0fMXMz7N_SyJxUwGZ95W7EGT4dHNdp8P5A@mail.gmail.com"
      type="cite">Hello,<br>
      <br>
      I'm trying to setup kamailio as load&nbsp; balancer&nbsp; Behind that load
      balancer I've a registrar and a presence server.<br>
      <br>
      When I start a client for the REGISTER and subscribe messages all
      looks to work fine. The messages from clients are properly
      balanced to the backend and responses are forwarded properly to
      the clients.<br>
      <br>
      However when my presence server sends a NOTIFY I find the load
      balancer module answers 404 message to the presence server.<br>
      I'm thinking the problem is front-end kamailio cannot locate
      users.&nbsp; I am quite newbie to use Kamailio for this purpose so
      sorry if what i'm saying contains a big mistake. <br>
      <br>
      My load balancer script looks as following:<br>
      <br>
      log_facility=LOG_LOCAL0<br>
      <br>
      fork=yes<br>
      children=4<br>
      <br>
      listen=<a moz-do-not-send="true" href="http://10.1.1.63:6666"
        target="_blank">10.1.1.63:6666</a><br>
      listen=<a moz-do-not-send="true" href="http://10.1.1.63:5060"
        target="_blank">10.1.1.63:5060</a><br>
      alias=<a moz-do-not-send="true" href="http://dev.genaker.net"
        target="_blank">dev.myenvironment.net</a><br>
      <br>
mpath="/usr/local/lib/kamailio/modules_k/:/usr/local/lib/kamailio/modules/"<br>
      <br>
      loadmodule "xlog.so"<br>
      <br>
      <br>
      <br>
      # ----------------- setting module-specific parameters
      ---------------<br>
      <br>
      #!define WITH_DISP<br>
      <br>
      #!ifdef WITH_DISP<br>
      loadmodule "dispatcher.so"<br>
      loadmodule "db_mysql.so"<br>
      #!endif<br>
      <br>
      <br>
      <br>
      # ----- dispatcher -----<br>
      #!ifdef WITH_DISP<br>
      # Set database used for dispatcher servers. As we will use default
      values, no further<br>
      # information is needed<br>
      modparam("dispatcher", "db_url","mysql://<a moz-do-not-send="true"
        href="http://openser:openserrw@10.1.1.50/openser"
        target="_blank">openser:openserrw@10.1.1.50/openser</a>")<br>
      #!endif<br>
      <br>
      ####### Routing Logic ########<br>
      route{<br>
      #!ifdef WITH_DISP<br>
      if( uri=~<a class="moz-txt-link-rfc2396E" \
                href="sip:.*session=chat.*">"sip:.*session=chat.*"</a> ) {<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog("L_DEBUG", "PoC:relaying chat \
session by Request  URI");<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ds_select_dst("1", "3");<br>
      <br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; forward();<br>
      } else {<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; xlog("L_DEBUG", "PoC:relaying PoC \
Session by  round-robin");<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ds_select_dst("1", "4");<br>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; forward();<br>
      }<br>
      #!else<br>
      xlog("L_DEBUG", "PoC: Relaying by hardcoded route");<br>
      t_relay("10.1.1.50", "6666");<br>
      #!endif<br>
      }<br>
      ~<br>
      <br>
      So the questions are: Does this module need to locate users?
      Should I include usrloc module iin that sip proxy node in order to
      be able to locate the users??<br>
      <br>
      Thanks<br>
      Albert<br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" \
href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a> <a \
class="moz-txt-link-freetext" \
href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
 </pre>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-freetext" \
href="http://www.asipto.com">http://www.asipto.com</a> Kamailio Advanced Training, \
Dec 5-8, Berlin: <a class="moz-txt-link-freetext" \
href="http://asipto.com/u/kat">http://asipto.com/u/kat</a> <a \
class="moz-txt-link-freetext" \
href="http://linkedin.com/in/miconda">http://linkedin.com/in/miconda</a> -- <a \
class="moz-txt-link-freetext" \
href="http://twitter.com/miconda">http://twitter.com/miconda</a></pre>  </body>
</html>



_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic