i have a test application running successfully using the node-mongodb native driver with the node.js and mongod running on the same instance. Now i am trying to get into production phase and have set up 2 separate ec2 instances 1 for node another for mongod in the same availability zone,
so far all the examples i have seen have the following form: (as mentioned on the native driver's github page)
var client = new Db('test', new Server("127.0.0.1", 27017, {}))
how should i open the db connection in my case? I would like to use ec2's private IP since it'll be faster (both my instances are in the same availability zone)
i have already set up 2 security groups in ec2: db and app and authorized app to go to db as mentioned here http://www.mongodb.org/display/DOCS/Amazon+EC2+Quickstart#AmazonEC2Quickstart-ConfigureStorage
You need to open the port, on the db server security group, to the app server security group on 27017 and change the ip from localhost to the internal ip for the db server. That should do it as far as EC2 is concerned.