change sqlite Switch db to another location

Status
Not open for further replies.

Baulder

New Member
Jul 17, 2017
18
1
3
Russia, Siberia
I defined /dev/shm/freeswitch and /dev/shm/freeswitch/db owned by www-data user in /etc/tmpfiles.d/freeswitch.conf:

d /dev/shm/freeswitch 0770 www-data www-data
d /dev/shm/freeswitch/db 0770 www-data www-data

and created this directories by "systemd-tmpfiles --create". After that I changed value "db" in Advanced - "Default Setting" of FusuonPBX for "Switch" section to /dev/shm/freeswitch/db. But FusionPBX and Freeswitch still writes sqlite db files to old /var/lib/freeswitch/db directory. I restarted freeswitch but it still write sqlite db files to old directory.

How can I change sqlite db files to another location?
 

Baulder

New Member
Jul 17, 2017
18
1
3
Russia, Siberia
I changed /etc/freeswitch/config.lua and restarted FreeSWITCH

database_dir = [[/dev/shm/freeswitch/db]];

But FusionPBX and Freeswitch still writes sqlite db files to old /var/lib/freeswitch/db directory.
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,044
565
113
Look in the GUI for db under advanced/default settings switch category.

Also be aware that the config.lua will be getting update multiple times and shouldn't be modified directly, your changes will be wiped out. Once you have made the change in the GUI, flush memcache and restart freeswitch.
 

Baulder

New Member
Jul 17, 2017
18
1
3
Russia, Siberia
I changed advanced/default settings switch category early as I said in first message. But FreeSWITCH still write sqlite db files to old directory.
 

Baulder

New Member
Jul 17, 2017
18
1
3
Russia, Siberia
Did you flush memcache and restart freeswitch?
Yes, I made it several times from web interface and by fs_cli "memcache flush" command. I found "db_dir" but not "db" variable by global_getvar command of fs_cli. And db_dir always contains "/var/lib/freeswitch/db" value when I change db var from web interface..

OK, I changed "db_dir" value from fs_cli, flushed memcace, but db files stores in /var/lib/freeswitch/db

Code:
freeswitch@fpbx> global_setvar db_dir=/dev/shm/freeswitch/db
+OK
freeswitch@fpbx> global_getvar db_dir
/dev/shm/freeswitch/db
freeswitch@fpbx> memcache flush
+OK
 

Baulder

New Member
Jul 17, 2017
18
1
3
Russia, Siberia
Are the permissions right on the freeswitch directory?
Yes:

Code:
ls -lR /dev/shm/
/dev/shm/:
drwxr-x--- 3 www-data www-data   60 Jul 24 17:15 freeswitch
-rw------- 1 postgres postgres 2316 Jul 18 14:18 PostgreSQL.1311893448

/dev/shm/freeswitch:
drwxr-x--- 2 www-data www-data 40 Jul 24 17:15 db

Can you test to change db location on your test lab??
 
Last edited:

bcmike

Active Member
Jun 7, 2018
326
54
28
53
I'm running into this as well. I did everything Baulder did as well but the DB still ends up in the default path.

I'm thinking about making /var/lib/freeswitch/db a soft link to my ramdsik, but my spidey sense is telling me that might be a very bad idea, needless to say kind of hackney.

Any ideas?
 

DigitalDaz

Administrator
Staff member
Sep 29, 2016
3,044
565
113
I don't know why you are messing with all this anyway.

All you have to do is add the following to /etc/fstab and reboot:
Code:
tmpfs /var/lib/freeswitch/db tmpfs defaults 0 0

Job done.
 

bcmike

Active Member
Jun 7, 2018
326
54
28
53
Cool,

Just didn't know exactly what the procedure was to get the DBs into ram and Baulders way seemed to make sense, but if that's all it takes I'm in.

Seems weird though that you can't change where the DBs reside.
 
Status
Not open for further replies.