ruby-on-rails - heroku pg:psql 不工作 [连接被拒绝]
问题描述
我正在使用 Postgres 数据库在 Heroku 上运行 Ruby on Rails 应用程序。我曾经能够使用heroku pg:psql
命令从终端连接到我的数据库
最近,情况发生了变化。运行heroku pg:psql
命令后,我收到以下错误。
--> Connecting to postgresql-perpendicular-94363
psql: could not connect to server: Connection refused
Is the server running on host "ec2-23-23-130-158.compute-1.amazonaws.com" (23.23.130.158) and accepting
TCP/IP connections on port 5432?
我试图在网上搜索它,但没有找到任何有用的东西。
请帮忙。谢谢
解决方案
我刚刚尝试连接到您的数据库:
psql "dbname=postgresql-perpendicular-94363 host=ec2-23-23-130-158.compute-1.amazonaws.com user=test_user port=5432 sslmode=require"
我有:
psql: FATAL: password authentication failed for user "test_user"
因为,当然我不知道你的凭据:) 但是,连接似乎有效。我想,你忘了 set sslmode
。正如您在文档中看到的那样,它是必需的:
所有连接都需要 SSL:sslmode=require。
更新:
我检查了没有 的连接sslmode
,并且消息不是你的:
FATAL: no pg_hba.conf entry for host "31.42.24.63", user "test_user", database "postgresql-perpendicular-94363", SSL off
所以,我想这是你互联网连接的问题。检查你的防火墙设置。
推荐阅读
- java - 用于多种命名策略的 ObjectMapper
- ios - UIViewAnimation 的问题
- javascript - 修改后无法在规范中看到更新的 DOM
- javascript - 如何使用 javascript 和 document.querySelector 从 Discord 频道的最新帖子中提取文本?
- visual-studio-2012 - 从源代码管理中获取特定版本
- salesforce - 我是否需要安全令牌才能连接到 Salesforce API?
- javascript - 如何将值输入到 javascipt 的对象中?
- gerrit - 阻止直接推送到分支
- python - Linux:Python 无法下载 pip
- matlab - Matlab fwrite 精度转换