When I use MongoChef to connect remote mongo database, I use next parameters:
Server
- Server: localhost
- Port: 27017
SSH Tunnel
SSH address: 10.1.0.90
Port: 25
SSH Username: username
SSH Password: password
When I connect with Pymongo, I have the next code:
import pymongo
MONGO_HOST = "10.1.0.90"
MONGO_PORT = 25
MONGO_DB = "db_name"
MONGO_USER = "username"
MONGO_PASS = "password"
con = pymongo.MongoClient(MONGO_HOST, MONGO_PORT)
db = con[MONGO_DB]
db.authenticate(MONGO_USER, MONGO_PASS)
print(db)
But I have the next error:
pymongo.errors.ServerSelectionTimeoutError: 10.1.2.84:27017: [Errno 111] Connection refused
Please, could you help me with this problem? What did I do wrong?