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.
Prerequisites
In order to install VitalPBX in high availability you need the following:
a.- 3 IP addresses.
b.- Install VitalPBX Version 3.0 in two servers with similar characteristics.
c.- MariaDB Galera (include in VitalPBX 3).
d.- Corosync, Pacemaker, PCS and lsyncd.
Configurations
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
Name | Master | Stanby |
---|---|---|
Hostname | vitalpbx1.local | vitalpbx2.local |
IP Address | 192.168.10.61 | 192.168.10.62 |
Netmask | 255.255.255.0 | 255.255.255.0 |
Gateway | 192.168.10.1 | 192.168.10.1 |
Primary DNS | 8.8.8.8 | 8.8.8.8 |
Secondary DNS | 8.8.4.4 | 8.8.4.4 |
Installing the necessary software dependencies
Install the necessary dependencies on both servers
[root@vitalpbx1-2 ~]# yum -y install corosync pacemaker pcs lsyncd
Create authorization key for the access between the two servers without credentials
Server 1
[root@vitalpbx1 ~]# ssh-keygen -f /root/.ssh/id_rsa -t rsa -N '' >/dev/null
[root@vitalpbx1 ~]# ssh-copy-id root@192.168.10.62
Are you sure you want to continue connecting (yes/no)? yes
Server 2
[root@vitalpbx2 ~]# ssh-keygen -f /root/.ssh/id_rsa -t rsa -N '' >/dev/null
[root@vitalpbx2 ~]# ssh-copy-id root@192.168.10.61
Are you sure you want to continue connecting (yes/no)? yes
Script
Now copy and run the following script:
[root@vitalpbx1 ~]# mkdir /usr/share/vitalpbx/ha
[root@vitalpbx1 ~]# cd /usr/share/vitalpbx/ha
[root@vitalpbx1 ~]# wget https://raw.githubusercontent.com/VitalPBX/vitalpbx_ha/master/vpbxha.sh
[root@vitalpbx1 ~]# chmod +x vpbxha.sh
[root@vitalpbx1 ~]# ./vpbxha.s
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 ......... > 192.168.10.61
IP Standby ........ > 192.168.10.62
Floating IP ....... > 192.168.10.60
Floating IP Mask... > 24
hacluster password. > mypassword
Are you sure to continue with these settings? (yes,no) > yes
Now, reboot the Server 1 and wait for status change in Server 2.
[root@vitalpbx1 ~]# reboot
[root@vitalpbx2 ~]# role
Then reboot the Server 2, connect to Server 1 and wait for status change in Server 1.
[root@vitalpbx2 ~]# reboot
[root@vitalpbx1 ~]# role
Test
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 * * WARNING-WARNING-WARNING-WARNING-WARNING-WARNING-WARNING * *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) > yes
This action converts the vitalpbx1.local to Slave and vitalpbx2.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 Server 1, wait for the Server 1 to start and then turn on the Server 2.
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 192.168.10.60
2.- Update VitalPBX from the interface
3.- Execute the following command in Server 1 console
[root@vitalpbx1 ~]# bascul
4.- From your browser, go to the IP address 192.168.10.60 again
5.- Update VitalPBX from the interface
6.- Execute the following command in Server 1 console
[root@vitalpbx1 ~]# 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.
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.