[英]How to connect a database server running on local machine as a service to web application hosted on pivotal cloud foundry?
I am trying to test run a basic .NET web application on pivotal cloud foundry. 我试图测试在关键的云铸造厂上运行基本的.NET Web应用程序。 This web application uses as its database a MongoDB server hosted on my local machine.
该Web应用程序使用本地计算机上托管的MongoDB服务器作为其数据库。 At the moment I am limited to use of the cloud infrastructure by using just the Apps Manager.
目前,我仅限于仅使用Apps Manager使用云基础架构。
I have read the pivotal cloud foundry docs about user provided services, but cannot figure out as to how the connection is to be really made. 我已经阅读了有关用户提供的服务的关键的Cloud Foundry文档,但是无法弄清楚如何真正建立连接。 I have already come across various other ways like using MongoDB as a service (beta version), but at the moment I am not allowed access to the Operations Manager.
我已经遇到过各种其他方式,例如将MongoDB用作服务(测试版),但是目前不允许我访问Operations Manager。 Looking for an explanation on user provided services or how to implement the service broker API, specifically.
特别是在寻找有关用户提供的服务或如何实现服务代理API的说明。
I am new to Mongo as well, so any suggestion regarding making a connection through tweaking Mongo may help as well. 我也是Mongo的新手,因此有关通过调整Mongo建立连接的任何建议也可能会有所帮助。 Thanks
谢谢
The use case you describe (web app in PCF connecting to a resource in your local machine) is not recommended. 不建议使用您描述的用例(PCF中的Web应用程序连接到本地计算机中的资源)。
You can create a MongoDB instance for development purposes in PCF. 您可以在PCF中为开发目的创建MongoDB实例。
$ cf marketplace
...
mlab sandbox Fully managed MongoDB-as-a-Service
...
You can create a mlab
service and bind it to your application. 您可以创建一个
mlab
服务并将其绑定到您的应用程序。 You will then have a MongoDB instance in PCF that you can use for development purposes. 然后,您将在PCF中拥有一个MongoDB实例,您可以将其用于开发目的。
Edit: 编辑:
In that case a user provided service might help you, where you pass in your remote MongoDB instance configuration that you can read in your application. 在这种情况下,用户提供的服务可能会为您提供帮助,您可以在其中传递可在应用程序中读取的远程MongoDB实例配置。 eg:
例如:
cf.exe cups my-mongodb -p '{"key1":"value1","key2":"value2"}'
You can add your local mongo-db as a CUPS service to your PCF Dev. 您可以将本地mongo-db作为CUPS服务添加到PCF开发人员中。
Check out the following post. 查看以下帖子。 How to create a CUPS service for mongoDB?
如何为mongoDB创建CUPS服务?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.