Phoenix无法连接到Heroku';s PostgreSQL server
这是我在virginal Phoenix应用程序上看到的错误,我设置该应用程序是为了搞乱它: [错误]Postgrex.Protocol(#PID)无法连接:** (Postgrex.Error)致命28000(无效的\u授权\u规范):否 主机“24.25.201.68”的pg_hba.conf条目,用户“koilqmnaakvfjg”, 数据库“dc245o0vlbprf7”,SSL关闭 这是我的Phoenix无法连接到Heroku';s PostgreSQL server,postgresql,elixir,phoenix-framework,ecto,Postgresql,Elixir,Phoenix Framework,Ecto,这是我在virginal Phoenix应用程序上看到的错误,我设置该应用程序是为了搞乱它: [错误]Postgrex.Protocol(#PID)无法连接:** (Postgrex.Error)致命28000(无效的\u授权\u规范):否 主机“24.25.201.68”的pg_hba.conf条目,用户“koilqmnaakvfjg”, 数据库“dc245o0vlbprf7”,SSL关闭 这是我的配置/dev.exs: # Configure your database config :he
配置/dev.exs
:
# Configure your database
config :hello, Hello.Repo,
adapter: Ecto.Adapters.Postgres,
username: "koilqmnaakvfjg",
password: "somepass",
database: "dc245o0vlbprf7",
hostname: "ec2-54-243-54-6.compute-1.amazonaws.com",
pool_size: 10
我错过了一些简单的东西
编辑:
我的pg_hba.conf文件如下所示:
# TYPE DATABASE USER ADDRESS METHOD
host all all 0.0.0.0/0 md5
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
local replication all trust
host replication all 127.0.0.1/32 trust
host replication all ::1/128 trust
您需要将ssl参数设置为true,如果问题仍然存在,请修改pg_hba.conf文件 解决方案:
# Configure your database
config :hello, Hello.Repo,
adapter: Ecto.Adapters.Postgres,
username: "koilqmnaakvfjg",
password: "somepass",
database: "dc245o0vlbprf7",
hostname: "ec2-54-243-54-6.compute-1.amazonaws.com",
pool_size: 10,
ssl: true
希望能有帮助:D
告诉我进展如何
祝你好运 您应该允许从任何地方进行连接(或将其限制为
24.25.201.68
)在您位于54.243.54.6
@mudasobwa的postgres配置中,请参阅更新的问题w/pg_hba.conf大锤解决方案是将下面的行放在该文件的某个位置,然后重新启动postgres:主机dc245o0vlbprf7 koilqmnaakvfjg 0.0.0/0 password
@mudasobwa,但它不起作用。如果elixir应该连接到远程服务器,那么更新本地pg_hba的目的是什么?无论我如何旋转它,它似乎都不起作用。解决方法是不使用Heroku的postgres服务,而是替换另一个。在配置pg_hba.conf之后,我在我的应用程序中使用Heroku服务没有任何问题。我很高兴你解决了你的问题:DNo我不知道,配置看起来像这样并且工作完美:配置:test_rest,test.Repo,adapter:exto.Adapters.Postgres,用户名:“someusername”,密码:“somepassword”,数据库:“somedb”,主机名:“ec2-46-137-109-220.eu-west-1.compute.amazonaws.com”,池大小:10,ssl:trueThis修复了我的问题。Heroku现在在连接到PostgreSQL时需要SSL