如何在没有rhc端口转发的情况下在OpenShift上访问MySQL? [英] how to access MySQL on OpenShift without rhc port forward?

查看:92
本文介绍了如何在没有rhc端口转发的情况下在OpenShift上访问MySQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们公司有一个Web服务器,并在OpenShift上创建一个MySQL服务器.

We have a Web Server in our company and create a MySQL Server on OpenShift.

我们需要使用Python来访问数据库服务器,而无需rhc端口转发,

We need to use Python to access the database server without rhc port forward,

我们可以通过其他方式直接在OpenShift上访问MySQL吗?

Can we have others way to access MySQL on OpenShift directly?

谢谢

推荐答案

您可以像访问OpenShift上没有的任何其他数据库一样直接访问齿轮.

You can access the gear directly just as you would any other Database not housed on OpenShift.

在创建MySQL盒式磁带时,您应该获得一个连接字符串:

When you created the MySQL cartridge you should have been given a connection string:

mysql://OPENSHIFT_DB_GEAR_DNS:OPENSHIFT_DB_PORT/...

您可以使用提供的连接字符串和身份验证来访问应用程序.

You can use that provided connection string and authentication to access the application.

注意:上面的这些字符串是齿轮上的环境变量,通常会转换为类似以下内容:

Note: These strings above are environment variables on the gear, and will typicaly translate to something like:

mysql://app-namespace.rhcloud.com:55582/

可以由其他应用程序从外部使用它来访问OpenShift上托管的数据库.

This can be used from outside of the gear by other applications to access the database that is hosted on OpenShift.

注意: OpenShift 论坛有很多涵盖了这个话题.

Note: The OpenShift forums have lots covering this topic.

这篇关于如何在没有rhc端口转发的情况下在OpenShift上访问MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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