How to install VitalPBX on High Availability

VitalPBX Hight Availability Guide Ver2
Share on facebook
Share on twitter
Share on whatsapp
Share on telegram
Share on linkedin
Share on email

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.

Read our tutorials and guides on how to implement new tools and technologies for your business with VitalPBX here.



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
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
Update Settings
d.- Finally, we press the button:
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 to press the Check button.
Disable the DHCP option and set these values

IP Address192.168.30.10192.168.30.20
Primary DNS8.
Secondary DNS8.

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@vitalpbx-master ~]#  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)
Command (m for help): t
Partition number (1-4, default 4): 4 Hex code (type L to list all codes): 8e Changed type of partition 'Linux' to 'Linux LVM' Command (m for help): w [root@vitalpbx-master ~]# 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@vitalpbx-master ~]#  cd /
[root@vitalpbx-master ~]#  wget
[root@vitalpbx-master ~]#  chmod +x
[root@vitalpbx-master ~]#  ./

Set these values, remember the Floating IP Mask must be 2 digit format 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 vitalpbx-master.local
Master/Slave Set: DrbdDataClone [DrbdData]
      Masters: [ vitalpbx-master.local ]
      Slaves: [ vitalpbx-slave.local ]
DrbdFS (ocf::heartbeat:Filesystem): Started vitalpbx-master.local
mysql (ocf::heartbeat:mysql): Started vitalpbx-master.local
dahdi (service:dahdi): Started vitalpbx-master.local
asterisk (service:asterisk): Started vitalpbx-master.local
vpbx-monitor (service:vpbx-monitor): Started vitalpbx-master.local
fail2ban (service:fail2ban): Started vitalpbx-master.local
drbd0 role:Primary
      vitalpbx-slave.local role:Secondary

*        Before restarting the servers wait for drbd      *
*          to finish synchronizing the disks           *
*  Use the *drbdadm status* command to see its status *
*** Done ***

Now check if drbd has finished synchronizing the discs
[root@vitalpbx-master ~]# drbdadm status
drbd0 role:Primary
  vitalpbx2.local role:Secondary

[root@vitalpbx-master ~]#

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 server-master and wait for status change in server-slave.

[root@vitalpbx-master ~]# reboot

[root@vitalpbx-slave ~]# pcs status

Then reboot the server-slave, connect to server-master and wait for status change in server-master.

[root@vitalpbx-slave ~]# reboot

[root@vitalpbx-master ~]# pcs status


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

[root@vitalpbx1 /]# 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 converts the vitalpbx-master.local to Slave and vitalpbx-slave.local to Master. If you want to return to default do the same again.

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.

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

Update VitalPBX

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

[root@vitalpbx-master /]# bascul

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

[root@vitalpbx-master /]# bascul

Some Useful Commands

  • bascul, is used to change roles between high availability servers. If all is well, a confirmation question should appear if we wish to execute the action.
  • role, shows the status of the current server. If all is well you should return Masters or Slaves.
  • pcs resource refresh –full, to poll all resources even if the status is unknown, enter the following command.
  • pcs cluster unstandby host, in some cases the bascul command does not finish tilting, which causes one of the servers to be in standby (stop), with this command the state is restored to normal.
  • drbdadm status, shows the integrity status of the disks that are being shared between both servers in high availability. If for some reason the status of Connecting or Standalone returns to us, wait a while and if the state remains it is because there are synchronization problems between both servers and you should execute the drbdsplit command.
  • drbdsplit, solves DRBD split brain recovery.

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

Also available in GitHub

To see the step-by-step manual:
Manual step-by-step

Learn more about VitalPBX, our services and how we can help you achieve your goals in our official website.

Our Latest Post

VitalPBX Asterisk WebRTC with PJSip
Rodrigo Cuadra

Asterisk WebRTC con PJSip desde Cero

1.- Introducción WebRTC (Web Real-Time Communication) es un proyecto gratuito de código abierto que proporciona navegadores web y aplicaciones móviles con comunicaciones en tiempo real

Read More »

No comment yet, add your voice below!

Add a Comment

VitalPBX Logo

66 West Flagler Street
Suite 900 – #1957
Miami, FL 33130, USA

Phone: +1(305) 560-5776


Subscribe to our newsletter to receive updates and the latest news from VitalPBX

Copyright @ 2020 VitalPBX,  All rights reserved.