Mongos + Pymongo 2.5 ==>No suitable hosts found
Our application is using pymongo. I'm trying to connect to mongos. The code fails on the following line pymongo.MongoReplicaSetClient(ec2-aa-bbb-124-22.compute-1.amazonaws.com:27017, replicaSet=self.class_settings['mongo_rs']) Exception /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/.../server_tornado.py --config=conf/development.conf --port=9001 Traceback (most recent call last): File "/Users/..../server_tornado.py", line 319, in BaseCatalog.db_instance = DBInit(config=settings) File "/Users/..../lib/sc/singleton.py", line 20, in call cls._instances[cls] = super(Singleton, cls).call(*args, **kwargs) File "/Users/..../app/models/db_init.py", line 50, in init raise Exception("init() => " + str(err)) Exception: init() => No suitable hosts found Process finished with exit code 1`
Found the solution, if at all anyone faces this issue: Using MongoClient instead of MongoReplicaClient fixes the issue. This is because Mongos acts like a single instance of mongodb.
python motor mongo cursor length or peek next
PyMongo check if update succeeded
insert and query an OrderedDict in MongoHQ
Return .str of ObjectID using pymongo
Selecting the lowest/highest with find_one in Pymongo
Safe use of Pymongo's find_one
Pymongo $in + $regex
How can I get pymongo to always return str and not unicode?
SON Manipulator in mongo queries
How to append a document to a 2nd level embedded model list document in Django and mongoengine
pymongo multiple update $in
How to get negetive of a complex where clause in mongo db
pymongo justOne & multi
How to make pymongo's find() return a list?
convert pymongo cursor to json
How to do query on pymongo and get values in the reverse order of inserting