Accessing MongoDB from AppEngine app

2019-03-16 21:21发布

I have an app, written in Golang which works with MongoDB. I also have running VM instance of MongoDB, deployed with Click-to-deploy.

I can connect to external MongoDB instance, the app works locally, and on VM Instance on GAE, but NOT when started as appengine instance (i.e. via goapp deploy). In logs I see 'no reachable servers' error. I've double tested all network configuration and opened MongoDB port in my 'default' network.

I found some articles and posts that say you can't use MongoDB with appengine, and need to go with Datastore, but they all are quite old (like 2011/2012) and I can't find confirmation in AppEngine docs.

So the questions are:

  • can I use GAE-hosted MongoDB with my AppEngine application?
  • if yes, how can I debug this connectivity issue with appengine instances?

Thanks in advance.

1条回答
Root(大扎)
2楼-- · 2019-03-16 21:36

It seems that you can't use direct MongoDB connection from appengine app due to the restricted nature of appengine sandbox. From https://cloud.google.com/appengine/docs/managed-vms/: Network Access: Only via App Engine services (includes outbound sockets)

There are some possbilities to access MongoDB via HTTP REST interface, but it's not my case.

查看更多
登录 后发表回答