Asterisk HA With Heartbeat And Systemd

Home » Asterisk Users » Asterisk HA With Heartbeat And Systemd
Asterisk Users 3 Comments


I’m setting up an active-passive Asterisk solution on Debian Jessie platforms. I’m using heartbeat package.

As I’m not yet familiar with either systemd or heartbeat, I’ve got a couple of questions:

1. At the moment, I’m using /usr/share/heartbeat/hb_standby or
/usr/share/heartbeat/hb_takeover scripts to both :
– allocate “floating” IP addresses to active server
– start/stop asterisk daemon.

Is this appropriate ? What would you recommand instead ?

2. My /etc/ha.d/haresources file contains:
machine1 asterisk

With this, I can see that asterisk daemon is correctly started and stopped when hb_standby/hb_takeover commands are typed but “service asterisk,status” is a bit misleading with:

service asterisk status
● asterisk.service – LSB: Asterisk PBX
Loaded: loaded (/etc/init.d/asterisk)
Active: active (exited) since lun. 2015-10-19 18:02:58 CEST; 41min ago
Process: 19576 ExecStop=/etc/init.d/asterisk stop (code=exited, status=0/SUCCESS)
Process: 19583 ExecStart=/etc/init.d/asterisk start (code=exited, status=0/SUCCESS)

How can I best improve this and configure heartbeat to use “service asterisk start/stop” ?


3 thoughts on - Asterisk HA With Heartbeat And Systemd

  • If you’re still in the planning stage, there’s a lot more to think about. Your Asterisk failure detection will be very simplistic (is the process dead). Synchronization of data – without risking synchronization of corrupt data to a peer. Prevent a deteriorating/failing peer corruption from corrupted the other peer (i.e. now shared resources). Awareness of upstream (e.g.: route/network) failures making the peer unavailable – and how to detect that. Etc. etc.

    Here’s a good checklist of things to consider in your design:

    If you are building a small/home office HA then the free version of commercial tools may be the way to go. If have a $0 budget but for a larger installation, use the design guide above to help figure out which compromises to make. (Heartbeat / Linux HA is better than nothing).


  • 2015-10-19 22:05 GMT+02:00 Telium Technical Support :

    Yes I read this document and found it very informative.

    I don’t think I’ll be able to detect Asterisk failures automatically so basically I’ll rely on a manual processes to either move from one server to the other or to sync configs (in fact, I’ll keep both configs as independant as possible to avoid one machine’s config to corrupt the other).

  • My machines have both a /usr/lib/ocf/resource.d/heartbeat/asterisk file
    (from resource-agents package, it seems). If I’m not mistaken, this file is not run when asterisk is started/stopped by hb_standby/hb_takeover commands (I added a touch /tmp/foobar line in
    /usr/lib/ocf/resource.d/heartbeat/asterisk to check this).

    How does this script compare with rc.debian.asterisk that can be found in contrib/init.d directory ?
    Is this file maintained by Asterisk community and closely following Asterisk evolution or is it rather independant from Asterisk development team ?
    What would you recommend on this subject ?

    2015-10-19 20:11 GMT+02:00 Olivier :