Moving Core Database to PostgreSQL

Status
Not open for further replies.

JamesW

New Member
Oct 20, 2017
2
0
1
35
Hi

I'm creating a fusionPBX setup and I've been able to reconfigure FusionPBX in the config.php and config.lua to use a separate PostgreSQL server and this works fine. Now I want to do the same with FreeSWITCH's core databases.

I've amended the switch.conf.xml to have the following

<param name="core-db-dsn" value="pgsql://hostaddr=10.4.1.9 port=5432 dbname=freeswitch user=fusionpbx password=XXXXX" />

Which uses the same user as fusionPBX and has all relevant permission to the freeswitch db on that server.

I've also marked the db setting in fusionPBXs Advanced>Default Settings to false to see if it gets picked up.

But it doesn't seem to have worked, and FreeSWITCH continues to use the local sqlite db for this.

Am I approaching this wrong or have I missed a setting to get this working?

Thanks in advance.
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,044
565
113
There are a few other things you may need to do first for example, delete the old core.db sqlite file, if fusionpbx finds it there it will use that despite the settings being there for postgres.

Also, do you have sound reason for wanting to use postgres for the freeswitch db? The reason I ask that is, in general, you will get the best performance by leaving it in sqlite but moving it into tmpfs ie RAM.
 

JamesW

New Member
Oct 20, 2017
2
0
1
35
Thanks for the advice, I've moved the core.db file, but freeswitch appears to just recreate it.

I've checked in the freeswitch.xml.fsxml and I can see that entries for <configuration name="switch.conf" description="Core Configuration"> twice in the file, as though 2 versions of the config are being loaded. Is that normal?

I should probably explain that I'm looking to move to a separate postgreSQL server for HA and failover options, not the performance improvement of moving to RAM. I could have posted this in the HA section of the forum but at this point I am only testing with 1 fusion server so posted here.
 

smn

Member
Jul 18, 2017
201
20
18
Did you create the DB and add the permission? When you restart freeswitch the DB should get populated.

Code:
sudo -u postgres psql -c "CREATE DATABASE freeswitch;"
sudo -u postgres psql -c "GRANT ALL PRIVILEGES ON DATABASE freeswitch to fusionpbx;"
 

mjoubert

New Member
Apr 4, 2018
5
0
1
41
smn - yes. the freeswitch db is also bdr replicating. i'm clearly missing a step. core.db continues to recreate (though I'm deleting it) after a freeswitch restart
ninja edit: https://freeswitch.org/confluence/display/FREESWITCH/PostgreSQL+in+the+core says :
host vs hostaddr

'hostaddr' ONLY takes a numeric ip address and will not resolve a hostname. Use 'host' for a DNS hostname. If you specify both 'host' and 'hostaddr' settings, 'hostaddr' takes precedence.


i changed localhost to 127.0.0.1 - and it worked.
 
Last edited:

kp123

New Member
Feb 6, 2017
19
1
3
43
When move db freeswitch to ram then adding the following to the end of /etc/fstab : example
1. tmpfs /var/lib/freeswitch/db tmpfs defaults,size=4g 0 0
-> group, owner : root
or
2. tmpfs /var/lib/freeswitch/db/ tmpfs mode=777,gid=www-data,uid=www-data,size=4g 0 0
-> group, owner : www-data
1 or 2 : correct?
 

ricofranco

New Member
Jun 8, 2018
10
0
1
45
When move db freeswitch to ram then adding the following to the end of /etc/fstab : example
1. tmpfs /var/lib/freeswitch/db tmpfs defaults,size=4g 0 0
-> group, owner : root
or
2. tmpfs /var/lib/freeswitch/db/ tmpfs mode=777,gid=www-data,uid=www-data,size=4g 0 0
-> group, owner : www-data
1 or 2 : correct?
Hello did you find the rigth answer ? If yes can you share with us ?
 
Status
Not open for further replies.