[OpenSIPS-Users] Need some clarification in opensips cachedb_mongo db configutaion .

Sasmita Panda spanda at 3clogic.com
Wed Aug 24 13:36:53 UTC 2022


What exactly do I have?

I have a global cluster of DocumentDB (AWS service ) which is mongodb
compatible .

In the global cluster , the primary cluster is in us-east and the secondary
cluster is in us-west .

I have 2 connection strings for both clusters , primary.xyz.com pointed to
primary cluster , secondary.xyz.com pointed to secondary cluster (secondary
cluster only has read replicas) .

In opensips I have given both the domains like below .

modparam("usrloc",
"cachedb_url","mongodb//docdb:cccl0g1c@*primary.xyz.com:27017
<http://primary.xyz.com:27017>*,*secondary.xyz.com:27017
<http://secondary.xyz.com:27017>*
/opensipsDB.userlocation?&readPreference=secondaryPreferred&retryWrites=false")

whenever my primary cluster goes down and secondary is promoted to
primary , opensips throws an error of connection loss . Opensips at that
point also trying to connect to the *primary.xyz.com
<http://primary.xyz.com> *although that is down* .  *

*At this point , my expectation was , opensips must have automatically
detect the the older primary cluster was down and secondary was became
primary and work properly . *

*But its not happening . Once I restart the service its works fine . *






*Thanks & Regards*
*Sasmita Panda*
*Senior Network Testing and Software Engineer*
*3CLogic , ph:07827611765*


On Wed, Aug 24, 2022 at 3:30 PM Liviu Chircu <liviu at opensips.org> wrote:

> On 24.08.2022 11:56, Sasmita Panda wrote:
>
>
> Now my primary cluster goes down so my secondary cluster becomes primary .
> I have updated the connection string against the domain in route53 . Now
> *primary-cluster.xzy.com <http://primary-cluster.xzy.com>* is pointed to
> the new primary custer connection string .
>
> While creating a connection from the console through the mongo shell it's
> getting connected . But opensips is not able to switch the connecting
> string somehow . still it's trying to connect to the previous primary
> connection string .
>
> It seems like opensips has cached the connection string and is trying to
> connect to the same even after I have updated the string from the backend .
>
> libmongo will try each node in your CSV of nodes, there is no going around
> this.  Now, while your usage of two completely different clusters in the
> same connection string seems to be *non-conventional* (I don't recall any
> documentation advising this, all Mongo docs talk about connecting to either
> a *replica set*, or to a *list of* *mongos* servers), I still think it
> could work.  Maybe just configure the "connectionTimeousMS" parameters (or
> others??) and see if you can get libmongoc to time out faster on your 1st
> cluster, when it goes down.
>
> Best regards,
>
> --
> Liviu Chircuwww.twitter.com/liviuchircu | www.opensips-solutions.com
> OpenSIPS Summit 2022 Athens, Sep 27-30 | www.opensips.org/events
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20220824/c7f89f40/attachment.html>


More information about the Users mailing list