i want to replace MySQL with redis database in kamalio. However, kamalio supports transactions with MySQL, ie saving data in MySql DB. While trying to run kamailio with redis, transactions are not happening. Is there any module that I have to enable in kamalio for No SQL database transaction support?
Asked
Active
Viewed 887 times
2 Answers
1
starting with kamailio v5.2 , you can opt for DB_REDIS Module which provides a DB APIv1 connector for the Redis server . https://kamailio.org/docs/modules/5.2.x/modules/db_redis.html
It can be used as a replacement for other database modules such as db_mysql and db_postgres.
By transaction support , I am assuming you are referring to dialog stoage support in redisdb. For this you need to define a specific schema like ,
hash_entry,hash_id,callid/string,from_uri/string,from_tag/string,to_uri/string,to_tag/string,caller_cseq/int,callee_cseq/int,caller_route_set/string,callee_route_set/string,caller_contact/string,callee_contact/string,caller_sock/int,callee_sock/int,state/string,start_time/timestamp,timeout/int,sflags/string,iflags/string,toroute_name/string,req_uri/string,xdata/string
Note , I have not tested it on running server as yet
loadmodule "db_redis.so"
..
#!define DBURL_DIALOG "redis://127.0.0.1:6379/1"
...
modparam("db_redis", "schema_path", "/usr/share/kamailio/db_redis/kamailio")
modparam("db_redis", "keys", "dialog=entry:hash_entry,hash_id,callid,from_uri,from_tag,to_uri,to_tag,caller_cseq,callee_cseq,caller_route_set,callee_route_set,caller_contact,callee_contact,caller_sock,callee_sock,state,start_time,timeout,sflags,iflags,toroute_name,req_uri,xdata")
...
modparam("dialog", "db_url", DBURL_DIALOG)
modparam("dialog", "db_mode", 1)

Altanai
- 1,323
- 1
- 19
- 33
-
modparam("db_redis", "keys", "dialog=entry:callid") modparam("db_redis", "keys", "dialog_vars=entry:hash_entry,hash_id,dialog_key") – Altanai Dec 02 '19 at 10:56
0
Of course you can enable NoSQL for Kamailio. Did you hear NDB_REDIS module? http://kamailio.org/docs/modules/3.2.x/modules/ndb_redis.html