租了台阿里云的服务器想部署个博客 但我本机(自己用的电脑不是服务器)远程连接Mongodb连接不了 服务器本地的话是可以连接的
云服务器系统:Ubuntu 16.04 64位
mongodb.conf代码
dbpath=/data/MongoDB/blog
logpath=/data/MongoDB/log/mongodb.log
logappend = true
port=27017
fork=true
#bind_ip=127.0.0.1
远程连接报错信息
connecting to: mongodb://xx.xxx.xxx.x:27017/blog
2018-12-28T10:43:34.335+0800 E QUERY [js] Error: couldn't connect to server xx.xxx.xx.x:27017, connection attempt failed: NetworkTimeout: Error connecting to xx.xxx.xx.x:27017 :: caused by :: Socket operation timed out :
connect@src/mongo/shell/mongo.js:257:13
@(connect):1:6
exception: connect failed
看了网上的很多远程连接的方法 都试过了 但是只有本地能连接 改了配置文件服务也有重新启动
试试.然后我记得阿里云,默认是大部分端口不开放的,要安全组自己设置一下