(OpenShift)在App之间不再共享MongoDB了吗? [英] (OpenShift) Sharing MongoDB between Apps not possible anymore?

查看:72
本文介绍了(OpenShift)在App之间不再共享MongoDB了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在OpenShift本身以及在OpenShift上都有文章建议我可以使用MongoDB配置应用程序,然后在其他应用程序中设置envvar来访问该数据库

There are articles both here and over at OpenShift itself that suggest I can configure an app with a MongoDB and then set envvars within other apps to access that DB

例如

如何访问MongoDB数据库来自两个Openshift应用程序?

https://blog.openshift.com/sharing-database-across-应用程序/

问题是应用程序数据库的envvars/hostname是"localhost"或点分四进制(129.xxx.xxx.xxx),这显然不起作用(并且实际上不起作用-我尝试过)如果在另一个应用程序的连接字符串中使用(在同一OpenShift域"中

Problem is that the envvars/hostname for the app DB is either "localhost" or a dotted-quad (129.xxx.xxx.xxx) which clearly won't (and actually doesn't - I tried it) work if used in a connection-string from another app (in the same OpenShift 'domain'

OpenShift这样做是为了阻止这种用法吗?至少在免费"级别? -还是我想念某些东西/有人有这个自动取款机吗?

Is this something OpenShift have done to discourage this sort of usage? at least on the 'free' tier?? - or am I missing something/has anyone got this working atm???

p.s.使用应用程序的实际连接字符串(例如,app-domain.rhcloud.com)不起作用(即使来自内部托管"应用程序)

p.s. using the actual connection string for the app (e.g. app-domain.rhcloud.com) doesn't work (even from an 'internally hosted' app)

推荐答案

您需要创建可扩展的应用程序,然后添加MongoDB使其正常工作.然后,MongoDB将拥有自己的IP地址和端口号(请记住使用此端口号,否则将无法正常工作).

You need to create the application as scalable, then add MongoDB for it to work correctly. MongoDB will then go onto it's own gear, with it's own ip address and port number (remember to use this port number, or nothing will work).

如果不使用rhc port-forward命令(

You will never be able to access your mongodb gear from outside of openshift without using the rhc port-forward command (https://developers.openshift.com/en/managing-port-forwarding.html) because of firewall & other security issues.

但是,如果使用扩展应用程序方法,则可以从其他openshift在线托管应用程序连接到mongodb实例.

However, if you use the scaled application approach, you will be able to connect to your mongodb instance from other openshift online hosted applications.

这篇关于(OpenShift)在App之间不再共享MongoDB了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