关于python3链接虚拟机MongoDB 遇到的问题总结

python

pymongo.errors.ServerSelectionTimeoutError: 192.168.12.230:27017: [Errno 61] Connection refused

1.如果是链接虚拟机中的Mongodb时,打开配置文件mongod.conf。

vi /etc/mongod.conf

2.修改配置参数

找到

net:

port: 27017

bindIp: 127.0.0.1 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.

修改:

net:

port: 27017

bindIp: 0.0.0.0 # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.

3.重启mongdb

service mongod restart

以上是 关于python3链接虚拟机MongoDB 遇到的问题总结 的全部内容, 来源链接: utcz.com/z/388579.html

回到顶部