postmaster

Name

postmaster  --  Run the Postgres multi-user backend Postgres マルチユーザバックエンドの起動

Synopsis

postmaster [ -B nBuffers ] [ -D DataDir ] [ -i ]
postmaster [ -B nBuffers ] [ -D DataDir ] [ -N nBackends ] [ -S ]
   [ -d [ DebugLevel ] [ -i ] [ -o BackendOptions ] [ -p port ]
postmaster [ -n | -s ] ...
  

入力

postmaster accepts the following command line arguments:

postgres では以下のコマンドライン引数を指定できます。

-B nBuffers

The number of shared-memory buffers for the postmaster to allocate and manage for the backend server processes that it starts. This value defaults to 64 buffers, where each buffer is 8k bytes (or whatever BLCKSZ is set to in config.h).

立ち上がった時点にバックエンドサーバプロセスに postmaster が割り当てた共有メモリバッファの数です。 デフォルトは 64 バッファで、一つのバッファの大きさは 8K バイト (または config.h で設定された BLCKSZ の値)です。

-D DataDir

Specifies the directory to use as the root of the tree of database directories. If -D is not given, the default data directory name is the value of the environment variable PGDATA. If PGDATA is not set, then the directory used is $POSTGRESHOME/data. If neither environment variable is set and this command-line option is not specified, the default directory that was set at compile-time is used.

データベースディレクトリのツリーのルートとして使用するディレクトリ を指定します。-D が指定されていない場合、デフォルトのデータ ディレクトリは、環境変数 PGDATA の値となります。 PGDATA が設定されていなければ、使用されるディレクトリは $POSTGRESHOME/data となります。 環境変数が設定されていないで、コマンドラインオプションも指定されて いないと、コンパイルしたときのデフォルトのディレクトリが使用されます。

-N nBackends

The maximum number of backend server processes that this postmaster is allowed to start. In the default configuration, this value is usually set to 32, and can be set as high as 1024 if your system will support that many processes. Both the default and upper limit values can be altered when building Postgres (see src/include/config.h).

この postmaster が起動できるバックエンドサーバプロセスの最大数 です。デフォルトの設定ではこの値は 32 になっていますが、システムが プロセス数をサポートする限り最大 1024 まで設定可能です。 デフォルト値と最大可能値は Postgres の組み立て時に変更可能です。(src/include/config.h を参照のこと。)

-S

Specifies that the postmaster process should start up in silent mode. That is, it will disassociate from the user's (controlling) tty and start its own process group. This should not be used in combination with debugging options because any messages printed to standard output and standard error are discarded.

postmaster プロセスがサイレントモード で立ち上がることを指定します。それは、ユーザの(制御している) tty とは切り離し、自分自身のプロセスグループを立ち上げます。この指定 は標準出力と標準エラーへ出力されるいかなるメッセージも破棄されます のでデバッグのオプションと混在して使用してはいけません。

-d [ DebugLevel ]

The optional argument DebugLevel determines the amount of debugging output the backend servers will produce. If DebugLevel is one, the postmaster will trace all connection traffic, and nothing else. For levels two and higher, debugging is turned on in the backend process and the postmaster displays more information, including the backend environment and process traffic. Note that if no file is specified for backend servers to send their debugging output then this output will appear on the controlling tty of their parent postmaster.

オプション引数の DebugLevel はバックエンドサーバが生成するデバッグ出力の大きさを決定します。 DebugLevel が 1 の時、 postmaster は全ての接続トラフィックをトレースしてそれでお仕舞いです。 レベルが 2 以上の場合、バックエンドプロセスでデバッグが起動されて postmaster はバックエンドの環境とトラフィック処理を含む、より多くの 情報を表示します。 バックエンドサーバがデバッグ結果を送るファイルが指定されていない場合、 結果は親である postmaster の tty 制御 に出現します。

-i

This enables TCP/IP or Internet domain socket communication. Without this option, only local Unix domain socket communication is possible.

TCP/IP またはインターネットドメインソケット通信を可能にします。 このオプションが無い場合、ローカル Unix ドメインソケット通信 のみが可能となります。

-o BackendOptions

The postgres options specified in BackendOptions are passed to all backend server processes started by this postmaster. If the option string contains any spaces, the entire string must be quoted.

BackendOptions で指定される postgres オプションはこの postmaster で起動される全ての バックエンドサーバプロセスに渡されます。 オプションの文字列内にスペースがある場合、文字列全体が括弧で 括られなければなりません。

-p port

Specifies the TCP/IP port or local Unix domain socket file extension on which the postmaster is to listen for connections from frontend applications. Defaults to the value of the PGPORT environment variable, or if PGPORT is not set, then defaults to the value established when Postgres was compiled (normally 5432). If you specify a port other than the default port then all frontend applications (including psql) must specify the same port using either command-line options or PGPORT.

フロントエンドアプリケーションからの接続を postmaster が監視する TCP/IP ポート またはローカル Unix ドメインソケットファイル拡張子を指定します。 デフォルトは、 PGPORT の値、または環境変数 PGPORT がセットせれて いない場合 Postgres がコンパイルされときに指定された (通常 5432)値となります。デフォルトのポート以外を指定した 場合、(psql を含んだ)全ての フロントエンドアプリケーションはコマンドラインオプションか PGPORT で同じポートを指定しなければなりません。

A few command line options are available for debugging in the case when a backend dies abnormally. These options control the behavior of the postmaster in this situation, and neither option is intended for use in ordinary operation.

バックエンドが異常終了した場合、デバッグ用として、いくつかの コマンドラインオプションが用意されています。これらのオプションは かかる状況における postmaster の 振舞いを制御しますが、いずれのオプションも通常の 操作を目的としているものではありません

The ordinary strategy for this situation is to notify all other backends that they must terminate and then reinitialize the shared memory and semaphores. This is because an errant backend could have corrupted some shared state before terminating.

このような状況に対しての通常の戦略は、他の全てのバックエンドに 終了と共有メモリとセマフォの再初期化を通知することです。 その理由はおかしくなっているバックエンドが終了する前に、 何らかの共有状態を変造する恐れがあるからです。

These special-case options are:

これらの特別の場合のオプションとは:

-n

postmaster will not reinitialize shared data structures. A knowledgable system programmer can then use the shmemdoc program to examine shared memory and semaphore state.

postmaster は共有データ構成を再初期化しません。 そこで、知識のあるシステムプログラマは共有メモリとセマフォ状況 の調査のために shmemdoc プログラムを使用します。

-s

postmaster will stop all other backend processes by sending the signal SIGSTOP, but will not cause them to terminate. This permits system programmers to collect core dumps from all backend processes by hand.

postmaster は他の全てのバックエンドプロセスを SIGSTOP シグナルを送って中止します。ただし、停止はしません。 このことによって、システムプログラマが全てのバックエンド プロセスから手作業でコアダンプを収集出来ることになります。

出力

semget: No space left on device

If you see this message, you should run the ipcclean command. After doing this, try starting postmaster again. If this still doesn't work, you probably need to configure your kernel for shared memory and semaphores as described in the installation notes. If you run multiple instances of postmaster on a single host, or have a kernel with particularly small shared memory and/or semaphore limits, you may have to reconfigure your kernel to increase its shared memory or semaphore parameters.

このメッセージが現れたら ipcclean コマンドを実行しなければなりません。実行後、 postmaster を再起動します。引続きエラーが出るようであれば、 インストールの注意書きにしたがって、共有メモリとセマフォに ついてカーネルを構築する必要がありそうです。 一台のホスト上で postmaster の複数のインスタンスを立ちあげている場合、 特にカーネルの共有メモリやセマフォの限界が小さい場合、 共有メモリあるいはセマフォ(または両方)のパラメータを 拡張するようにカーネルを再構築しなければなりません。

Tip: You may be able to postpone reconfiguring your kernel by decreasing -B to reduce Postgres' shared memory consumption, or by reducing -N to reduce Postgres' semaphore consumption.

Postgres の共有メモリ消費量 を低くするため -B を使用し、あるいは Postgres のセマフォ 消費をするなくする -N を使用することでカーネルの再構築を 先に延ばす事も出来ます。

StreamServerPort: cannot bind to port

If you see this message, you should be certain that there is no other postmaster process already running. The easiest way to determine this is by using the command

% ps -ax | grep postmaster
	
on BSD-based systems, or
% ps -e | grep postmast
	
for System V-like or POSIX-compliant systems such as HP-UX.

このメッセージが出るときはもはや他には postmaster プロセスが走っていないということです。簡単に確かめるため BSD ベースのシステムでは

% ps -ax | grep postmaster
	
または、System V 系、HP-UX のような POSIX 準拠のシステムでは
% ps -e | grep postmaster
	
のようにします。

If you are sure that no other postmaster processes are running and you still get this error, try specifying a different port using the -p option. You may also get this error if you terminate the postmaster and immediately restart it using the same port; in this case, you must simply wait a few seconds until the operating system closes the port before trying again. Finally, you may get this error if you specify a port number that your operating system considers to be reserved. For example, many versions of Unix consider port numbers under 1024 to be trusted and only permit the Unix superuser to access them.

他には postmaster が立ち上がっていないことが確認されたにも関らず、このエラー が引続き出るときは -p オプションを使って異なるポートを指定してみて下さい。 postmaster を停止し、そのポートですぐに再立ち上げした場合、エラーが 出る場合があります。このときは、オペレーティングシステムが ポートを閉鎖するまで数秒待ってから単に再トライしてください。 最後に、オペレーティングシステムが予約しているポート番号を 指定するとこのエラーがでます。例えば、Unix の多くのバージョン では 1024 より小さいポート番号は 信託 と見なされていて、Unix のスーパユーザ以外アクセス出来ません。

IpcMemoryAttach: shmat() failed: Permission denied

A likely explanation is that another user attempted to start a postmaster process on the same port which acquired shared resources and then died. Since Postgres shared memory keys are based on the port number assigned to the postmaster, such conflicts are likely if there is more than one installation on a single host. If there are no other postmaster processes currently running (see above), run ipcclean and try again. If other postmaster images are running, you will have to find the owners of those processes to coordinate the assignment of port numbers and/or removal of unused shared memory segments.

ありそうな事として、他のユーザが postmaster プロセスを共有リソースを取得済の同じポートで開始させよう として終了した場合です。 Postgres の共有メモリキーは postmaster に割り付けたポート番号をもとにしているので、 このような衝突は一台のホストに複数のインストレーションが 存在する場合起こり得ることです。 もしも他に postmaster プロセスが現在走っていないなら(上記参照)、 ipcclean を実行してから、再トライしてみてください。 もし他の postmaster イメージ が走っていれば、それらのプロセスの所有者を発見して ポート番号の割当の調整および未使用の共有メモリセグメントの 削除といった対策が取れます。

説明

postmaster manages the communication between frontend and backend processes, as well as allocating the shared buffer pool and SysV semaphores (on machines without a test-and-set instruction). postmaster does not itself interact with the user and should be started as a background process.

postmaster はフロントエンドとバックエンドプロセス間の通信を制御すると共に 共有バッファプールと SysV セマフォの配分を(試行設定指示のない 機械の場合)行います。 postmaster 自身はユーザと接触しないので、バックグランドプロセスとして 起動されなければなりません。

Only one postmaster should be running at a time in a given Postgres installation. Here, an installation means a database directory and postmaster port number. You can run more than one postmaster on a machine only if each one has a separate directory and port number.

ある与えられた Postgres インストレーションではある時点でたった一つだけの postmaster が走っていなければなりません。 ここでインストレーションとはデータベースのディレクトリと postmaster のポート番号を 言います。もし複数の postmaster を同じマシン上で動かす 場合はそれぞれが異なったディレクトリとポート番号を持って いなければなりません。

注意事項

If at all possible, do not use SIGKILL when killing the postmaster. SIGHUP, SIGINT, or SIGTERM (the default signal for kill(1))" should be used instead. Using

% kill -KILL
   
or its alternative form
% kill -9
   
will prevent postmaster from freeing the system resources (e.g., shared memory and semaphores) that it holds before dying. This prevents you from having to deal with the problem with shared memory described earlier.

出来るのであれば、 postmaster を終了するのに SIGKILL使わないで下さい。 代わりに SIGHUPSIGINT、 または (kill(1) のデフォルトシグナル) SIGTERM を使うべきです。

% kill -KILL
   
またはその別の形式
% kill -9
   
postmaster が 終了以前に保持するシステムリソース(例えば共有メモリ とかセマフォ)を開放することを防ぎます。そして、前で 説明した共有メモリ問題の遭遇にたいする防御にもなります。

Useful utilities for dealing with shared memory problems include ipcs(1), ipcrm(1), and ipcclean(1).

共有メモリ問題を扱う有用なユーティリティには、 ipcs(1)ipcrm(1) そして ipcclean(1)があります。

使用法

To start postmaster using default values, type:

postmaster をデフォルト値で 起動するには、

% nohup postmaster >logfile 2>&1 &
   
と入力します。 This command will start up postmaster on the default port (5432). This is the simplest and most common way to start the postmaster. このコマンドは postmaster を デフォルトポート(5432)で起動します。 これが最も単純で一般的な postmaster の起動です。

To start postmaster with a specific port and executable name:

postmaster を特別なポートと 実行可能名で起動するには

% nohup postmaster -p 1234 &
   
とします。 This command will start up postmaster communicating through the port 1234. In order to connect to this postmaster using psql, you would need to run it as このコマンドは postmaster を ポート 1234 を通じて通信するように起動します。この postmaster に psql で接続するには
% psql -p 1234
   
or set the environment variable PGPORT: または、環境変数 PGPORT の設定で
% setenv PGPORT 1234
% psql
   
. のようにします。