I am connecting to a remote server's port 27017 using ssh and then accessing the mongo database on that system. I can successfully connect it via the shell script. However, when I write a python program and try to connect to that system, I am not able to connect. I use the following piece of code:
conn = MongoClient('mongodb://username:password@hostname:27017/database')
I would want to mention that I am accessing the destination system behind a proxy. However, the port 27017 is enabled for my system to connect to the destination system.
conn = MongoClient('mongodb://username:password@hostname:27017/database')
您的主机名是27017
但是您启用的端口是27107
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.