[Tutorial] Creating a two node FusionPBX cluster the easy way.

Status
Not open for further replies.

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,068
576
113
*****THIS SCRIPT NO LONGER WORKS WITH THE NEW 4.4 RELEASE*****

*****YOU NEED DEBIAN 8 FOR THIS AND POSTGRESQL 9.4 *****
*****MAKE SURE THE LOCALE IS THE SAME ON BOTH NODES *****

Locale can be checked by just typing the command: locale

As promised, follow the instructions EXACTLY. You should end up with a functioning two node cluster. I haven't integrated file synching for recordings, voicemails etc yet. There should be a tutorial to follow tomorrow on how to do that. In the meantime, enjoy!


This script will create a two server cluster with the minimum of input.

The script assumes you have two node with Debian 8 installed with systemd and ca-certificates.

It is almost as easy as a regular FusionPBX install.

Feedback, pull requests, suggestions and enhancements welcome.

If you are using PROXMOX with LXC containers please complete the procedure at the bottom of the page first.

On the slave we need to allow root SSH which is disabled by default on Debian 8. There will be a instructions to disable this again at the end if you wish to do so.

On the SLAVE node do the following:

Code:
sed -i 's/^PermitRootLogin .*/PermitRootLogin yes/g' /etc/ssh/sshd_config
service ssh restart
apt-get update && apt-get upgrade -y --force-yes

apt-get install -y --force-yes git

cd /usr/src
git clone -b stable http://git.directvoip.co.uk/digitaldaz/fusionpbx-sce-install

chmod 755 -R /usr/src/fusionpbx-sce-install
cd fusionpbx-sce-install/debian/

Now move to the MASTER node and do the following:

Code:
apt-get update && apt-get upgrade -y --force-yes

apt-get install -y --force-yes git sshpass

cd /usr/src
git clone -b stable http://git.directvoip.co.uk/digitaldaz/fusionpbx-sce-install

chmod 755 -R /usr/src/fusionpbx-sce-install
cd fusionpbx-sce-install/debian/

Run the following and follow the instructions onscreen:

Code:
./install.sh --masternode

You will be informed when installation is completed, once that is done, return to the SLAVE node and run:
Code:
cd /usr/src/fusionpbx-sce-install/debian
./install.sh
You will be informed on screen when the installation is completed.

If you wish to disable root password authentication by SSH run the following:

Code:
sed -i 's/^PermitRootLogin yes/PermitRootLogin without-password/g' /etc/ssh/sshd_config
service ssh restart

Debian on Proxmox LXC

If using Debian Jessie on Proxmox LXC containers please run the following BEFORE starting the FusionPBX install.
Code:
apt-get update && apt-get upgrade
apt-get install systemd
apt-get install systemd-sysv
apt-get install ca-certificates
reboot

For additional information to get started go to http://docs.fusionpbx.com/en/latest/getting_started.html

******* UPDATE 30/03/2017 *******

I have just updated and tested the script to deal with the postgres language problem. I'm also now going to delete any further posts. I want to try and keep the thread clean with only unaddressed issues.

Csync2 Tutorial now available.

Please only use this thread for problems with the installation. If you have a problem with using the resulting cluster, please open a separate thread, thanks
 
Last edited:

Tricom114

New Member
Mar 29, 2017
21
2
1
46
I am still getting errors on installation.

