[SR-Users] ndb_mongodb, db_mongodb and replicasets
Kelvin Chua
kelchy at gmail.com
Tue Nov 17 12:32:31 CET 2015
awesome! db_mongodb works perfectly
but ndb_mongodb returns error
Nov 17 19:29:11 SG1-SIP kamailio: DEBUG: ndb_mongodb
[mongodb_client.c:155]: mongodbc_add_server(): added server[mgs1]=mongodb://
10.0.1.1
Nov 17 19:29:27 SG1-SIP /usr/local/sbin/kamailio[29970]: ERROR: ndb_mongodb
[mongodb_client.c:306]: mongodbc_exec_cmd(): Cursor failure: not master
it only adds the first host on the mongo uri, since it is not master,
refuses to insert it
Kelvin Chua
On Tue, Nov 17, 2015 at 4:20 PM, Daniel-Constantin Mierla <miconda at gmail.com
> wrote:
> Can you try with the patch from next commit?
>
>
> https://github.com/kamailio/kamailio/commit/4da5d898da9a0a8f2780dcdf864354098268a7e9
>
> If all runs ok, I will consider it for backporting.
>
> Cheers,
> Daniel
>
>
> On 17/11/15 08:37, Kelvin Chua wrote:
>
> wow i missed this due to a lot of connection logs in
> /var/log/mongodb/mongod.log
>
> 2015-11-16T09:56:47.675+0000 I QUERY [conn56345] assertion 16256
> Invalid ns
> [siptrace?replicaSet=rs0&slaveOk=true&readPreference=primaryPreferred.version]
> ns:siptrace?replicaSet=rs0&slaveOk=true&readPreference=primaryPreferred.version
> query:{ table_name: "sip_trace" }
>
> looks like the parameters are being appended to the db name
>
> Kelvin Chua
>
> On Mon, Nov 16, 2015 at 7:26 PM, Daniel-Constantin Mierla <
> <miconda at gmail.com>miconda at gmail.com> wrote:
>
>> Can you try with ndb_mongodb module?
>>
>> Is anything suspect in the logs of mongodb server?
>>
>> What is the version of mongodb-c-driver?
>>
>> Cheers,
>> Daniel
>>
>>
>> On 16/11/15 11:12, Kelvin Chua wrote:
>>
>> I also figured the code checks out, so i'm not sure where to look, there
>> is no error, just that queries return nothing
>>
>> If I point the mongo URI just to the primary node, I get this
>>
>> Nov 16 17:59:45 SG1-SIP /usr/local/sbin/kamailio[16451]: DEBUG:
>> db_mongodb [mongodb_connection.c:55]: db_mongodb_new_connection():
>> connection open to: mongodb://10.0.1.2/siptrace
>> Nov 16 17:59:45 SG1-SIP /usr/local/sbin/kamailio[16451]: DEBUG:
>> db_mongodb [mongodb_dbase.c:851]: db_mongodb_query(): query to collection
>> [version]
>> Nov 16 17:59:45 SG1-SIP /usr/local/sbin/kamailio[16451]: DEBUG:
>> db_mongodb [mongodb_dbase.c:885]: db_mongodb_query(): query filter: {
>> "table_name" : "sip_trace" }
>> Nov 16 17:59:45 SG1-SIP /usr/local/sbin/kamailio[16451]: DEBUG:
>> db_mongodb [mongodb_dbase.c:904]: db_mongodb_query(): columns filter: {
>> "table_version" : 1 }
>> Nov 16 17:59:45 SG1-SIP /usr/local/sbin/kamailio[16451]: DEBUG:
>> db_mongodb [mongodb_dbase.c:349]: db_mongodb_get_columns(): 1 columns
>> returned from the query
>> Nov 16 17:59:45 SG1-SIP /usr/local/sbin/kamailio[16451]: DEBUG:
>> db_mongodb [mongodb_dbase.c:377]: db_mongodb_get_columns(): Found a
>> field[0] named: table_version
>> Nov 16 17:59:45 SG1-SIP /usr/local/sbin/kamailio[16451]: DEBUG:
>> db_mongodb [mongodb_dbase.c:396]: db_mongodb_get_columns(): allocate 16
>> bytes for RES_NAMES[0] at 0x7f521bfb3ca8
>> Nov 16 17:59:45 SG1-SIP /usr/local/sbin/kamailio[16451]: DEBUG:
>> db_mongodb [mongodb_dbase.c:406]: db_mongodb_get_columns(): use DB1_INT
>> result type
>> Nov 16 17:59:45 SG1-SIP /usr/local/sbin/kamailio[16451]: DEBUG:
>> db_mongodb [mongodb_dbase.c:460]: db_mongodb_get_columns():
>> RES_NAMES(0x7f521bfb3ca8)[0]=[table_version] (16)
>> Nov 16 17:59:45 SG1-SIP /usr/local/sbin/kamailio[16451]: DEBUG:
>> db_mongodb [mongodb_dbase.c:671]: db_mongodb_convert_result(): selected
>> document: { "_id" : { "$oid" : "5642dec7775a1afd9ecc394e" },
>> "table_version" : 4 }
>>
>>
>> if i include a replicaset, this happens:
>>
>> Nov 16 17:56:47 SG1-SIP /usr/local/sbin/kamailio[16131]: DEBUG:
>> db_mongodb [mongodb_connection.c:55]: db_mongodb_new_connection():
>> connection open to: mongodb://10.0.1.1,10.0.1.2,
>> 10.0.1.3/siptrace?replicaSet=rs0&slaveOk=true&readPreference=primaryPreferred
>> Nov 16 17:56:47 SG1-SIP /usr/local/sbin/kamailio[16131]: DEBUG:
>> db_mongodb [mongodb_dbase.c:851]: db_mongodb_query(): query to collection
>> [version]
>> Nov 16 17:56:47 SG1-SIP /usr/local/sbin/kamailio[16131]: DEBUG:
>> db_mongodb [mongodb_dbase.c:885]: db_mongodb_query(): query filter: {
>> "table_name" : "sip_trace" }
>> Nov 16 17:56:47 SG1-SIP /usr/local/sbin/kamailio[16131]: DEBUG:
>> db_mongodb [mongodb_dbase.c:904]: db_mongodb_query(): columns filter: {
>> "table_version" : 1 }
>> Nov 16 17:56:47 SG1-SIP /usr/local/sbin/kamailio[16125]: DEBUG:
>> db_mongodb [mongodb_dbase.c:733]: db_mongodb_store_result(): no result from
>> mongodb
>> Nov 16 17:56:47 SG1-SIP /usr/local/sbin/kamailio[16126]: DEBUG:
>> db_mongodb [mongodb_dbase.c:733]: db_mongodb_store_result(): no result from
>> mongodb
>> Nov 16 17:56:47 SG1-SIP /usr/local/sbin/kamailio[16154]: DEBUG: <core>
>> [sr_module.c:897]: init_mod_child(): rank -2: ndb_mongodb
>> Nov 16 17:56:47 SG1-SIP /usr/local/sbin/kamailio[16128]: DEBUG:
>> db_mongodb [mongodb_dbase.c:733]: db_mongodb_store_result(): no result from
>> mongodb
>> Nov 16 17:56:47 SG1-SIP /usr/local/sbin/kamailio[16130]: DEBUG:
>> db_mongodb [mongodb_dbase.c:733]: db_mongodb_store_result(): no result from
>> mongodb
>> Nov 16 17:56:47 SG1-SIP /usr/local/sbin/kamailio[16131]: DEBUG:
>> db_mongodb [mongodb_dbase.c:733]: db_mongodb_store_result(): no result from
>> mongodb
>>
>>
>>
>>
>>
>> Kelvin Chua
>>
>> On Mon, Nov 16, 2015 at 5:39 PM, Daniel-Constantin Mierla <
>> miconda at gmail.com> wrote:
>>
>>> Quickly looking at the code, the ndb_mongodb should work with this kind
>>> of uri. Do you get any errors?
>>>
>>> Can you run with debug=3 and watch for log messages from ndb_mongodb
>>> containing '... added server ...'. Does it have the replica set uri there?
>>>
>>> Cheers,
>>> Daniel
>>>
>>>
>>> On 16/11/15 09:57, Kelvin Chua wrote:
>>>
>>> yes,
>>>
>>> for example:
>>>
>>> mongodb://10.0.1.1,10.0.1.2,
>>> 10.0.1.3/replicaSet=rs0&slaveOk=true&readPreference=primaryPreferred
>>>
>>> i tried this but it didn't work.
>>>
>>>
>>> according to mongoc documentation, this URI should be valid
>>>
>>> http://api.mongodb.org/c/1.2.1/mongoc_uri_t.html
>>>
>>>
>>>
>>> Kelvin Chua
>>>
>>> On Thu, Nov 12, 2015 at 3:53 PM, Daniel-Constantin Mierla <
>>> <miconda at gmail.com>miconda at gmail.com> wrote:
>>>
>>>> Is there a specific format of the url for this case?
>>>>
>>>> Cheers,
>>>> Daniel
>>>>
>>>>
>>>> On 11/11/15 11:41, Kelvin Chua wrote:
>>>>
>>>> anybody ever tried using a mongodb url with replicasets and parameters
>>>> to work
>>>> with kamailio?
>>>>
>>>> Kelvin Chua
>>>>
>>>>
>>>> _______________________________________________
>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users at lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>>
>>>>
>>>> --
>>>> Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>>> Book: SIP Routing With Kamailio - http://www.asipto.com
>>>> Kamailio Advanced Training, Nov 30-Dec 2, Berlin - http://asipto.com/kat
>>>>
>>>>
>>>> _______________________________________________
>>>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>>> sr-users at lists.sip-router.org
>>>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>>>
>>>>
>>>
>>> --
>>> Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>> Book: SIP Routing With Kamailio - http://www.asipto.com
>>> Kamailio Advanced Training, Nov 30-Dec 2, Berlin - http://asipto.com/kat
>>>
>>>
>>
>> --
>> Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>> Book: SIP Routing With Kamailio - http://www.asipto.com
>> Kamailio Advanced Training, Nov 30-Dec 2, Berlin - http://asipto.com/kat
>>
>>
>
> --
> Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
> Book: SIP Routing With Kamailio - http://www.asipto.com
> Kamailio Advanced Training, Nov 30-Dec 2, Berlin - http://asipto.com/kat
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20151117/4785b575/attachment.html>
More information about the sr-users
mailing list