2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

:nxdomainのエラーをなんとかしたときの備忘録

Last updated at Posted at 2020-10-08
[error] Postgrex.Protocol (#PID<0.3778.0>) failed to connect: ** (DBConnection.ConnectionError) tcp connect (postgres:5432): non-existing domain - :nxdomain

をなんとかする方法についてちょっと手こずったので書きます。

最初は

  1 import Config
  2
  3 config :milk, Milk.Repo,
  4   adapter: Ecto.Adapters.Postgres,
  5   username: "postgres",
  6   password: "postgres",
  7   database: "milk_dev",
  8   hostname: "postgres",
  9   port: 5432,
 10   pool_size: 10

こんな感じで書いていたのですが、上記のエラーがずっと発生してしまっていました。
自分の/etc/hostsにはlocalhostに関する記述くらいしか書いていないせいなのか、

  1 import Config
  2
  3 config :milk, Milk.Repo,
  4   adapter: Ecto.Adapters.Postgres,
  5   username: "postgres",
  6   password: "postgres",
  7   database: "milk_dev",
  8   hostname: "localhost",
  9   port: 5432,
 10   pool_size: 10

hostnameをこのように変更すると動くようになりました。
/etc/hostsとかhostnameがポイントかもしれません。

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?