I am using python and MongoClient from pmongo to connect to Remote mongodb , note that my local machine can ssh on the remote one using public key but whenever I try to connect to the db it timeouts
client = MongoClient('mongodb://ip/dataset?replicaSet=replica')
db = client.db_name
db['collection'].find({})
this will always timeout
pymongo.errors.ServerSelectionTimeoutError: ip:27017: timed out
import pymongo
url = "mongodb://ip/dataset?replicaSet=replica"
client = pymongo.MongoClient(url )
mongo = client.database
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.