1
2

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 5 years have passed since last update.

ec2/rdsのpostgresにpgadminで接続してるとすぐタイムアウトになるのをなんとかする

Last updated at Posted at 2018-05-25

現象

オンプレのpostgresサーバ等はpgadminで接続していてもそんなにタイムアウトにならない。
のに、RDSやEC2上にpostgresサーバを立てた場合、pgadminで接続しているとすぐタイムアウトになる。
そんなもんかなーと思って我慢して使ってたけど、そろそろタイムアウトしすぎることにイライラしたのでちゃんと調べてみた

対応方法

サーバ側の設定を変えずにクライアントにあるpgadminの接続設定を変える方法でいく

  • クライアントに .pg_service.conf ファイルを作成
  • pgadmin接続時の設定でサービスの部分に上記で作成したファイルで指定した名前を設定

サービスファイルの作成


# macの場合
vi ~/.pg_service.conf

# winの場合
notepad %APPDATA%\postgresql\.pg_service.conf
.pg_service.conf
[hoge]
keepalives=1
connect_timeout=20
keepalives_idle=10

pgadminにサービスの設定

pgadminを立ち上げて接続の部分を右クリック、
サービス の部分に .pg_service.conf で指定した名前を設定
(上記例だと hoge

image.png

接続する

あとはpgadminから接続すればOK

1
2
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
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?