gpt4 book ai didi

mysql - Kamailio MySql 到 redis

转载 作者:可可西里 更新时间:2023-11-01 11:36:50 45 4
gpt4 key购买 nike

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

最佳答案

从 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)

关于mysql - Kamailio MySql 到 redis,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31847918/

45 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com