Replicating the switch database between two nodes

mdoupe

New Member
Mar 21, 2023
4
0
1
43
Hi all,

I've followed the member guide "Logical Replication - Multi-Master" the FusionPBX database to replicate the FusionPBX database between two hosts, but now I am trying to do the same for the switch database and am running into trouble. Is there any documentation on how to go about this, or a more manual version of the Logical Replication documentation that includes the steps that are normally automated?

Thanks!
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,059
575
113
We do not normally replicate the freeswitch database, just leave it running in RAM using sqlite.
 
  • Like
Reactions: markjcrane

markjcrane

Active Member
Staff member
Jul 22, 2018
496
177
43
49
The FreeSWITCH data is temporary if the replication gets behind by 5 minutes the data is useless. Replication takes more resources so what do you get for the ability to see registrations from two or more servers? There isn't a lot of benefit to this.

If you want to keep the call alive you have to use SIP with UDP but then you have to use UDP and can't use TCP or TLS. If the server goes down with TCP or TLS the protocol notices and ends the connection and the call.
 
Last edited:

mdoupe

New Member
Mar 21, 2023
4
0
1
43
Got it, thanks! I thought the switch data was more permanent.

Somewhat related, If I make a change on the current active FusionPBX server, like an extension change, how long does that change take to apply in the switch on the backup server? Is Fusion constantly monitoring for database changes?

Thanks very much!
 

markjcrane

Active Member
Staff member
Jul 22, 2018
496
177
43
49
There is a file cache in /var/cache/fusionpbx. To be efficient, this is not cleared by default. It's cleared when it's changed locally. You can do many things with this, including replicate it or delete it when it's older than a certain amount of time.
 

mdoupe

New Member
Mar 21, 2023
4
0
1
43
Alright, can you tell me if this is a bad plan? :)

I'm going to have an active/passive cluster with two servers in different datacenters. Failover is going to be handled by keepalived (which I have working already). Postgres DB is replicated as per the documentation. Config files and stuff will be replicated... somehow (still researching). I am going to have FusionPBX stopped on the passive server. When there is a failover keepalived will start fusion on the passive and stop it on the active. There will be a minute or two of downtime while the routing flips over and Fusion starts on the passive server, which is fine, and I think any active calls will be dropped, which is also fine.

If Fusion rebuilds the freeswitch database from scratch on start, I think this plan will work? Any criticisms?

Thanks very much for all of your help!
 

markjcrane

Active Member
Staff member
Jul 22, 2018
496
177
43
49
It seems alright mostly but make sure to keep PostgreSQL running for continued replication. And the config files don't change much so there the benefit on changing then depends on how much you change the configs. By default they aren't changed much. Most of FusionPBX is dynamically sending details to FreeSWITCH from the database and the file cache.