[OpenSIPS-Users] opensips with cachedb_mongodb .
Liviu Chircu
liviu at opensips.org
Wed Dec 9 15:53:44 EST 2020
Hi, Sasmita!
On 02.12.2020 11:19, Sasmita Panda wrote:
> Hi All ,
>
> I am using opensips-3.1 . I wanted to use the backend database as
> mongodb rather than mysql . I have tested dynamic routing , domain ,
> dialplan, auth_db thes modules with mongodb successfully without any
> error .
>
> I have tested usrloc module with " full-sharing-cachedb " ,
> "federated-cachedb-cluster" and "full-sharing-cluster" . Everything
> works perfectly fine .
You have no idea how happy (and proud) I am to hear that you had fun
playing with all of these toys. Congratulations!
>
> Now I am wondering . If I am running a single instance of opensips
> and for usrloc module I want to use cachedb_mongodb . Is that possible
> ? I have tried a lot but with no success .
I gave this some testing and it worked. The only tricky part is about
the inability to have a table named "version" in MongoDB, because it's a
restricted keyword. Fortunately, there is an OpenSIPS modparam which
has this covered (could we turn this into a meme?). See below examples,
my registrations got stored in Mongo easily:
------- opensips.cfg -------
db_version_table = "opensips_version"
loadmodule "usrloc.so"
modparam("usrloc", "working_mode_preset",
"single-instance-sql-write-through")
modparam("usrloc", "db_url", "cachedb://mongodb")
loadmodule "db_cachedb.so"
modparam("db_cachedb", "cachedb_url",
"mongodb://192.168.0.212/opensipsDB.location")
loadmodule "cachedb_mongodb.so"
-----------------------------
> use opensipsDB
switched to db opensipsDB
> db.location.find().pretty()
{
"_id" : ObjectId("5fd0f173fc095c0475046384"),
"contact_id" : NumberLong("2340957012558380938"),
"username" : "crina",
"contact" : "sip:73810946 at 127.0.0.1:59298",
"expires" : 1607528939,
"q" : -1,
"callid" : "1fba6d83-f564-4298-b879-5d07537634d9",
"cseq" : 3,
"flags" : 0,
"cflags" : "",
"user_agent" : "Blink 3.2.1 (Linux)",
"received" : null,
"path" : null,
"socket" : "udp:127.0.0.1:5060",
"methods" : null,
"last_modified" : ISODate("2020-12-09T15:47:59Z"),
"sip_instance" : "<urn:uuid:df6f1920-6259-42fe-912c-5fa9744497e6>",
"kv_store" : null,
"attr" : null
}
> db.opensips_version.find().pretty()
{
"_id" : ObjectId("5fd0f11884807b143c3a185b"),
"table_name" : "location",
"table_version" : 1013
}
Cheers,
--
Liviu Chircu
www.twitter.com/liviuchircu | www.opensips-solutions.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20201209/88afed1c/attachment.html>
More information about the Users
mailing list