- A few requirements before we get started on the actual setup:
- This is for a two-node cluster.
- Each Node must have a static IP Address on the same subnet.
- Each Node must be licensed with a copy of FreePBX High Availability.
- Please see this wiki on installing licensed commercial modules. You need to install the High Availability module on each node of your system.
- Each Node must be installed with the FreePBX Distro version 5.211.65-1 or higher.
- You must pick the 'HA Install' option when building the nodes.
- You must pick the 'HA Install' option when building the nodes.
- You must prepare a 3rd IP Address on the same subnet. This will be allocated as the Floating IP Address.
- The Floating IP Address will be the IP that is routed to the active server automatically at any time.
- This is the IP Address for:
- Connecting phones
- Ports on your firewall for things like your SIP trunks or external phones
- Making Admin GUI changes on the PBX
- It's recommended that each node has 2 network connections. This is a recommendation but not a requirement.
- 1st Network (eth0) if your local network.
- 2nd Network (eth1) has a crossover cable between your 2 nodes for inter-node communication and syncing.
It is critical that the inter-machine connectivity has no firewall or filtering active on it. This should be as close to a raw network cable as your network infrastructure can achieve. Multicast and potentially non-IP traffic may be sent across that link. Any filtering, at all, can lead to unexpected and unrecoverable cluster failures.
It is very important that you log into the GUI of your master and slave boxes below using the static IP addresses of each box that you set them up with, and not a FQDN, or else your cluster setup will fail and you will need to start over by re-installing the ISO on the machine.
Update All Modules
From Admin, Module Admin, update all FreePBX modules to current on both nodes.
Setting up the Master Node
- The first thing you need to do is set up your Master Node. On your Master Node, click on the High Availability module under Settings.
- Since this will be your Master Node, choose the Create a new Cluster button.
- The system will run a pre-check to make sure the server has all the prerequisites to be added as an HA Node. Once all the checks pass, you'll be presented with a "Start Setup" button. Press the Start Setup button to continue with the setup of the Master Node.
- Provide the Floating IP Address that you want to be assigned to this cluster. Remember, this Floating IP Address needs to be a static IP address and on the same subnet as the nodes are on.
- Once you have typed in the IP Address, the installer will continue. In our example below, we have a dual network setup. We detected in our example, eth0, as the Public interface, meaning your Local LAN. Also, eth1 was detected as the Private Interface, which will have a crossover cable between the two nodes. The system will use 172.18.364.0 as the subnet on the Private Interface between the two nodes. You can press the Change Settings button if you need to change which network interfaces are used for Public versus Private, or press the Continue Setup button if you are happy with what was detected.
- You may see "This IP Address may not be routable." Due to a RedHat Bug, the machine may not be able to validate the IP address you've typed in (it will work the first time, but if you try it again, it'll error). You need to check that the IP Address you're typing in can be assigned to an interface on the host. This means that if you have your eth0 with an IP address of 192.168.15.10/24, you can only assign an IP address in the range 192.168.15.1 to 192.168.15.254.
- The Master Node will then prompt you with a final warning asking if you want to make this your Master Node. Click the Continue button to set this server up as a Clustered Node.
- The system will now set up of all the HA services and start moving files around.
- Once setup of HA services is complete, you'll be prompted to continue with the actual setup of final services. Click the Continue Setup button.
- You'll then be prompted that you will be redirected to the Floating IP to finalize the last stage of the Master Node setup. You may be prompted to login as your Admin user when redirected to the Floating IP. Click the Continue button.
- After you are redirected to the Floating IP that was set up earlier, you should see the following screen as it completes the last steps of your cluster setup:
- Once setup is complete, at the top of the screen you'll see your Master Node is online. Under DRBD it should show that all of the HA services, such as Asterisk, MySQL, and Apache are set up. You'll see errors about the Slave Node if you haven't joined that yet.
- We now need to go tell Asterisk to bind the SIP Listening to the floating IP address. Otherwise, Asterisk will have issues, since all traffic comes across the virtual interface and it won't know how to reply.
- Go to the Asterisk SIP Settings module in FreePBX (found under the Settings menu)
- Set the Bind Address to your floating IP
- Set the Bind Port to 5060
Joining the Slave Node
- After you have set up your Master Node, you'll need to join the Slave Node. On the Master Node, click on the "Click Here" link at the bottom to generate a cluster code.
- Copy the cluster code into your clipboard so you can paste it in the Slave Node.
- Log in to your Slave Node GUI and click on the High Availability module under Settings.
Since this is your Slave Server, click the Join a Cluster button.
The system will run a pre-check to make sure the server has all the prerequisites to be added as an HA Node. Once all the checks pass, you'll be presented with a text box where you can paste your cluster code from your Master server. Paste the cluster code into the text box.
The Slave Node will then prompt you with a final warning asking if you want to join this machine to your Master Node as a Slave. Please note, this process cannot be undone later. Click the Continue button to proceed.
The system will now begin the setup of all the HA services and start moving files around.
After setup is completed, your browser will be redirected to the Floating IP that was set up in step 1 for your Master server. You should see a screen showing both nodes are online at the top. Under DRBD it should show that all the HA services, such as Asterisk, MySQL, and Apache, are being synced from the Master to the Slave, and all the files on the Slave are becoming up-to-date with what is on the Master.
Before swapping the roles of the nodes, ensure that the replication has finished! Attempting to set a node to standby before it has finished replicating will break your cluster and require manual intervention to fix.
You have now completed setting up your Master and Slave Nodes. From this point forward, if you unplug your Master after everything has been synced, the Slave will take over the Floating IP Address and all the HA services listed above will be moved to the Slave. Once both systems are fully in sync you should see a screen like this:
Make sure to go to the System Admin Module and under Intrusion Detection whitelist the following:
- IP Address of PBX A
- IP Address of PBX B
- IP Address setup for Floating IP
- IP Address of internal PBX A
- IP Address of internal PBX B