node.js - How to connect mongodb to the application server? -
i have 2 ec2 instances running 1 application , other mongodb,
i have set mongodb instance follows:
1.)installed docker
2.)docker run -d -p 27017:27017 --name mongodb -v ~/data:/data/db mongo
3.)container created, checked mongod services started.
4.) connected mongo, docker run -it --link mongodb:mongo --rm mongo sh -c 'exec mongo "$mongo_port_27017_tcp_addr:$mongo_port_27017_tcp_port/mydatabase"'
after executing above command mongod shell started found uri mongod://xx.xxx.xx.xx:27017/mydatabase
5.)i have checked ec2 instace ip:27017 connects me mongodb.
question1: want connect application server running on different ec2 instance, have provided uri in config file present above, mongod://xx.xxx.xx.xx:27017/mydatabase when connecting app-server getting 502 bad gateway error.
how connect this? process correct?
Comments
Post a Comment