When Aliyun's ubuntu server deploys mongodb, it configures the file, but still cannot connect remotely.

I have rented an Aliyun server and want to deploy a blog, but I can connect to Mongodb remotely (my own computer is not a server). If I can"t connect to the server locally, I can connect to it

.

CVM system: Ubuntu 16.04 64-bit

mongodb.conf Code

dbpath=/data/MongoDB/blog
logpath=/data/MongoDB/log/mongodb.log
logappend = true
port=27017
fork=true
-sharpbind_ip=127.0.0.1

remote connection error message

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

I have seen many remote connection methods on the Internet, but only the local connection has been changed, the profile service has also been restarted

Mar.20,2022

bind_ip=0.0.0.0

try it. Then I remember Aliyun. By default, most ports are not open, so the security group should set it

.
Menu