2013-05-27 222 views
4

我希望能够使用Putty从我的桌面连接到我的Heroku postgres(起重机)数据库。使用SSH(Putty)连接到Heroku Postgres

我最近从Webfaction转移到Heroku。在网站上,这是一个非常简单的过程(通过他们的文档:http://docs.webfaction.com/user-guide/databases.html#starting-an-ssh-tunnel-with-putty)。

Heroku让您使用heroku pg:credentials来获取您的数据库信息和凭证。这里显示:https://devcenter.heroku.com/articles/heroku-postgresql#external-connections-ingress。我似乎无法弄清楚如何通过使用此信息的Putty连接到数据库。

如果我尝试做一些事情,与Heroku的信息腻子给出了这样的错误:Disconnected: No supported authentication methods available.

+0

的Heroku提供数据库作为一种服务...不是您有本地访问权限的完整服务器。你可以用'heroku bash'完成非常有限的事情,但这就是它。如果您的动机是安全性,那么使用SSL;否则你可能需要在真实的VPS上运行Pg。 –

回答

0

的Heroku允许对数据库直接连接,没有用腻子或其他SSH客户端隧道到数据库服务器。

使用你的Heroku postgres凭证从命令行直接与psql连接。

3

Heroku监听与数据库的SSL连接,但没有提供shell帐户,正如使用Putty所需的那样。 他们说,在their doc

When you find yourself wanting SSH access, instead try using tools that properly accounts for Heroku’s distributed environment, such as the heroku command line tool and one-off dynos.

事实上,这与Webfaction其中明确规定对比,他们提供shell访问:

Full shell access to fast servers with all your favorite tools pre-installed and maintained for you.

不同的公司,不同的服务...

2

使用以下命令字面意思:heroku pg:psql DATABASE

这将匹配配置字符串DATABASE_URL并使用psql将您连接到数据库。

注意:您可能需要添加psql到PATH

在Mac OS,与Postgres的应用程序:

export PATH=/Applications/Postgres.app/Contents/MacOS/bin:$PATH