OpenShift:如何从我的PC连接到postgresql

时间:2014-01-06 22:21:29

标签: postgresql openshift

我有一个openshift应用程序,我刚刚在同一个盒式磁带上安装了一个postgresql数据库。

我安装了postgresql数据库但现在我想从我的PC连接数据库,所以我可以开始创建新表了。

使用端口转发我发现postgresql db的IP为

127.3.146.2:5432

在我的网络帐户下,我看到了我的 数据库:txxx 用户:admixxx 密码:xxxx

然后使用RazorSQl我尝试设置新连接

因用户密码不正确而不断出现。

如果我尝试使用本地IP连接,例如127.0.0.1,那么我可以正常连接。

如何解决此问题,我要做的就是连接到此数据库以便我可以创建新表。

1 个答案:

答案 0 :(得分:31)

如下图所示,运行" rhc port-forward $ appname"命令,您需要连接到127.0.0.1的IP地址和旁边显示的端口以连接到您想要访问的服务,例如postgresql。在下面的示例中,我将连接到127.0.0.1,端口5432.如果您已在postgresql端口上本地运行某些内容,它将选择另一个端口并将其显示在表中。但是连接将被转发到你的装备上的openshift装备和postgresql。

Corey-Red-Hat:~ cdaley$ rhc port-forward rt2
Checking available ports ... done
Forwarding ports ...

To connect to a service running on OpenShift, use the Local address

Service    Local               OpenShift
---------- -------------- ---- ---------------
httpd      127.0.0.1:8080  =>  127.7.74.1:8080
postgresql 127.0.0.1:5432  =>  127.7.74.2:5432

Press CTRL-C to terminate port forwarding

有关在此处使用PostgreSQL盒式磁带的更多信息,请参阅OpenShift Developer Portal:https://developers.openshift.com/en/databases-postgresql.html

相关问题