关于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
posted @ 2019-03-12 10:24  娑婆迷徒  阅读(601)  评论(0编辑  收藏  举报