Phoenix无法连接到Heroku的PostgreSQL服务器

时间:2018-05-01 04:27:53

标签: postgresql elixir phoenix-framework ecto

这是我在一个处女座凤凰应用程序中看到的错误,我已经设置了这个错误:

  

[错误] Postgrex.Protocol(#PID< 0.362.0>)无法连接:**   (Postgrex.Error)FATAL 28000(invalid_authorization_specification):不   主机“24.25.201.68”的pg_hba.conf条目,用户“koilqmnaakvfjg”,   数据库“dc245o0vlbprf7”,SSL关闭

这是我的config/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

1 个答案:

答案 0 :(得分:0)

您需要将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

告诉我如何发展;

祝你好运;