Configuring Failover with 3CX
The Failover feature in 3CX Phone System allows you to create a replica of your PBX. In the event that your PBX fails, your replica PBX will become active minimizing downtime and data loss. Below are the steps required in order to activate this functionality.
- One FQDN. For this example we will use 3cx.contoso.com
- Two 3CX Phone System Version 14 or 15 installed on 2 separate machines in Split DNS Mode residing behind the same local lan nat device.
- Both Servers should each be installed with identical settings, including FQDN, SSL Certificate, SIP, Tunnel, web server ports and web server type.
Overview of how it works:
Step 1: Configure ACTIVE SERVER
- Go to Server 1. We will assume that this is your production server where 3CX Phone System V14 is already pre-installed, with a configuration on it.
- Go to Backup and restore > Location and configure the location where your backups will be stored.
- In this example we will store all backups in a folder named C:\Backups. If you have an FTP server you can configure FTP but storing them on the local server is easier and quicker.
- Click on Backup Schedule and configure what backup options you want to include in your backup and when the backup will be made. We recommend to do this daily during the night. In the above example, at midnight, a backup will start and the backup will be saved in C:\’Backups and will be named 3CXScheduledBackup.zip
- Create a batch script file using “robocopy” (included in windows) that simply gets the file named “3CXScheduledBackup.zip” from C:\Backups and moves it to a share on the passive machine example \\passiveserver\backups. A sample command is the following:
robocopy C:\Backups\ \\passiveServer\Backups "3CXScheduledBackup.zip"
- Create a scheduled task that launches this script 1 hour after the scheduled backup - example 1am.
- Go to Backup and restore and press “Failover”. Enable Failover and select Active.
Until now we have the Active machine automatically generating backups to C:\Backups and a script that moves this backup from the Active machine to a shared folder on the Passive machine. Now we need to configure the Passive machine to take this backup and automatically restore it in failover mode so that when failover occurs, the Passive machine already has the latest configuration and can elevate itself to Active.
Step 2: Configure PASSIVE SERVER
- Go to Server 2 and install 3CX Phone System
- Whilst on server 2 click on backup and restore > Failover
- Click on the checkbox “Enable Failover”
- Select the radio button “Passive”
- Next, in the Failover Settings section click the “Configure” button and configure scheduled restore.
- Enter the IP Address of the remote server (in this case this will be the Active server) - in this example 184.108.40.206
- Select which services you want to monitor: Sip Server, Webserver or Tunnel Server.
- Select the interval you want the heartbeat checks to be made, (default 15 seconds) and the behavior desired when the active service/s cannot be reached.
- You can configure 3rd party failover operations - a script can be run before and after failover occurs. In this example we loaded a pre-failover script that connects to a dns server and changes the A record to the passive IP Address. Also we have made a batch file that is triggered post failover to shut down the active machine in the case when 1 service failed only. You can find sample scripts here.
- After pressing OK, the Passive server will stop 3CX related services and will start monitoring the Active server. When a failover occurs and the active cannot be reached for any reason, the passive will run the failover scripts and take over pbx operations.