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

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
上一篇:3.11 - 3.12 A day with Google


下一篇:mapreduce程序调用各个类的功能