Tuesday, 15 June 2010

Remote MongoDB on EC2 with Spring MVC -



Remote MongoDB on EC2 with Spring MVC -

i deploy mongodb on amazon ec2, set connection, open port 27017 ip address. bind_ip in mongodb.conf on ec2 set 0.0.0.0.

from local ip, web browser can assess remote mongodb admin @ address xxx.us-west-2.compute.amazonaws.com:28017

if access xxx.us-west-2.compute.amazonaws.com:27017 web browser, notification

"you trying access mongodb on native driver port. http diagnostic access, add together 1000 port number"

, indicating port permission opened right, think.

i tried wire spring mvc remote mongodb instead of localhost code:

@configuration public class springmongoconfig extends abstractmongoconfiguration { @override public string getdatabasename() { homecoming "db"; } @override @bean public mongo mongo() throws exception { homecoming new mongoclient("xxx.compute.amazonaws.com"); } }

when tested api postman plugin, response always:

exception": "org.springframework.dao.dataaccessresourcefailureexception", "message": "unable connect server matches anyserverselector{}; nested exception com.mongodb.mongoserverselectionexception: unable connect server matches anyserverselector{}",

i think deployed app not connect mongodb somehow. tried search not find answer. have idea?

regards

mongodb spring-mvc amazon-ec2 remote-access

No comments:

Post a Comment