クライアント接続時の障害

Once you have a running postmaster, trying to connect to it with client applications can fail for a variety of reasons. The sample error messages shown here are for clients based on recent versions of libpq --- clients based on other interface libraries may produce other messages with more or less information.

すでに動作しているpostmasterに対してクライアントアプリケーション から接続する際にも,さまざまな理由で失敗することがありえます. ここに挙げたエラーメッセージの例は,最近のバージョンのlibpqを ベースにしたクライアントのものです.(他のインターフェースライブラリ をベースにしたクライアントは,多少ちがう内容のメッセージを 表示するかもしれません)


connectDB() -- connect() failed: Connection refused
Is the postmaster running (with -i) at 'server.joe.com' and accepting connections on TCP/IP port
'5432'?
connectDB() -- connect() failed: Connection refused
Is the postmaster running (with -i) at 'server.joe.com' and accepting connections on TCP/IP port
'5432'?
(connectDB() -- connect() の失敗: 接続が拒否されました
'server.joe.com'上で,postmasterは-iオプションつきで起動されていますか? またTCPのポート5432番で接
続を受け付けていますか?)
    
This is the generic "I couldn't find a postmaster to talk to" failure. It looks like the above when TCP/IP communication is attempted, or like this when attempting Unix-socket communication to a local postmaster: これは「話しかけるpostmasterを見つけられなかった」というよくある失敗. TCP/IPによる接続が行われようとしたときは上のようになりますし, あるいはUNIXドメインのソケットで,ローカルのpostmasterとの場合なら:

connectDB() -- connect() failed: No such file or directory
Is the postmaster running at 'localhost' and accepting connections on Unix socket '5432'?
connectDB() -- connect() の失敗: そのようなファイル,あるいはディレクトリがありません
'localhost'上で,postmasterは起動されていますか? またUNIXソケット5432番で接続を受け付けています
か?)
    
The last line is useful in verifying that the client is trying to connect where it is supposed to. If there is in fact no postmaster running there, the kernel error message will typically be either "Connection refused" or "No such file or directory", as illustrated. (It is particularly important to realize that "Connection refused" in this context does not mean that the postmaster got your connection request and rejected it --- that case will produce a different message, as shown below.) Other error messages such as "Connection timed out" may indicate more fundamental problems, like lack of network connectivity. のようになります. 最後の行は,クライアントがどちらを想定して接続を試みたのかを確認 するのに役立ちます. もし,本当にpostmasterがそこで動いていないので あれば,いま説明したようにカーネルエラーメッセージは "Connection refused(接続が拒否されました)" か, "No such file or directory(そのようなファイル,あるいはディレクトリは ありません)" のどちらかとなるのが典型的です. (特に理解しておいてください:この状況で出る "Connection refused" は, postmasterが一旦接続要求を受け取り,そして拒否したのでは ないということです.−−このようなケースでは後に 挙げる,別のメッセージが出力されます) 他の "Connection timed out(接続の待ち時間切れ)" のようなエラー メッセージは,ネットワーク接続ができていない,といったような,もっと 根本的な問題を指しているかもしれません.


No pg_hba.conf entry for host 123.123.123.123, user joeblow, database testdb
No pg_hba.conf entry for host 123.123.123.123, user joeblow, database testdb
(ホスト 123.123.123.123, ユーザ名 joeblow, データベース testdb に対応するエントリが pg_hba.conf に
ありません)
    
This is what you are most likely to get if you succeed in contacting a postmaster, but it doesn't want to talk to you. As the message suggests, the postmaster refused the connection request because it found no authorizing entry in its pg_hba.conf configuration file. これはpostmasterとのコンタクトが成功したにもかかわらず,相手が あなたと話をしたくなかった,というのが一番ありそうな状況です. メッセージが教えてくれている通り,コンフィギュレーションファイル pg_hba.confにアクセス権限のエントリがなかったため,postmasterは 接続要求を拒否したのです.


Password authentication failed for user 'joeblow'
Password authentication failed for user 'joeblow'
(ユーザ名 joeblow に対するパスワード認証に失敗しました)
    
Messages like this indicate that you contacted the postmaster, and it's willing to talk to you, but not until you pass the authorization method specified in the pg_hba.conf file. Check the password you're providing, or check your Kerberos or IDENT software if the complaint mentions one of those authentication types. このメッセージは,postmasterとのコンタクトに成功し,そして相手も あなたと話をしたかった.なのに,pg_hba.confに指定された認証方法に パスするまでおあずけにされたことを示しています.自分で設定した パスワードを確認する,あるいはもしエラーの内容がKerberosかIDENTの どちらかの認証方法に触れているのなら,それらを調べてみてください.


FATAL 1:  SetUserId: user 'joeblow' is not in 'pg_shadow'
FATAL 1:  SetUserId: user 'joeblow' is not in 'pg_shadow'
(致命的なエラー 1:  SetUserId: ユーザ 'joeblow' は 'pg_shadow' に存在しません)
    
This is another variant of authentication failure: no Postgres create_user command has been executed for the given username. これは認証の失敗に関する別のケースです:当該ユーザのために実行される べきcreate_userコマンドが,実行されていません.


FATAL 1:  Database testdb does not exist in pg_database
FATAL 1:  Database testdb does not exist in pg_database
(致命的なエラー 1:  データベース testdb は pg_database に存在しません)
    
There's no database by that name under the control of this postmaster. Note that if you don't specify a database name, it defaults to your Postgres username, which may or may not be the right thing. 該当する名前のデータベースが,現在のpostmasterの制御のもとにありま せん.もしデータベース名を指定しなかった場合は(それが正しいものか そうでないのかにはかかわらず)Postgresのユーザ名がデフォルトでデータ ベース名となることに注意してください.