This is the first time using aws and linux.
I have setup a webserver with export MONGO_URL=mongodb://localhost:27017/app
and its works but when I separate my mongodb into another aws instance and changed the localhost to my mongodb instance private ip address its doesnt works anymore.
I use telnet private-ip-add 27017
from webserver and it shows Connection refused
I have also set security group inbound on mongodb instance
Custom TCP Rule TCP 27017 webserver-private-ip-add/31
Can anyone help me? Thanks!
Double-check the Security Group: Like you said, the EC2 instance must allow incoming TCP connections on port 27017 from either
10.0.0.90/32
), sg-0d91740cb
). Double-check the MongoDB config file: Option net.bindIp
must not be set to 127.0.0.1
but the local IP of your MongoDB EC2 instance. You could also bind to "everything" ( 0.0.0.0
), but this might be slightly less secure (eg if Security Groups are not set up properly).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.