<HTML><HEAD></HEAD>
<BODY dir=ltr>
<DIV dir=ltr>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: 'Calibri'; COLOR: #000000">
<DIV>Hi, some modules are not safe to use with mongodb, namely; acc (Cannot 
write to missed_call), msilo (Does not delete stored messages after sent), 
avpops(do not recall the issue with this one) and there may be others.</DIV>
<DIV>&nbsp;</DIV>
<DIV>To connect to the replica set (Minimum 3 replicas for proper master 
election):</DIV>
<DIV>All the modules (cachedb_mongodb.so, db_cachedb.so etc.) should point to 
the same db name in the xdb_url module parameter.</DIV>
<DIV>&nbsp;</DIV>
<DIV>loadmodule "cachedb_mongodb.so"</DIV>
<DIV>loadmodule "db_cachedb.so"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV>
<DIV>
<DIV>modparam("cachedb_mongodb", "cachedb_url","mongodb:replicaset1://<A 
style='href: "http://root:password@1.2.3.4:27017"'>root:password@1.2.3.4:27017</A>,<A 
style='href: "http://2.3.4.5:27017/jack.db.CallCenter_Info"'>2.3.4.5:27017,5<A 
style='href: "http://2.3.4.5:27017/jack.db.CallCenter_Info"'>.5.5.5:27017</A>,/jack.db.CallCenter_Info</A>")</DIV>
<DIV>modparam("db_cachedb","cachedb_url","mongodb:replicaset1://<A 
style='href: "http://root:password@1.2.3.4:27017"'>root:password@1.2.3.4:27017</A>,<A 
style='href: "http://2.3.4.5:27017/jack.db.CallCenter_Info"'>2.3.4.5:27017,5<A 
style='href: "http://2.3.4.5:27017/jack.db.CallCenter_Info"'>.5.5.5:27017</A>,/jack.db.CallCenter_Info</A>")</DIV></DIV>
<DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></DIV>
<DIV>loadmodule "usrloc.so"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV>
<DIV>
<DIV>modparam("usrloc", "db_url","mongodb:replicaset1://<A 
style='href: "http://root:password@1.2.3.4:27017"'>root:password@1.2.3.4:27017</A>,<A 
style='href: "http://2.3.4.5:27017/jack.db.CallCenter_Info"'>2.3.4.5:27017,5<A 
style='href: "http://2.3.4.5:27017/jack.db.CallCenter_Info"'>.5.5.5:27017</A>,/jack.db.CallCenter_Info</A>")</DIV>
<DIV>&nbsp;</DIV></DIV>
<DIV>Use the mongo slave_ok,1 parameter to read write via slaves.</DIV>
<DIV>&nbsp;</DIV>
<DIV>For the version table, you will need to create a copy in mongodb with the 
same name as the version table in mysql. Use the db_version_table= global 
parameter if you want to change the default name of the table. From mongo shell 
do this:</DIV>
<DIV>&nbsp;</DIV>
<DIV>use db</DIV>
<DIV>db.version.insert({ table_version : NumberInt(1009),&nbsp; table_name : 
"location"})</DIV>
<DIV>db.version.insert({ table_version : NumberInt(10),&nbsp; table_name : 
"dialog"})</DIV>
<DIV>
<DIV 
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'></DIV>
<DIV style="FONT: 10pt tahoma">
<DIV style="BACKGROUND: #f5f5f5">
<DIV style="font-color: black"><B>From:</B> <A title=spanda@3clogic.com 
href="mailto:spanda@3clogic.com">Sasmita Panda</A> </DIV>
<DIV><B>Sent:</B> Wednesday, June 01, 2016 6:17 AM</DIV>
<DIV><B>To:</B> <A title=users@lists.opensips.org 
href="mailto:users@lists.opensips.org">OpenSIPS users mailling list</A> </DIV>
<DIV><B>Subject:</B> [OpenSIPS-Users] Connecting to mongodb Replica set from 
opensips .</DIV></DIV></DIV>
<DIV>&nbsp;</DIV></DIV>
<DIV 
style='FONT-SIZE: small; TEXT-DECORATION: none; FONT-FAMILY: "Calibri"; FONT-WEIGHT: normal; COLOR: #000000; FONT-STYLE: normal; DISPLAY: inline'>
<DIV dir=ltr>HI Guys , 
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp; i am trying to use mongodb in replica set . I have 
tested my opensips-1.11 with a stand alone mongodb instance . Its working fine 
.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Now I am trying to connect to a 
replica set . But somehow I amnot able to do this . Opensips is getting 
connected to the replica set but its not able to run raw query .</DIV>
<DIV>&nbsp;</DIV>
<DIV>My opensips configuration is like bellow :</DIV>
<DIV>&nbsp;</DIV>
<DIV>loadmodule "cachedb_mongodb.so"</DIV>
<DIV>loadmodule "db_cachedb.so"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV>
<DIV>
<DIV>modparam("cachedb_mongodb", "cachedb_url","mongodb:replicaset1://<A 
href="http://root:password@1.2.3.4:27017">root:password@1.2.3.4:27017</A>,<A 
href="http://2.3.4.5:27017/jack.db.CallCenter_Info">2.3.4.5:27017/jack.db.CallCenter_Info</A>")</DIV>
<DIV>modparam("db_cachedb","cachedb_url","mongodb:replicaset1://<A 
href="http://root:password@1.2.3.4:27017">root:password@1.2.3.4:27017</A>,<A 
href="http://2.3.4.5:27017/jack.db.test">2.3.4.5:27017/jack.db.test</A>")</DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV>modparam("acc", "db_url", "cachedb://mongodb:replicaset1")</DIV>
<DIV>modparam("acc", "db_flag", 2)</DIV>
<DIV>modparam("acc", "log_flag", 2)</DIV>
<DIV>modparam("acc", "cdr_flag", 1)</DIV>
<DIV>modparam("acc", "log_facility", "LOG_LOCAL7")</DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>Opensips is not able to execute version check query for acc module .&nbsp; 
Bellow is the logs of opensips .</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp; INFO:cachedb_mongodb:mongo_new_connection: Connected at 
server <A href="http://52.71.216.67:27017">52.71.216.67:27017</A>,<A 
href="http://23.21.65.168:27017">23.21.65.168:27017</A> with version 3.0.12 , to 
db db.test</DIV>
<DIV>DBG:db_cachedb:db_cachedb_init: Succesfully initiated connection to 
[mongodb:replicaset1]</DIV>
<DIV>DBG:cachedb_mongodb:mongo_db_query_trans: Running raw mongo query on table 
db.my_version_table</DIV>
<DIV>ERROR:cachedb_mongodb:mongo_db_query_trans: Failed to run query. Err = 0, 0 
, 0</DIV>
<DIV>DBG:cachedb_mongodb:mongo_db_query_trans: Fetched key lastOp</DIV>
<DIV>DBG:cachedb_mongodb:mongo_db_query_trans: (unknown type 17)</DIV>
<DIV>DBG:cachedb_mongodb:mongo_db_query_trans: Fetched key connectionId</DIV>
<DIV>DBG:cachedb_mongodb:mongo_db_query_trans: (int) 516</DIV>
<DIV>DBG:cachedb_mongodb:mongo_db_query_trans: Fetched key n</DIV>
<DIV>DBG:cachedb_mongodb:mongo_db_query_trans: (int) 0</DIV>
<DIV>DBG:cachedb_mongodb:mongo_db_query_trans: Fetched key syncMillis</DIV>
<DIV>DBG:cachedb_mongodb:mongo_db_query_trans: (int) 0</DIV>
<DIV>DBG:core:wait_status_code: read code 0 ? rc = 0, errno=Success</DIV>
<DIV>INFO:core:daemonize: pre-daemon process exiting with -1</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In my mongodb instance there is some 
error printing also .</DIV>
<DIV>
<DIV>[initandlisten] connection accepted from <A 
href="http://104.131.6.7:35857">104.131.6.7:35857</A> #565 (7 connections now 
open)</DIV>
<DIV>2016-06-01T10:09:14.802+0000 I QUERY&nbsp;&nbsp;&nbsp; [conn565] assertion 
13 not authorized for query on db.my_version_table ns:db.my_version_table 
query:{ $query: { table_name: "acc" } }</DIV></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; By login through a remote machine with 
same username and password . I am able to execute all query manually . But why 
my opensips cant do this . If anybody have tried this can you suggest me any 
solution . What else I should do in my replica set or in opensips to make it 
happen ?</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp; Please help me . As I am quite new to mongodb 
replica set so not able to understand the actual problem also .</DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV>&nbsp;</DIV>
<DIV>
<DIV class=gmail_signature data-smartmail="gmail_signature">
<DIV dir=ltr><B><I>Thanks &amp; Regards</I></B> 
<DIV><I>Sasmita Panda</I></DIV>
<DIV><I>Network Testing and Software Engineer</I></DIV>
<DIV><I>3CLogic , ph:07827611765</I></DIV></DIV></DIV></DIV></DIV></DIV>
<P>
<HR>
_______________________________________________<BR>Users mailing 
list<BR>Users@lists.opensips.org<BR>http://lists.opensips.org/cgi-bin/mailman/listinfo/users<BR></DIV></DIV></DIV></BODY></HTML>