0

我想用 kamalio 中的 redis 数据库替换 MySQL。但是,kamalio 支持与 MySQL 的事务,即将数据保存在 MySql DB 中。在尝试使用 redis 运行 kamailio 时,没有发生事务。是否必须在 kamalio 中启用任何模块才能支持无 SQL 数据库事务?

4

2 回答 2

1

从 kamailio v5.2 开始,您可以选择 DB_REDIS 模块,它为 Redis 服务器提供 DB APIv1 连接器。 https://kamailio.org/docs/modules/5.2.x/modules/db_redis.html

它可以用作其他数据库模块的替代品,例如 db_mysql 和 db_postgres。

通过事务支持,我假设您指的是 redisdb 中的对话框存储支持。为此,您需要定义一个特定的模式,例如,

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

注意,我还没有在正在运行的服务器上测试它

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)
于 2019-08-06T09:18:34.400 回答
0

当然,您可以为 Kamailio 启用 NoSQL。你听说过 NDB_REDIS 模块吗?http://kamailio.org/docs/modules/3.2.x/modules/ndb_redis.html

于 2016-03-26T08:08:25.063 回答