VitalPBX High Availability
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
VitalPBXHighAvailability.pdf VitalPBX High Availability Step-by-step Dec 2, 2018
bascul Update Jan 14, 2019

VitalPBX High Availability

High availability is a characteristic of a system which aims to ensure an agreed level of operational performance, usually uptime, for a higher than normal period.

Make a high-availability cluster out of any pair of VitalPBX servers. VitalPBX can detect a range of failures on one VitalPBX server and automatically transfer control to the other server, resulting in a telephony environment with minimal down time.




In order to install VitalPBX in high availability you need the following:
a.- 3 IP addresses.
b.- Install VitalPBX on two servers with similar characteristics.
c.- At the time of installation leave the largest amount of space on the hard drive to store the variable data on both servers.


We are going to start by installing VitalPBX on two servers

a.- When starting the installation go to:
INSTALLATION DESTINATION (Custom partitioning selected)
b.- Select: I will configure partitioning And press the button Done
c.- Select the root partition: / Change the capacity to: Desired Capacity: 20GB We need enough space for the operating system and its applications in the future; then click
Modify button Select disk and press the buttons Select Update Settings
d.- Finally, we press the button: Done And press the button Accept Changes

And continue with the installation.


We will configure in each server the IP address and the host name. Go to the web interface to: Admin>System Settinngs>Network Settings.
First change the Hostname, remember press the Check button.
Disable the DHCP option and set these values

Name Master Slave
Hostname vitalpbx1.local vitalpbx2.local
IP Address
Primary DNS
Secondary DNS

Create Disk

Now we connect through ssh to each of the servers.
a.- Initialize the partition to allocate the available space on the hard disk. Do these on both servers.

[root@vitalpbx1-2 ~]#  fdisk /dev/sda
Command (m for help): n
Select (default e): p
Selected partition x (take note of the assigned partition number as we will need it later) [Enter] [Enter] Command (m for help): w [root@vitalpbx1-2 ~]# reboot

Install Dependencies

Install the necessary dependencies on both servers

[root@vitalpbx1-2 ~]#  yum -y install drbd90-utils kmod-drbd90 corosync pacemaker pcs


Now copy and run the following script

[root@vitalpbx1 ~]#  cd /
[root@vitalpbx1 ~]#  wget
[root@vitalpbx1 ~]#  chmod +x
[root@vitalpbx1 ~]#  ./

Set these values, remember the Floating IP Mask must be 2 digit format (SIDR) and the Disk is that you created in the step “Create Disk”:

IP Master.......... >
IP Slave........... >
Floating IP........ >
Floating IP Mask... > 21
Disk (sdax)........ > sda4
hacluster password. > mypassword

Are you sure to continue with these settings? (yes,no) > yes

Are you sure you want to continue connecting (yes/no)? yes

root@'s password: The root password from Slave Server

At the end of the installation you have to see the following message

*                VitalPBX Cluster OK                       *
 virtual_ip     (ocf::heartbeat:IPaddr2):       Started vitalpbx1.local
 Master/Slave Set: DrbdDataClone [DrbdData]
     Masters: [ vitalpbx1.local ]
     Slaves: [ vitalpbx2.local ]
 DrbdFS (ocf::heartbeat:Filesystem):    Started vitalpbx1.local
 mysql  (ocf::heartbeat:mysql): Started vitalpbx1.local
 asterisk       (ocf::heartbeat:asterisk):      Started vitalpbx1.local
 fail2ban       (service:fail2ban):     Started vitalpbx1.local
 vpbx-monitor   (service:vpbx-monitor): Started vitalpbx1.local
*** Done ***

Now check if drbd has finished synchronizing the discs

[root@vitalpbx1 ~]# drbdadm status
drbd0 role:Primary
  vitalpbx2.local role:Secondary

[root@vitalpbx1 ~]#

If it shows the previous message it means that everything is fine and we can continue, otherwise we have to wait for it to finish synchronizing.

Now, reboot the server1 and wait for status change in server2.

[root@vitalpbx1 ~]# reboot

[root@vitalpbx2 ~]# pcs status

Then reboot the server2, connect to server1 and wait for status change in server1.

[root@vitalpbx2 ~]# reboot

[root@vitalpbx1 ~]# pcs status


To execute the process of changing the role, we recommend using the following command:

[root@vitalpbx1-2 /]# bascul
*     Change the roles of servers in high availability     *
*All calls in progress will be lost and the system will be *
*     be in an unavailable state for a few seconds.        *
Are you sure to switch from vitalpbx1.local to vitalpbx2.local? (yes,no) >

This action convert the vitalpbx1.local to Slave and vitalpbx2.local to Master. If you want to return to default do the same again.

Next we will show a short video how high availability works in VitalPBX

High Availability demo video on VitalPBX

Turn on and turn off

When you have to turn off the servers, when you turn it on always start with the Master, wait for the Master to start and then turn on the Slave

Sonata Switchboard

If you are going to install Sonata Switchboard we recommend you to execute the following commands in the Master

[root@vitalpbx1 ~]# systemctl stop switchboard
[root@vitalpbx1 ~]# systemctl disable switchboard
[root@vitalpbx1 ~]# pcs resource create switchboard service:switchboard op monitor interval=30s
[root@vitalpbx1 ~]# pcs cluster cib fs_cfg
[root@vitalpbx1 ~]# pcs cluster cib-push fs_cfg --config
[root@vitalpbx1 ~]# pcs -f fs_cfg constraint colocation add switchboard with virtual_ip INFINITY
[root@vitalpbx1 ~]# pcs -f fs_cfg constraint order asterisk then switchboard

and in the Slave

[root@vitalpbx2 ~]# systemctl stop switchboard
[root@vitalpbx2 ~]# systemctl disable switchboard


To update VitalPBX to the latest version just follow the following steps:
1.- From your browser, go to ip
2.- Update VitalPBX from the interface
3.- Execute the following command in Master console

[root@vitalpbx1 /]# bascul

4.- From your browser, go to ip again
5.- Update VitalPBX from the interface
6.- Execute the following command in Master console

[root@vitalpbx1 /]# bascul

CONGRATULATIONS, you have installed and tested the high availability in VitalPBX