on the Slave
ERROR: could not open extension control file "/usr/share/postgresql/9.6/extension/bdr.control": No such file or directory
ERROR: could not open extension control file "/usr/share/postgresql/9.6/extension/bdr.control": No such file or directory
ERROR: schema "bdr" does not exist
LINE 1: SELECT bdr.bdr_group_join(local_node_name := 'node2_fusionpb...
^
ERROR: schema "bdr" does not exist
LINE 1: SELECT bdr.bdr_group_join(local_node_name := 'node2_freeswit...
^
ERROR: relation "bdr.bdr_nodes" does not exist
LINE 1: SELECT node_status FROM bdr.bdr_nodes WHERE node_name='node2...
^
ERROR: relation "bdr.bdr_nodes" does not exist
LINE 1: SELECT node_status FROM bdr.bdr_nodes WHERE node_name='node2...
^
Waiting for BDR sync.
ERROR: relation "bdr.bdr_nodes" does not exist
LINE 1: SELECT node_status FROM bdr.bdr_nodes WHERE node_name='node2...
^
Waiting for BDR sync.
ERROR: relation "bdr.bdr_nodes" does not exist
LINE 1: SELECT node_status FROM bdr.bdr_nodes WHERE node_name='node2...
^




and on the Master
INSERT 0 1
INSERT 0 1
ERROR: could not open extension control file "/usr/share/postgresql/9.6/extension/bdr.control": No such file or directory
ERROR: could not open extension control file "/usr/share/postgresql/9.6/extension/bdr.control": No such file or directory
ERROR: schema "bdr" does not exist
LINE 1: SELECT bdr.bdr_group_create(local_node_name := 'node1_fusion...
^
ERROR: schema "bdr" does not exist
LINE 1: SELECT bdr.bdr_group_create(local_node_name := 'node1_freesw...
^
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,068
576
113
I cannot understand why you are getting these errors, you should have postgres 9.4 NOT 9.6. You are using Debian? What do you have in your apt sources??
 

Tricom114

New Member
Mar 29, 2017
21
2
1
46
I am just starting with a fresh Debian 8.7 droplet from Digital Ocean and then a fresh install from fusionpbx. Nothing else.
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,068
576
113
look in /etc/apt/sources.list and the files in /etc/apt/sources.list.d
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,068
576
113
The file with this in needs to be gotten rid of: http://apt.postgresql.org jessie-pgdg/main Translation-en

When you say a fresh install from fusionpbx, I don't understand either, you do not follow any instructions from official, site right? Just exactly what is in this tutorial??
 

Tricom114

New Member
Mar 29, 2017
21
2
1
46
sources.list
deb http://mirrors.digitalocean.com/debian jessie main
deb-src http://mirrors.digitalocean.com/debian jessie main

deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main

# jessie-updates, previously known as 'volatile'
deb http://mirrors.digitalocean.com/debian jessie-updates main
deb-src http://mirrors.digitalocean.com/debian jessie-updates main

2ndquadrant.list
deb http://packages.2ndquadrant.com/bdr/apt/ jessie-2ndquadrant main

dotdeb.list
deb http://packages.dotdeb.org jessie all
deb-src http://packages.dotdeb.org jessie all

freeswitch.list
deb http://files.freeswitch.org/repo/deb/freeswitch-1.6/ jessie main

pgdg.list
deb http://apt.postgresql.org/pub/repos/apt/ jessie-pgdg main
 

Tricom114

New Member
Mar 29, 2017
21
2
1
46
Wait, I do apologise. Am I not to already have a copy of FusionPBX installed? I wasn't clear on that from the instructions.
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,068
576
113
No, the script installs EVERYTHING, completely clean Debian install is what you need. If you are using DO, just make sure ca-certificates is installed before you start.

apt-get install ca-certificates
 

Tricom114

New Member
Mar 29, 2017
21
2
1
46
Once set up, can I change the settings? What if I need to point the master to a new slave or change the root password?

I also tried setting my nodes up with a Round-robin DNS as a load balancer; however, extensions registered on different nodes can not call each other or transfer calls.
 
Last edited:

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,068
576
113
This is not a load balancing setup, it is failover. There isn't any working load balancing I am aware of for FusionPBX that does not involve Kamailio.

What you can do once installed depends entirely upon your skill level.
 

VoIP Doctors

New Member
May 3, 2017
14
0
1
44
Excellent. This made a project I was working on go very smoothly for the bulk of the install.

Thank you.

Currently I have this running in a load balanced (well SRV Records) setup, and it's running very nicely; everything works as one would expect; except a call on nodeA does not display in the Active Calls and Operator Panel (GUI) for nodeB and vice versa.

Interestingly in the calls table of the fusionpbx DB on both servers, the active calls show correctly.

The registration page correctly shows the current server each phone is registered to.

Any ideas on getting the Active Calls and Operator Panel to show the calls regardless of the server they are occurring on?
 
Last edited:

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,068
576
113
You would need to replicate the freeswitch database too and move it from sqlite to postgres. I deliberately avoided going down this route as load balanced fusionpbx just does not work correctly, I use this type of clustering for failover only.

Blind transfer, parking, conferencing and queueing are just a few things that do not work in a load balanced setup.When you consider that if one server fails, then it has to carry the load of the two anyway then why bother to try and balance them? Another thing you will need to do if set up memcached syncing across servers and start bringing fs_path into the equation. IMHO, just not worth it for a two node setup, especially as the end result is going to be an only partially working system. Using SRV in failover mode works just fine.

For 2+ nodes then I use Kamailio and do per domain load balancing across the cluster which then allows for full functionality.
 

vcChris

New Member
May 13, 2017
2
0
1
44
Just wanted to say thanks for putting this up. I hope you do another video like this with setting up multiple boxes with Kamailio! Nothing makes my eyes glaze over more than looking at kamailio configs.
 

vcChris

New Member
May 13, 2017
2
0
1
44
Better googling skills apparently. I'll check it out, it was more of a thanks for taking the time to explain this out in such detail.
 

Matthew Main

Member
Jan 24, 2017
92
6
8
40
I am seeing an issue with registrations on pbx1l, the phones are registering for a short amount of time, then failing to register on with "408 times out" the trying pbx2 and registering, the cycle keeps repeating. I thought it was an issue with the way I upgraded the system, but this is a free install done this morning. All records are Naptr and SRV as you showed me on the first build.

v4.2.2 Switch ver 1.6.17 ( 64 bit)

upload_2017-6-7_23-2-21.png

any help would be apriciated.
 
Status
Not open for further replies.