ubuntu - Cannot connect to MongoDB instance on AWS EC2 instance -
i have created mongodb instance on aws ec2 ubuntu instance.
mongodb running , when ssh machine , run mongodb mongod console, able create databases, confident running successfully.
however, not able gain access database local machine in browser.
i have changed bindip in /etc/mongod.conf 0.0.0.0, , have opened port 27017 executing sudo ufw allow 27017 browser still times out trying connect.
when try configure instance using mongod --config /etc/mongod.conf, error:
control [main] failed global initialization: filenotopen: failed open "/var/log/mongodb/mongod.log" this file exists! relevant portion of config file looks this:
systemlog: destination: file logappend: true path: /var/log/mongodb/mongod.log i have read have enable rest interface specifying --rest, don't know how since starting database service sudo service mongod start command.
my aws security settings looks this:
what missing?
you haven't specified mongodb version you're using, since you're showing yaml configuration, i'll assume it's 2.6 or later.
you can enable rest interface via mongodb.conf following (per https://docs.mongodb.com/v3.0/reference/configuration-options/):
net: http: enabled: true restinterfaceenabled: true according mongodb docs, rest interface (which deprecated in 3.2) listens on port 28017 (1000 + mongod port), have open firewall port.
also, recommend not opening db ports world (0.0.0.0). find laptop's ip (or router's ip assigned isp) , add instead.
your browser cannot connect (you didn't specify exact error) because mongodb doesn't use http or other browser protocol , browser doesn't know how to talk it. won't able browser rest interface enabled anyway. try getting mongo shell (make sure same version mongodb on server) on laptop , seeing if can connect port 27017 that.

Comments
Post a Comment