I am a new user and am trying to configure kamailio to use SQLITE instead of MYSQL. I see that SQLITE option is rather new and maybe not as documented as MYSQL.
I am running on fedora 14 and have installed MYSQL3 from rpms. Kamailio I built from sources because I need the SQLITE support.
What kamailio.cfg and kamctlrc parameters do I need to change to do this?
I have already set these in kamctlrc:
... ## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE # by default none is loaded # # If you want to setup a database with kamdbctl, you must at least specify # this parameter DBENGINE=SQLITE
## database host DBHOST=localhost
## database name (for ORACLE this is TNS name) # DBNAME=openser ...
and ran:
kamdbctl create openser
and
kamctl add user1 password1
successfully.
Now, it appears that I need to change kamailio.cfg for SQLITE. Can I simply edit this file substituting SQLITE for MYSQL and loading the SQLITE module?
How about this part:
... ####### Defined Values #########
# *** Value defines - IDs used later in config #!ifdef WITH_MYSQL # - database URL - used to connect to database server by modules such # as: auth_db, acc, usrloc, a.s.o. #!define DBURL "mysql://openser:openserrw@localhost/openser" #!endif ...
Will this URL work with SQLITE?
Thanks in advance,
Perazim
Hi,
On Thu, 09 Feb 2012 13:35:00 +0200 Perazim perazim@inbox.lt wrote:
I am a new user and am trying to configure kamailio to use SQLITE instead of MYSQL. I see that SQLITE option is rather new and maybe not as documented as MYSQL.
I am running on fedora 14 and have installed MYSQL3 from rpms. Kamailio I built from sources because I need the SQLITE support.
What kamailio.cfg and kamctlrc parameters do I need to change to do this?
I have already set these in kamctlrc:
... ## database host DBHOST=localhost
## database name (for ORACLE this is TNS name) # DBNAME=openser
These are ignored, as sqlite db is a local file.
To set the file, use: DB_PATH="/path/to/db.sqlite"
Now, it appears that I need to change kamailio.cfg for SQLITE. Can I simply edit this file substituting SQLITE for MYSQL and loading the SQLITE module?
How about this part:
... ####### Defined Values #########
# *** Value defines - IDs used later in config #!ifdef WITH_MYSQL # - database URL - used to connect to database server by modules such # as: auth_db, acc, usrloc, a.s.o. #!define DBURL "mysql://openser:openserrw@localhost/openser" #!endif ...
Will this URL work with SQLITE?
The sqlite URL is like: sqlite:////path/to/db.sqlite
Basically, it's your regular URL format, but the hostname needs to be left empty, and you include absolute path for the database file.
Permissions managements purely by setting proper file access rights.
- Timo
I got a little further but still not working. Here are changes I have made to default:
kamailio.cfg:
... # *** To enable mysql: #!define WITH_MYSQL # # *** To enable authentication execute: # - enable mysql #!define WITH_AUTH # - add users using 'kamctl' ...
... ####### Defined Values #########
# *** Value defines - IDs used later in config #!ifdef WITH_MYSQL # - database URL - used to connect to database server by modules such # as: auth_db, acc, usrloc, a.s.o. #!define DBURL "sqlite:////usr/local/etc/kamailio/db.sqlite" #!endif ...
... ####### Modules Section ########
# set paths to location of modules (to sources or installation folders) #!ifdef WITH_SRCPATH mpath="modules_k:modules" #!else mpath="/usr/local/lib/kamailio/modules_k/:/usr/local/lib/kamailio/modules/" #!endif
#!ifdef WITH_MYSQL loadmodule "db_sqlite.so" #!endif ...
and kamctlrc:
... ## your SIP domain SIP_DOMAIN=perazim.net
## chrooted directory # $CHROOT_DIR="/path/to/chrooted/directory"
## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE # by default none is loaded # # If you want to setup a database with kamdbctl, you must at least specify # this parameter DBENGINE=SQLITE
## database host # DBHOST=localhost ...
Still looks like kamailio is looking for mysql:
[root@travelmate yossi]# kamctl db show user psql: could not connect to server: Connection refused Is the server running on host "localhost" and accepting TCP/IP connections on port 5432? [root@travelmate yossi]#
I checked db.sqlite permissions and this should not be a problem.
Tried it with firewall disabled just in case.
What did I miss?
Thanks,
Perazim
Hello,
On 2/9/12 2:06 PM, Perazim wrote:
I got a little further but still not working. Here are changes I have made to default:
kamailio.cfg:
... # *** To enable mysql: #!define WITH_MYSQL # # *** To enable authentication execute: # - enable mysql #!define WITH_AUTH # - add users using 'kamctl' ...
... ####### Defined Values #########
# *** Value defines - IDs used later in config #!ifdef WITH_MYSQL # - database URL - used to connect to database server by modules such # as: auth_db, acc, usrloc, a.s.o. #!define DBURL "sqlite:////usr/local/etc/kamailio/db.sqlite" #!endif ...
... ####### Modules Section ########
# set paths to location of modules (to sources or installation folders) #!ifdef WITH_SRCPATH mpath="modules_k:modules" #!else mpath="/usr/local/lib/kamailio/modules_k/:/usr/local/lib/kamailio/modules/" #!endif
#!ifdef WITH_MYSQL loadmodule "db_sqlite.so" #!endif ...
and kamctlrc:
... ## your SIP domain SIP_DOMAIN=perazim.net
## chrooted directory # $CHROOT_DIR="/path/to/chrooted/directory"
## database type: MYSQL, PGSQL, ORACLE, DB_BERKELEY, DBTEXT, or SQLITE # by default none is loaded # # If you want to setup a database with kamdbctl, you must at least specify # this parameter DBENGINE=SQLITE
## database host # DBHOST=localhost ...
Still looks like kamailio is looking for mysql:
[root@travelmate yossi]# kamctl db show user psql: could not connect to server: Connection refused Is the server running on host "localhost" and accepting TCP/IP connections on port 5432? [root@travelmate yossi]#
I checked db.sqlite permissions and this should not be a problem.
Tried it with firewall disabled just in case.
What did I miss?
psql is for postgres, are you sure you set sqlite as db driver for kamctl (in kamctlrc)?
Cheers, Daniel