OpenShift: How to connect to postgresql from my PC

匿名 (未验证) 提交于 2019-12-03 02:44:02

问题:

I have an openshift app, and I just installed a postgresql DB on the same cartridge.

I have the postgresql DB installed but now I want to connect to the DB from my PC so I can start creating new tables.

Using port forwarding I found my IP for the postgresql db to be

127.3.146.2:5432

under my webaccount I see my Database: txxx User: admixxx Password: xxxx

Then Using RazorSQl I try to setup a new connection

keeps coming as user password incorrect.

If I try and use the local IP to connect such as the 127.0.0.1 then I can connect fine.

How can I resolve this issue, all I am trying to do is connect to this DB so that I can create new tables.

回答1:

As shown below, after running the "rhc port-forward $appname" command, you would need to connect to the ip address of 127.0.0.1 and port that shows up next to it to connect to the service you want to reach, such as postgresql. In the below example, i would connect to 127.0.0.1, port 5432. If you already have something running locally on the postgresql port, it will select another port and display it in the table. But the connection will be forwarded to your openshift gear and postgresql on your gear.

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 

You can refer to the OpenShift Developer Portal for more information about using the PostgreSQL cartridge here: https://developers.openshift.com/en/databases-postgresql.html



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!