High availability redundancy failover: Difference between revisions

From VoIPmonitor.org
Jump to navigation Jump to search
(Created page with "VoIPmonitor supports full redundancy and seamlessly redundancy failover switch without loosing single CDR / recording file. VoIPmonitor is installed on two servers which are b...")
 
No edit summary
Line 1: Line 1:
VoIPmonitor supports full redundancy and seamlessly redundancy failover switch without loosing single CDR / recording file. VoIPmonitor is installed on two servers which are both connected to mirroring switch where each server receives the same SIP/RTP traffic. MySQL is configured to Master-Master replication. Active node activly writes CDR to database while the passive is running but CDR are turned off but still writing pcap files on disk. Once active node dies or switches to maintainance mode the secondary nodes takes a shared IP and activates writing to CDR database.  
VoIPmonitor supports full redundancy and seamlessly failover switch without loosing single CDR / recording file. VoIPmonitor is installed on two servers which are both connected to mirroring switch where each server receives the same SIP/RTP traffic. MySQL is configured to Master-Master replication. Active node activly writes CDR to database while the passive is running but CDR are turned off but still writing pcap files on disk. Once active node dies or switches to maintainance mode the secondary nodes takes a shared IP and activates writing to CDR database.  


This guide is for Debian 6  
This guide is for Debian 6  

Revision as of 17:44, 5 January 2013

VoIPmonitor supports full redundancy and seamlessly failover switch without loosing single CDR / recording file. VoIPmonitor is installed on two servers which are both connected to mirroring switch where each server receives the same SIP/RTP traffic. MySQL is configured to Master-Master replication. Active node activly writes CDR to database while the passive is running but CDR are turned off but still writing pcap files on disk. Once active node dies or switches to maintainance mode the secondary nodes takes a shared IP and activates writing to CDR database.

This guide is for Debian 6

topology

Node1 IP:10.0.0.1 
Node2 IP:10.0.0.2
Shared IP 10.0.0.128

Installing hearbeat

Installing HA

apt-get install heartbeat 

edit /etc/hosts

127.0.0.1       localhost
10.0.0.1   voipmonitor1
10.0.0.2   voipmonitor2

edit /etc/hostname to match voipmonitor1 and voipmonitor2

allow binding of shared ip adress by editing /etc/sysctl.conf adding the following line (lb1&lb2)

net.ipv4.ip_nonlocal_bind=1

run sysctl to activate changes

sysctl -p

generate file /etc/ha.d/authkeys on both nodes following content:

auth 3
3 md5 somerandomstring

set permissions

chmod 600 /etc/ha.d/authkeys

create file /etc/ha.d/ha.cf on both nodes

#
#       keepalive: how many seconds between heartbeats
#
keepalive 2
#
#       deadtime: seconds-to-declare-host-dead
#
deadtime 10
#
#       What UDP port to use for udp or ppp-udp communication?
#
udpport        694
bcast  eth0
mcast eth0 225.0.0.1 694 1 0
ucast eth0 10.0.0.2
#       What interfaces to heartbeat over?
udp     eth0
#
#       Facility to use for syslog()/logger (alternative to log/debugfile)
#
#logfacility     local0
#
#       Tell what machines are in the cluster
#       node    nodename ...    -- must match uname -n
node    voipmonitor1
node    voipmonitor2

on node2 change ucast eth0 10.0.0.2 to ucast eth0 10.0.0.1

on both nodes create file /etc/ha.d/haresources with the same exact content (do not be confused that the voipmonitor1 is also on node2 this in fact tells that voipmonitor1 is primary node)

voipmonitor1 10.0.0.128 voipmonitor

this harseources will activate IP 10.0.0.128 and runs voipmonitor script (it is run from left to right once the node becomes master). When the node becomes slave it will run the script from right to left with parametr stop)

Create file in /etc/ha.d/resource.d/voipmonitor

#!/bin/bash
#
# This script is inteded to be used as resource script by heartbeat
#
# May 2012 by Martin Vit
#
###

. /etc/ha.d/shellfuncs
case "$1" in
    start)
        echo "enablecdr" | nc localhost 5029 >/dev/null 2>/dev/null
        ;;
    stop)
        echo "disablecdr" | nc localhost 5029 >/dev/null 2>/dev/null
        ;;
    status)
        ;;
    *)
        echo "Usage: {start|stop|status}"
        exit 1
        ;;
esac
exit 0