Chapter 12. トラブルシューティング

Table of Contents
postmaster起動の失敗
クライアント接続時の障害
デバッグ出力

postmaster起動の失敗

There are several common reasons for the postmaster to fail to start up. Check the postmaster's log file, or start it by hand (without redirecting standard output or standard error) to see what complaint messages appear. Some of the possible error messages are reasonably self-explanatory, but here are some that are not:

postmasterの起動に失敗する理由として,いくつかよく見うけられるものが あります.まずpostmasterのログファイルを確認するか,あるいは標準 (エラー)出力をリダイレクトせずにコマンドラインからpostmasterを 起動してください.postmasterがどんな文句を言っているのかを聞いてみま しょう.エラーが出てきても,そのメッセージ自身が適切な説明を与えて くれることがあります.しかしそうでないものもありますので,ここに 挙げておきます.


FATAL: StreamServerPort: bind() failed: Address already in use
        Is another postmaster already running on that port?
FATAL: StreamServerPort: bind() failed: Address already in use
        Is another postmaster already running on that port?
(致命的なエラー: StreamServerPort: bind()の失敗 : 既にアドレスが使われています.
        同じポートで他のpostmasterが動作していませんか?)
    
This usually means just what it suggests: you accidentally started a second postmaster on the same port where one is already running. However, if the kernel error message is not "Address already in use" or some variant of that wording, there may be a different problem. For example, trying to start a postmaster on a reserved port number may draw something like メッセージの意味は大抵の場合書かれているとおりで,すでに実行中の postmasterと同じポートで,誤ってふたつ目のpostmasterを立ち上げて しまったということです.しかし,もしカーネルのエラーメッセージが "Address already in use(既にアドレスが使われています)"−全く同じ表記 でないかもしれませんが−と違うなら,これはたぶん別の問題です.たとえば postmasterを特権ポートで立ち上げようとすると,こんなメッセージを出して くるでしょう.

$ postmaster -i -p 666
FATAL: StreamServerPort: bind() failed: Permission denied
        Is another postmaster already running on that port?
$ postmaster -i -p 666
FATAL: StreamServerPort: bind() failed: Permission denied
        Is another postmaster already running on that port?
(致命的なエラー: StreamServerPort: bind() の失敗: パーミッションがありません
        同じポートで他のpostmasterが動作していませんか?)
    


IpcMemoryCreate: shmget failed (Invalid argument) key=5440001, size=83918612, permission=600
FATAL 1:  ShmemCreate: cannot create region
IpcMemoryCreate: shmget failed (Invalid argument) key=5440001, size=83918612, permission=600
FATAL 1:  ShmemCreate: cannot create region
(IpcMemoryCreate: shmget の失敗 (引数が不適切です) key=5440001, size=83918612, permission=600
致命的なエラー 1:  ShmemCreate: 領域を獲得できませんでした)
    
A message like this probably means that your kernel's limit on the size of shared memory areas is smaller than the buffer area that Postgres is trying to create. (Or it could mean that you don't have SysV-style shared memory support configured into your kernel at all.) As a temporary workaround, you can try starting the postmaster with a smaller-than-normal number of buffers (-B switch). You will eventually want to reconfigure your kernel to increase the allowed shared memory size, however. You may see this message when trying to start multiple postmasters on the same machine, if their total space requests exceed the kernel limit. このようなメッセージだと,カーネルの共有メモリサイズの上限がPostgresの 作成しようとしているバッファ領域に比べて足らない,ということになりそう です.(あるいは,カーネルにSystemVの共有メモリ機能がまったく 組み込まれていない,ということもありえます) 一時的な対応としてなら,通常よりも小さいバッファの設定でpostmasterを 起動してみることはできます(-Bオプション).しかし最終的にはカーネル の共有メモリの上限を上げざるを得ないでしょう.このメッセージは, postmasterを同じサーバ上でいくつも立ち上げようとしている状況で 必要になったメモリ空間全体が,カーネルの上限を超えた場合にも表示される ことがあります.


IpcSemaphoreCreate: semget failed (No space left on device) key=5440026, num=16, permission=600
IpcSemaphoreCreate: semget failed (No space left on device) key=5440026, num=16, permission=600
IpcSemaphoreCreate: semget の失敗 (デバイスに空きがありません) key=5440026, num=16, permission=600
    
A message like this does not mean that you've run out of disk space; it means that your kernel's limit on the number of SysV semaphores is smaller than the number Postgres wants to create. As above, you may be able to work around the problem by starting the postmaster with a reduced number of backend processes (-N switch), but you'll eventually want to increase the kernel limit. これはディスクスペースを使い切ってしまったということでは ありません.そうではなく,カーネルのSystemV セマフォの上限が,Postgresの作成しようとしている数に足らないという ことです.前項と同じように,今度はバックエンドの最大数を減らして postmasterを立ち上げれば,この問題に対処できると思います (-N オプション).が,やはり最後にはカーネルの上限を上げることに なるでしょう.