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.

To connect to the replica set (Minimum 3 replicas for proper master election):
All the modules (cachedb_mongodb.so, db_cachedb.so etc.) should point to the 
same db name in the xdb_url module parameter.

loadmodule "cachedb_mongodb.so"
loadmodule "db_cachedb.so"      
modparam("cachedb_mongodb", 
"cachedb_url","mongodb:replicaset1://root:[email protected]:27017,2.3.4.5:27017,5.5.5.5:27017,/jack.db.CallCenter_Info")
modparam("db_cachedb","cachedb_url","mongodb:replicaset1://root:[email protected]:27017,2.3.4.5:27017,5.5.5.5:27017,/jack.db.CallCenter_Info")


loadmodule "usrloc.so"      
modparam("usrloc", 
"db_url","mongodb:replicaset1://root:[email protected]:27017,2.3.4.5:27017,5.5.5.5:27017,/jack.db.CallCenter_Info")

Use the mongo slave_ok,1 parameter to read write via slaves.

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:

use db
db.version.insert({ table_version : NumberInt(1009),  table_name : "location"})
db.version.insert({ table_version : NumberInt(10),  table_name : "dialog"})
From: Sasmita Panda 
Sent: Wednesday, June 01, 2016 6:17 AM
To: OpenSIPS users mailling list 
Subject: [OpenSIPS-Users] Connecting to mongodb Replica set from opensips .

HI Guys , 

     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 .

       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 .

My opensips configuration is like bellow :

loadmodule "cachedb_mongodb.so"
loadmodule "db_cachedb.so"      
modparam("cachedb_mongodb", 
"cachedb_url","mongodb:replicaset1://root:[email protected]:27017,2.3.4.5:27017/jack.db.CallCenter_Info")
modparam("db_cachedb","cachedb_url","mongodb:replicaset1://root:[email protected]:27017,2.3.4.5:27017/jack.db.test")

modparam("acc", "db_url", "cachedb://mongodb:replicaset1")
modparam("acc", "db_flag", 2)
modparam("acc", "log_flag", 2)
modparam("acc", "cdr_flag", 1)
modparam("acc", "log_facility", "LOG_LOCAL7")


Opensips is not able to execute version check query for acc module .  Bellow is 
the logs of opensips .

    INFO:cachedb_mongodb:mongo_new_connection: Connected at server 
52.71.216.67:27017,23.21.65.168:27017 with version 3.0.12 , to db db.test
DBG:db_cachedb:db_cachedb_init: Succesfully initiated connection to 
[mongodb:replicaset1]
DBG:cachedb_mongodb:mongo_db_query_trans: Running raw mongo query on table 
db.my_version_table
ERROR:cachedb_mongodb:mongo_db_query_trans: Failed to run query. Err = 0, 0 , 0
DBG:cachedb_mongodb:mongo_db_query_trans: Fetched key lastOp
DBG:cachedb_mongodb:mongo_db_query_trans: (unknown type 17)
DBG:cachedb_mongodb:mongo_db_query_trans: Fetched key connectionId
DBG:cachedb_mongodb:mongo_db_query_trans: (int) 516
DBG:cachedb_mongodb:mongo_db_query_trans: Fetched key n
DBG:cachedb_mongodb:mongo_db_query_trans: (int) 0
DBG:cachedb_mongodb:mongo_db_query_trans: Fetched key syncMillis
DBG:cachedb_mongodb:mongo_db_query_trans: (int) 0
DBG:core:wait_status_code: read code 0 ? rc = 0, errno=Success
INFO:core:daemonize: pre-daemon process exiting with -1


       In my mongodb instance there is some error printing also .
[initandlisten] connection accepted from 104.131.6.7:35857 #565 (7 connections 
now open)
2016-06-01T10:09:14.802+0000 I QUERY    [conn565] assertion 13 not authorized 
for query on db.my_version_table ns:db.my_version_table query:{ $query: { 
table_name: "acc" } }

       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 ?

     Please help me . As I am quite new to mongodb replica set so not able to 
understand the actual problem also .


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


--------------------------------------------------------------------------------
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to