[SR-Users] High availability

Moacir Ferreira moacirferreira at hotmail.com
Tue Jun 7 22:06:42 CEST 2016


Sorry... It is a long answer.

Keepalived is a kind of VRRP (RFC5798) like implementation. It is being used all over and it is distributed as a standard package in, for example, CentOS. So no compiling issues, you get upgrades, fixes, etc., in a very simple way.

I got this nice blog on Kamailio HA, and I will start my tests from it. Now, for MySQL my test bed is already prepared and I am suing MariaDB Galera. I will have 2 MySQL servers, synchronizing the databases in between them all the time. Each MySQL server will have Kamailio on it where Kamailio server 1 will use the MySQL on server 1; Kamailio server 2 will use the MySQL on server two. However, while the MySQL services will be up and running on both servers and so synchronized, Kamailio will run only on server 1 over the VIP address. Should it fail, the keepalived script will then kill local Kamailio instance and start the Kamailio on server 2 (the same it will do if the complete server fails). Please notice that this is crucial to prevent brain split where both Kamailios could "think" they were the master. As the databases will be synchronized the service interruption should be quite short.

Now, the VIP solution rely on a L2 connectivity in between (or amongst) involved servers and, to be really redundant, the servers should be geographically distant. So, if the above initial tests work, my next step will separating the two Kamailio servers using a L3 router and, using iproute2, create a VxLAN tunnel in between the 2 emulated remote sites. This would eliminate the need of buying a L2 extension in between the two involved datacenters.

While it solves the problem of a "small" system, if I were providing SIP services to the Internet my approach would be another one: I would have 2 Kamailios, using the same public IP address and use BGP to flip from one location to another. In this case there would be no Kamailio VIP interface but still I would use keepalived to monitor the services and drop the local BGP connection so forcing the Internet to reach my second server in another location. In this case your ISP would set their BGP local preference to reach your Kamailio to the main site; should the main site fails, BGP would use the second path to reach your server that, in fact, would be another Kamailio instance using the same IP of the main one. While this puts more complexity on the design, it would also prevent the brain split and the geographical distance limitation would be just how far your ISP could go.

If anyone is interested on this kind of techniques just drop into this thread and we keep the discussion going.

You could help me a lot responding to a question that I have regarding all this is: How Kamailio would behave if I have one active Kamailio writing in the database and a second "live" Kamailio using the same database but not receiving any connection/request. Would this jeopardize the way Kamailio works?

Cheers,
Moacir

To: sr-users at lists.sip-router.org
From: miconda at gmail.com
Date: Tue, 7 Jun 2016 09:01:23 +0200
Subject: Re: [SR-Users] High availability


  
    
  
  
    Just to mention that ucarp can be a very basic alternative to
      corosync/pacemaker to manage the virtual ip. A simple app, but
      usually keeps working...

    Cheers,

      Daniel

    

    

    On 06/06/16 02:21, Fred Posner wrote:

    
    
      
      If it's just 2 servers, consider as Juha said,
        corosync/pacemaker with drbd. 
      

      
      Fred Posner
        direct:
            +1 (224) 334-FRED (3733)
      
      

        On Jun 5, 2016, at 5:26 PM, Moacir Ferreira <moacirferreira at hotmail.com>
        wrote:

        

      
      
        
          
          Hi,

            

            Sorry... I should have mentioned before. You guys are
            thinking on the standard Internet SIP calls' behavior while
            I am trying to use Kamailio on a large "industrial" project.
            This said:

            

            Assuming that the end-point is "smart", the DNS method is
            functional but it would take quite a while before the UA
            (phone) recovers from the previous name/IP binding it has in
            cache;

            SRV is good for a "smart" UA that, unfortunately, is not the
            case;

            Same for the phone units as they are industrial "Help
            Points" and so quite "dummy".

            

            While I never tested it, I thought I could use two Kamailio
            servers with a mysql cluster like mariadb-galera where, for
            Kamailio functions, one server would be "active" and another
            "passive" server. Then use keepalived for monitoring the
            "active" Kamailio and starting the "passive" server if the
            active Kamailio fails. Without any testing, tests that I
            think I should have done before putting questions in here,
            my questions are:

            

            Suppose that  I have two Kamailio servers, one "active" and
            another one "passive" (not running) where the mysql
            databases are synchronized in between two servers using
            MySQL Galera. Using keepalived I would monitor the active
            Kamailio instance. Should it fails, start the "passive"
            Kamailio instance using the same MySQL database that were
            supposed to be synchronized. Would this new Kamailio
            instance be able to find a called number? Why this question?
            As long as I understand, Kamailio will always challenge the
            UA for authentication before making a call, so if this
            second server gets a call request it would just challenge
            and authenticate the caller. The "key point" would be having
            this new Kamailio instance aware about the called
            destinations. So, delivering a MySQL database, with the
            latest data the active Kamailio had, to this new Kamailio
            instance would be enough to allow it find the called party?

            

            Anyway, can you guys comment on my "thoughts"? Is it
            possible? Am I missing something? Would you suggest another
            approach for such scenario?

            

            Cheers!

            Moacir 

            

            
              Date: Sun, 5 Jun 2016 21:07:41 +0200

              From: chabert.loic.74 at gmail.com

              To: sr-users at lists.sip-router.org

              Subject: Re: [SR-Users] High availability

              

              Hello Bill,
              I have made kamailio ha using exabgp with
                loopbacks.
              Check https://github.com/Exa-Networks/exabgp
              With bgp, kamailio cluster can be splited on
                severals datacenters.
              Regards.
              Le 5 juin 2016 20:53, "Bill"
                <bill at novatrope.us>
                a écrit :

                
                   Hi Moacir

                    

                    We have only found three ways to handle failover.

                    1. Change the DNS entry whenever a failure is
                    detected.

                    2. Use SRV records to display an alternate route.

                    3. Use the failover mechanism in the phone itself

                    

                    1. works, but it may take some time for your ua's to
                    become aware of the change

                    2. never have been able to get this to work as
                    advertised.

                    3. Works pretty well depending on the phone. (We use
                    mostly Yealink's and they seem to handle the
                    failover pretty well.)

                    

                    Hope this helps

                    

                    On 06/05/2016 07:41 AM, Moacir Ferreira wrote:

                    
                    
                      Hi,

                        

                        I got two questions regarding high availability:

                        

                        1 - Should my Kamailio server fail, I would like
                        another Kamailio "box/server" to take over with
                        minimum services disruption. What is the
                        "community" advice for such environment?

                        

                        2 - Should my main PSTN gateway fail, what would
                        be the best mechanism to redirect calls to a
                        second PSTN gateway?

                        

                        Cheers!

                        Moacir

                      
                      

                      
                      

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

                    
                    

                  
                  

                  _______________________________________________

                  SIP Express Router (SER) and Kamailio (OpenSER) -
                  sr-users mailing list

                  sr-users at lists.sip-router.org

                  http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

                  

                
              
              

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

          SIP Express Router (SER) and Kamailio (OpenSER) -
            sr-users mailing list

          sr-users at lists.sip-router.org

          http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

        
      
      

      
      

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

    
    

    -- 
Daniel-Constantin Mierla
http://www.asipto.com - http://www.kamailio.org
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
  


_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users at lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20160607/2820ae43/attachment.html>


More information about the sr-users mailing list