バージョンごとのドキュメント一覧

55.4. ストリーミングレプリケーションプロトコル #

<title>Streaming Replication Protocol</title>

To initiate streaming replication, the frontend sends the <literal>replication</literal> parameter in the startup message. A Boolean value of <literal>true</literal> (or <literal>on</literal>, <literal>yes</literal>, <literal>1</literal>) tells the backend to go into physical replication walsender mode, wherein a small set of replication commands, shown below, can be issued instead of SQL statements. ストリーミングレプリケーションを初期化するために、フロントエンドは開始メッセージにてreplicationパラメータを送信します。 ブール値のtrue(またはonyes1)がバックエンドに対して、SQL文ではなく小規模なレプリケーションコマンド群を発行できるようになる、物理レプリケーションのwalsenderモードに入るように伝えます。

Passing <literal>database</literal> as the value for the <literal>replication</literal> parameter instructs the backend to go into logical replication walsender mode, connecting to the database specified in the <literal>dbname</literal> parameter. In logical replication walsender mode, the replication commands shown below as well as normal SQL commands can be issued. replicationパラメータに対する値としてdatabaseを渡すことは、dbnameパラメータで指定されたデータベースに接続して、バックエンドにロジカルレプリケーションのwalsendeモードに入ることを指示します。 ロジカルレプリケーションwalsenderモードでは、以下に示すレプリケーションコマンドを通常のSQLコマンドと同様に実行できます。

In either physical replication or logical replication walsender mode, only the simple query protocol can be used. 物理レプリケーション、ロジカルレプリケーションいずれかのwalsenderモードでは、簡易問い合わせプロトコルのみ使用できます。

For the purpose of testing replication commands, you can make a replication connection via <application>psql</application> or any other <application>libpq</application>-using tool with a connection string including the <literal>replication</literal> option, e.g.: レプリケーションコマンドをテストするために、replicationオプションを含む接続文字列を使用して、psqlまたは他のlibpqを使用するツールによるレプリケーション接続を作成できます。 例を示します。

psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;"

However, it is often more useful to use <xref linkend="app-pgreceivewal"/> (for physical replication) or <xref linkend="app-pgrecvlogical"/> (for logical replication). しかし、物理的レプリケーションのためにpg_receivewalを使用し、論理的レプリケーションのためにpg_recvlogicalを使用すれば、もっと有用なことが多いです。

Replication commands are logged in the server log when <xref linkend="guc-log-replication-commands"/> is enabled. log_replication_commandsが有効であるとき、サーバログにレプリケーションコマンドが記録されます。

The commands accepted in replication mode are: レプリケーションモードで受け付けられるコマンドは以下の通りです。

IDENTIFY_SYSTEM #

Requests the server to identify itself. Server replies with a result set of a single row, containing four fields: サーバに自身を識別することを要求します。 サーバは以下の4つのフィールドを持つ単一行の結果セットをもって応答します。

systemid (text)

The unique system identifier identifying the cluster. This can be used to check that the base backup used to initialize the standby came from the same cluster. クラスタを識別する一意なシステム識別子です。 これを使用してスタンバイを初期化するために使用するベースバックアップが同じクラスタに由来していることを検査することができます。

timeline (int8)

Current timeline ID. Also useful to check that the standby is consistent with the primary. 現在のタイムラインIDです。 同様にスタンバイがプライマリと一貫性を持つことを検査するために使用されます。

xlogpos (text)

Current WAL flush location. Useful to get a known location in the write-ahead log where streaming can start. 現在のWALのフラッシュ位置です。 ストリーミングを開始できる先行書き込みログの既知の位置を得る際に有用です。

dbname (text)

Database connected to or null. 接続したデータベース名またはNULLです。

SHOW name #

Requests the server to send the current setting of a run-time parameter. This is similar to the SQL command <xref linkend="sql-show"/>. 実行時パラメータの現在の設定を送信するようサーバに要求します。 これはSQLコマンドSHOWと同等です。

name

The name of a run-time parameter. Available parameters are documented in <xref linkend="runtime-config"/>. 実行時パラメータの名前です。 利用できるパラメータは第20章に記述されています。

TIMELINE_HISTORY tli #

Requests the server to send over the timeline history file for timeline <replaceable class="parameter">tli</replaceable>. Server replies with a result set of a single row, containing two fields. While the fields are labeled as <type>text</type>, they effectively return raw bytes, with no encoding conversion: tliのタイムラインのため、サーバにタイムライン履歴ファイルの送付を要求します。 サーバは2列単一行の結果セットを返します。 フィールドにはtextの印が付けられていますが、実際には符号化変換なしの生のバイトが返ります。

filename (text)

File name of the timeline history file, e.g., <filename>00000002.history</filename>. タイムライン履歴ファイル名、例えば00000002.history

content (text)

Contents of the timeline history file. タイムライン履歴ファイルの内容

CREATE_REPLICATION_SLOT slot_name [ TEMPORARY ] { PHYSICAL | LOGICAL output_plugin } [ ( option [, ...] ) ] #

Create a physical or logical replication slot. See <xref linkend="streaming-replication-slots"/> for more about replication slots. 物理的または論理的レプリケーションスロットを作成します。 レプリケーションスロットの詳細は27.2.6を参照。

slot_name

The name of the slot to create. Must be a valid replication slot name (see <xref linkend="streaming-replication-slots-manipulation"/>). 作成するスロット名。 有効なレプリケーションスロット名でなければならない。 (27.2.6.1を参照)。

output_plugin

The name of the output plugin used for logical decoding (see <xref linkend="logicaldecoding-output-plugin"/>). ロジカルデコーディングに使用される出力プラグイン名。 (49.6を参照)。

TEMPORARY

Specify that this replication slot is a temporary one. Temporary slots are not saved to disk and are automatically dropped on error or when the session has finished. このレプリケーションスロットが一時スロットであることを指定します。 一時スロットはディスクに保存されず、エラー発生時またはセッション終了時に自動的に削除されます。

<para>The following options are supported:</para>

次のオプションがサポートされています。

TWO_PHASE [ boolean ]

If true, this logical replication slot supports decoding of two-phase commit. With this option, commands related to two-phase commit such as <literal>PREPARE TRANSACTION</literal>, <literal>COMMIT PREPARED</literal> and <literal>ROLLBACK PREPARED</literal> are decoded and transmitted. The transaction will be decoded and transmitted at <literal>PREPARE TRANSACTION</literal> time. The default is false. trueの場合、この論理レプリケーションスロットは2相コミットのデコードをサポートします。 このオプションを使用すると、PREPARE TRANSACTIONCOMMIT PREPAREDおよびROLLBACK PREPAREDなどの2相コミットに関連するコマンドがデコードおよび転送されます。 トランザクションはPREPARE TRANSACTION時にデコードおよび転送されます。 デフォルトはfalseです。

RESERVE_WAL [ boolean ]

If true, this physical replication slot reserves <acronym>WAL</acronym> immediately. Otherwise, <acronym>WAL</acronym> is only reserved upon connection from a streaming replication client. The default is false. trueの場合、この物理的レプリケーションスロットが直ちにWALを予約することを指定します。 そうでなければ、WALはストリーミングレプリケーションクライアントからの接続時の予約のみです。 デフォルトはfalseです。

SNAPSHOT { 'export' | 'use' | 'nothing' }

Decides what to do with the snapshot created during logical slot initialization. <literal>'export'</literal>, which is the default, will export the snapshot for use in other sessions. This option can't be used inside a transaction. <literal>'use'</literal> will use the snapshot for the current transaction executing the command. This option must be used in a transaction, and <literal>CREATE_REPLICATION_SLOT</literal> must be the first command run in that transaction. Finally, <literal>'nothing'</literal> will just use the snapshot for logical decoding as normal but won't do anything else with it. 論理スロットの初期化時に作成されたスナップショットの処理について決定します。 デフォルトの'export'はスナップショットが他のセッションで利用できるようエクスポートします。 このオプションはトランザクションの内側で使用することはできません。 'use'はこのコマンドを実行している現在のトランザクションでスナップショットを利用します。 このオプションはトランザクション内で使用しなければならず、CREATE_REPLICATION_SLOTがそのトランザクション内で実行される最初のコマンドでなければなりません。 最後に、'nothing'は論理デコーディングで通常通りにスナップショットを使用するだけで、他には何もしません。

In response to this command, the server will send a one-row result set containing the following fields: このコマンドへの応答として、サーバは以下のフィールドを含む1行の結果セットを送信します。

slot_name (text)

The name of the newly-created replication slot. 新しく作成されたレプリケーションスロットの名前です。

consistent_point (text)

The WAL location at which the slot became consistent. This is the earliest location from which streaming can start on this replication slot. スロットが一貫性のある状態になった時点のWAL位置です。 これが、このスロット上でストリーミングを開始できる最も早い場所となります。

snapshot_name (text)

The identifier of the snapshot exported by the command. The snapshot is valid until a new command is executed on this connection or the replication connection is closed. Null if the created slot is physical. このコマンドでエクスポートされるスナップショットの識別子です。 スナップショットは、この接続上で新しいコマンドが実行されるか、レプリケーション接続が閉じられるまで有効です。 作成されたのが物理スロットの場合はNULLになります。

output_plugin (text)

The name of the output plugin used by the newly-created replication slot. Null if the created slot is physical. 新しく作成されたレプリケーションスロットが使用する出力プラグインの名前です。 作成されたのが物理スロットの場合はNULLになります。

CREATE_REPLICATION_SLOT slot_name [ TEMPORARY ] { PHYSICAL [ RESERVE_WAL ] | LOGICAL output_plugin [ EXPORT_SNAPSHOT | NOEXPORT_SNAPSHOT | USE_SNAPSHOT | TWO_PHASE ] } #

For compatibility with older releases, this alternative syntax for the <literal>CREATE_REPLICATION_SLOT</literal> command is still supported. 旧リリースとの互換性を保つために、CREATE_REPLICATION_SLOTコマンドのこの代替構文は引き続きサポートされています。

READ_REPLICATION_SLOT slot_name #

Read some information associated with a replication slot. Returns a tuple with <literal>NULL</literal> values if the replication slot does not exist. This command is currently only supported for physical replication slots. レプリケーションスロットに関連付けられた情報を読みます。 レプリケーションスロットが存在しない場合は、NULL値を持つタプルが戻されます。 このコマンドは現在、物理レプリケーションスロットでのみサポートされています。

In response to this command, the server will return a one-row result set, containing the following fields: このコマンドへの応答として、サーバは以下のフィールドを含む1行の結果セットを返します。

slot_type (text)

The replication slot's type, either <literal>physical</literal> or <literal>NULL</literal>. レプリケーションスロットのタイプ、physicalまたはNULL

restart_lsn (text)

The replication slot's <literal>restart_lsn</literal>. レプリケーションスロットのrestart_lsn

restart_tli (int8)

The timeline ID associated with <literal>restart_lsn</literal>, following the current timeline history. 現在のタイムライン履歴に従って、restart_lsnに関連付けられたタイムラインID。

START_REPLICATION [ SLOT slot_name ] [ PHYSICAL ] XXX/XXX [ TIMELINE tli ] #

Instructs server to start streaming WAL, starting at WAL location <replaceable class="parameter">XXX/XXX</replaceable>. If <literal>TIMELINE</literal> option is specified, streaming starts on timeline <replaceable class="parameter">tli</replaceable>; otherwise, the server's current timeline is selected. The server can reply with an error, for example if the requested section of WAL has already been recycled. On success, the server responds with a CopyBothResponse message, and then starts to stream WAL to the frontend. サーバに対して、WALのストリーミングをXXX/XXX WAL時点から開始するよう指示します。 TIMELINEオプションが指定された場合、ストリーミングはtliのタイムラインから開始されます。 そうでなければ、サーバの現在のタイムラインが選択されます。 サーバが、例えば、要求されたWALの断片がすでに回収されているなど、エラーを返すことがありえます。 成功時サーバはCopyBothResponseメッセージで応答し、フロントエンドに対するWALストリームを開始します。

If a slot's name is provided via <replaceable class="parameter">slot_name</replaceable>, it will be updated as replication progresses so that the server knows which WAL segments, and if <varname>hot_standby_feedback</varname> is on which transactions, are still needed by the standby. slot_nameを経由してスロット名が提供された場合、それはレプリケーションの進行として更新されます。 それによってサーバは、どのWALセグメントがまだスタンバイに必要か、hot_standby_feedbackのトランザクションはどれか、を感知します。

If the client requests a timeline that's not the latest but is part of the history of the server, the server will stream all the WAL on that timeline starting from the requested start point up to the point where the server switched to another timeline. If the client requests streaming at exactly the end of an old timeline, the server skips COPY mode entirely. 最新ではなくて、サーバの過去のタイムラインをクライアントが要求した場合、サーバは要求された開始時点から他のタイムラインに切り替えるまでの、全てのWALストリームを送付します。 クライアントが旧タイムラインの終点のストリームを要求した場合、サーバはCOPYモード全体をスキップします。

After streaming all the WAL on a timeline that is not the latest one, the server will end streaming by exiting the COPY mode. When the client acknowledges this by also exiting COPY mode, the server sends a result set with one row and two columns, indicating the next timeline in this server's history. The first column is the next timeline's ID (type <type>int8</type>), and the second column is the WAL location where the switch happened (type <type>text</type>). Usually, the switch position is the end of the WAL that was streamed, but there are corner cases where the server can send some WAL from the old timeline that it has not itself replayed before promoting. Finally, the server sends two CommandComplete messages (one that ends the CopyData and the other ends the <literal>START_REPLICATION</literal> itself), and is ready to accept a new command. 最新でないタイムラインの全てのWALストリームを送付した後、サーバはCOPYモードを出ることによりストリームを終了します。 クライアントもCOPYモードを出ることにより承認した場合、サーバは2列単一行の結果セットを送付し、サーバにある次のタイムラインを示します。 最初の列は次のタイムラインID(int8型)であり、次の列は切り替えたWALの位置(text型)です。 通常切り替えた位置はWALストリームの終点ですが、昇格する前に再実行されなかった旧タイムラインからWALを送付するというまれな場合もあります。 最後に、サーバは2つのCommandCompleteメッセージ(一方はCopyDataを終了し、もう一方はSTART_REPLICATION自体を終了する)を送付し、新規のコマンドを受理できるようになります。

WAL data is sent as a series of CopyData messages. (This allows other information to be intermixed; in particular the server can send an ErrorResponse message if it encounters a failure after beginning to stream.) The payload of each CopyData message from server to the client contains a message of one of the following formats: WALデータはCopyDataメッセージ群として送信されます。 (これにより他の情報を混在させることができます。 具体的にはサーバはストリーム開始後に失敗が起きた場合にErrorResponseメッセージを送信することができます。) サーバからクライアントへの各CopyDataメッセージのペイロード、は以下の書式のどれかを含みます。

XLogData (B) #
Byte1('w')

Identifies the message as WAL data. メッセージをWALデータとして識別します。

Int64

The starting point of the WAL data in this message. このメッセージ内のWALの開始点。

Int64

The current end of WAL on the server. サーバ上の現在のWAL終了点。

Int64

The server's system clock at the time of transmission, as microseconds since midnight on 2000-01-01. 転送時点でのサーバのシステム時刻。 2000年1月1日午前0時からのマイクロ秒。

Byten

A section of the WAL data stream. WALデータストリームの断片。

A single WAL record is never split across two XLogData messages. When a WAL record crosses a WAL page boundary, and is therefore already split using continuation records, it can be split at the page boundary. In other words, the first main WAL record and its continuation records can be sent in different XLogData messages. 単一のWALレコードが2つのXLogDataメッセージに分かれることはありません。 しかしWALレコードがWALページ境界を跨る場合、継続レコードを用いてすでに分割されていますので、ページ境界で分割することができます。 言い換えると、先頭の主WALレコードとその継続レコードは、別のXLogDataメッセージとして分かれることがありえます。

プライマリキープアライブメッセージ(B) #
Byte1('k')

Identifies the message as a sender keepalive. メッセージを送信元キープアライブとして識別します。

Int64

The current end of WAL on the server. サーバ上の現在のWAL終端。

Int64

The server's system clock at the time of transmission, as microseconds since midnight on 2000-01-01. 転送時点でのサーバのシステム時刻。 2000年1月1日午前0時からのマイクロ秒。

Byte1

1 means that the client should reply to this message as soon as possible, to avoid a timeout disconnect. 0 otherwise. タイムアウトによる切断を避けるため、クライアントがこのメッセージに即時に応答するべき方法の1つ。 0またはその他

The receiving process can send replies back to the sender at any time, using one of the following message formats (also in the payload of a CopyData message): 以下のメッセージ書式の1つ(およびCopyDataメッセージのペイロード中のもの)を使用して、受理プロセスは送信者にいつでも応答できます。

スタンバイ状態の更新(F) #
Byte1('r')

Identifies the message as a receiver status update. メッセージを受信側の状態更新として識別します。

Int64

The location of the last WAL byte + 1 received and written to disk in the standby. スタンバイにおいて受信しディスクに書き込まれた最終WALバイト+1の場所。

Int64

The location of the last WAL byte + 1 flushed to disk in the standby. スタンバイにおいてディスクにフラッシュされた最終WALバイト+1の場所。

Int64

The location of the last WAL byte + 1 applied in the standby. スタンバイにおいて適用された最終WALバイト+1の場所。

Int64

The client's system clock at the time of transmission, as microseconds since midnight on 2000-01-01. 転送時点でのクライアントのシステム時刻。 2000年1月1日午前0時からのマイクロ秒。

Byte1

If 1, the client requests the server to reply to this message immediately. This can be used to ping the server, to test if the connection is still healthy. 値が1の場合、このメッセージにすぐ応答するように、クライアントはサーバへ要求します。 この方法は、接続がまだ保持されているか検査するために、サーバへのピング送信として使用できます。

ホットスタンバイフィードバックメッセージ(F) #
Byte1('h')

Identifies the message as a hot standby feedback message. メッセージをホットスタンバイのフィードバックメッセージとして識別します。

Int64

The client's system clock at the time of transmission, as microseconds since midnight on 2000-01-01. 転送時点でのクライアントのシステム時刻。 2000年1月1日午前0時からのマイクロ秒。

Int32

The standby's current global xmin, excluding the catalog_xmin from any replication slots. If both this value and the following catalog_xmin are 0 this is treated as a notification that hot standby feedback will no longer be sent on this connection. Later non-zero messages may reinitiate the feedback mechanism. スタンバイの現在のグローバルのxminですが、すべてのレプリケーションスロットのcatalog_xminは除きます。 この値と次のcatalog_xminがいずれも0なら、この接続ではホットスタンバイのフィードバックはもう送信されないという通知として扱われます。 後でゼロでないメッセージによりフィードバック機構を再開することができます。

Int32

The epoch of the global xmin xid on the standby. スタンバイのグローバルのxmin xidのエポックです。

Int32

The lowest catalog_xmin of any replication slots on the standby. Set to 0 if no catalog_xmin exists on the standby or if hot standby feedback is being disabled. スタンバイのすべてのレプリケーションスロットのcatalog_xminの最小値です。 スタンバイ上にcatalog_xminが存在しない、あるいはホットスタンバイのフィードバックが無効化されている場合は0に設定します。

Int32

The epoch of the catalog_xmin xid on the standby. スタンバイのcatalog_xmin xidのエポックです。

START_REPLICATION SLOT slot_name LOGICAL XXX/XXX [ ( option_name [ option_value ] [, ...] ) ] #

Instructs server to start streaming WAL for logical replication, starting at either WAL location <replaceable class="parameter">XXX/XXX</replaceable> or the slot's <literal>confirmed_flush_lsn</literal> (see <xref linkend="view-pg-replication-slots"/>), whichever is greater. This behavior makes it easier for clients to avoid updating their local LSN status when there is no data to process. However, starting at a different LSN than requested might not catch certain kinds of client errors; so the client may wish to check that <literal>confirmed_flush_lsn</literal> matches its expectations before issuing <literal>START_REPLICATION</literal>. サーバに対して、XXX/XXXWAL時点かスロットconfirmed_flush_lsn(54.19参照)のどちらか大きい方から、論理的レプリケーションのWALストリームを開始するよう指示します。 この動作により、クライアントは処理するデータがないときにローカルLSNステータスを更新しないようにしやすくなります。 しかし、要求されたLSNとは異なるLSNで開始すると、特定の種類のクライアントエラーを検出できない可能性があります。 したがって、クライアントはSTART_REPLICATIONを発行する前にconfirmed_flush_lsnが期待どおりであることを確認したい場合があります。

The server can reply with an error, for example if the slot does not exist. On success, the server responds with a CopyBothResponse message, and then starts to stream WAL to the frontend. サーバは、スロットが存在しない場合などにエラーを返すことができます。 成功すると、サーバはCopyBothResponseメッセージで応答し、フロントエンドへのWALのストリーミングを開始します。

The messages inside the CopyBothResponse messages are of the same format documented for <literal>START_REPLICATION ... PHYSICAL</literal>, including two CommandComplete messages. CopyBothResponse内部のメッセージは、2つのCommandCompleteメッセージを含めてSTART_REPLICATION ... PHYSICALの記述と同じ書式です。

The output plugin associated with the selected slot is used to process the output for streaming. 選択されたスロットに関連した出力プラグインは、出力ストリームの処理に使用されます。

SLOT slot_name

The name of the slot to stream changes from. This parameter is required, and must correspond to an existing logical replication slot created with <literal>CREATE_REPLICATION_SLOT</literal> in <literal>LOGICAL</literal> mode. ストリームを変更したスロット名。 このパラメータは必須であり、LOGICALモードにおいてCREATE_REPLICATION_SLOTによって作成された、実在する論理的レプリケーションスロットに対応しなければなりません。

XXX/XXX

The WAL location to begin streaming at. ストリームを開始するWAL時点。

option_name

The name of an option passed to the slot's logical decoding plugin. レプリケーションスロットのロジカルデコーディング出力プラグインに渡すオプション名。

option_value

Optional value, in the form of a string constant, associated with the specified option. オプションの値。 文字列定数の形式。

DROP_REPLICATION_SLOT slot_name [ WAIT ] #

Drops a replication slot, freeing any reserved server-side resources. If the slot is a logical slot that was created in a database other than the database the walsender is connected to, this command fails. レプリケーションスロットを削除し、サーバ側で準備した資源を解放します。 このスロットが、walsenderが接続しているデータベース以外のデータベースで作成された論理スロットの場合、このコマンドは失敗します。

slot_name

The name of the slot to drop. 削除するスロット名。

WAIT

This option causes the command to wait if the slot is active until it becomes inactive, instead of the default behavior of raising an error. このオプションを使用すると、スロットが使用中の時に、スロットの使用が終わるまでコマンドを待機させます。 デフォルトの動作ではエラーを発生させます。

BASE_BACKUP [ ( option [, ...] ) ] #

Instructs the server to start streaming a base backup. The system will automatically be put in backup mode before the backup is started, and taken out of it when the backup is complete. The following options are accepted: ベースバックアップのストリーミングを開始するようにサーバーに指示します。 システムは自動的に、バックアップが開始される前にバックアップモードに入り、バックアップが完了するとバックアップモードから出ます。 次のオプションを使用できます。

LABEL 'label'

Sets the label of the backup. If none is specified, a backup label of <literal>base backup</literal> will be used. The quoting rules for the label are the same as a standard SQL string with <xref linkend="guc-standard-conforming-strings"/> turned on. バックアップのラベルを設定します。 何も指定しない場合は、base backupのバックアップラベルが使用されます。 ラベルの引用符付け規則は、standard_conforming_stringsをオンにした標準SQL文字列と同じです。

TARGET 'target'

Tells the server where to send the backup. If the target is <literal>client</literal>, which is the default, the backup data is sent to the client. If it is <literal>server</literal>, the backup data is written to the server at the pathname specified by the <literal>TARGET_DETAIL</literal> option. If it is <literal>blackhole</literal>, the backup data is not sent anywhere; it is simply discarded. バックアップの送信先をサーバに通知します。 ターゲットがclientの場合、デフォルトでバックアップデータがクライアントに送信されます。 ターゲットがserverの場合、バックアップデータはサーバのTARGET_DETAILオプションで指定されたパス名に書き込まれます。 ターゲットがblackholeの場合、バックアップデータはどこにも送信されず、単に破棄されます。

The <literal>server</literal> target requires superuser privilege or being granted the <literal>pg_write_server_files</literal> role. serverターゲットはスーパーユーザ権限を必要とするか、pg_write_server_filesロールを与えられている必要があります。

TARGET_DETAIL 'detail'

Provides additional information about the backup target. バックアップターゲットに関する追加情報を提供します。

Currently, this option can only be used when the backup target is <literal>server</literal>. It specifies the server directory to which the backup should be written. 現在、このオプションはバックアップターゲットがサーバの場合にのみ使用できます。 バックアップを書き込むサーバディレクトリを指定します。

PROGRESS [ boolean ]

If set to true, request information required to generate a progress report. This will send back an approximate size in the header of each tablespace, which can be used to calculate how far along the stream is done. This is calculated by enumerating all the file sizes once before the transfer is even started, and might as such have a negative impact on the performance. In particular, it might take longer before the first data is streamed. Since the database files can change during the backup, the size is only approximate and might both grow and shrink between the time of approximation and the sending of the actual files. The default is false. trueの場合、進行状況の報告を生成するために必要な情報を要求します。 これは、ストリームが完了するまでにどのくらいかかるかを計算するために使用することができる、各テーブル空間のヘッダ内の概算容量を返送します。 これは、転送を始める前のすべてのファイルサイズを1度数え上げることで計算されます。 これ自体が性能に与える悪影響があるかもしれません。 特に最初のデータがストリームされるまでにより多くの時間がかかる可能性があります。 データベースファイルはバックアップの間変更される可能性がありますので、容量は概算に過ぎず、概算時と実ファイルを送信するまでの間に増減される可能性があります。 デフォルトはfalseです。

CHECKPOINT { 'fast' | 'spread' }

Sets the type of checkpoint to be performed at the beginning of the base backup. The default is <literal>spread</literal>. ベースバックアップの開始時に実行されるチェックポイントのタイプを設定します。 デフォルトはspreadです。

WAL [ boolean ]

If set to true, include the necessary WAL segments in the backup. This will include all the files between start and stop backup in the <filename>pg_wal</filename> directory of the base directory tar file. The default is false. trueの場合、バックアップ内に必要なWALセグメントを含めます。 ベースディレクトリtarファイルのpg_walディレクトリにある、バックアップの開始から終了までのすべてのファイルが含まれます。 デフォルトはfalseです。

WAIT [ boolean ]

If set to true, the backup will wait until the last required WAL segment has been archived, or emit a warning if WAL archiving is not enabled. If false, the backup will neither wait nor warn, leaving the client responsible for ensuring the required log is available. The default is true. trueの場合、バックアップは必要な最終WALセグメントがアーカイブされるまで待機します。 WALアーカイブが有効でない場合は警告が発せられます。 falseの場合、バックアップは待機も警告もせず、必要なログが利用できるようになったことの確認をクライアントに任せます。 デフォルトはtrueです。

COMPRESSION 'method'

Instructs the server to compress the backup using the specified method. Currently, the supported methods are <literal>gzip</literal>, <literal>lz4</literal>, and <literal>zstd</literal>. 指定された方法を使用してバックアップを圧縮するようサーバに指示します。 現在サポートされている方法は、gziplz4およびzstdです。

COMPRESSION_DETAIL detail

Specifies details for the chosen compression method. This should only be used in conjunction with the <literal>COMPRESSION</literal> option. If the value is an integer, it specifies the compression level. Otherwise, it should be a comma-separated list of items, each of the form <replaceable>keyword</replaceable> or <replaceable>keyword=value</replaceable>. Currently, the supported keywords are <literal>level</literal>, <literal>long</literal> and <literal>workers</literal>. 選択した圧縮方法の詳細を指定します。 これはCOMPRESSIONオプションと一緒にのみ使用します。 値が整数の場合は、圧縮レベルを指定します。 それ以外の場合は、カンマで区切られたアイテムのリストであり、それぞれの形式はkeywordまたはkeyword=valueです。 現在サポートされているキーワードはlevellongおよびworkersです。

The <literal>level</literal> keyword sets the compression level. For <literal>gzip</literal> the compression level should be an integer between <literal>1</literal> and <literal>9</literal> (default <literal>Z_DEFAULT_COMPRESSION</literal> or <literal>-1</literal>), for <literal>lz4</literal> an integer between 1 and 12 (default <literal>0</literal> for fast compression mode), and for <literal>zstd</literal> an integer between <literal>ZSTD_minCLevel()</literal> (usually <literal>-131072</literal>) and <literal>ZSTD_maxCLevel()</literal> (usually <literal>22</literal>), (default <literal>ZSTD_CLEVEL_DEFAULT</literal> or <literal>3</literal>). levelキーワードは圧縮レベルを設定します。 gzipの場合、圧縮レベルは1から9までの整数(デフォルトZ_DEFAULT_COMPRESSIONまたは-1)、lz4の場合は1から12までの整数(高速圧縮モードの場合デフォルト0)、zstdの場合はZSTD_minCLevel()(通常-131072)からZSTD_maxCLevel()(通常は22)、(デフォルトはZSTD_CLEVEL_DEFAULTまたは3)までの整数です。

The <literal>long</literal> keyword enables long-distance matching mode, for improved compression ratio, at the expense of higher memory use. Long-distance mode is supported only for <literal>zstd</literal>. longキーワードは、長距離一致モードを有効にします。 これにより、圧縮率は向上しますが、メモリ使用量は増加します。 長距離モードはzstdに対してのみサポートされます。

The <literal>workers</literal> keyword sets the number of threads that should be used for parallel compression. Parallel compression is supported only for <literal>zstd</literal>. workersキーワードは、並列圧縮に使用するスレッドの数を設定します。 並列圧縮はzstdでのみサポートされています。

MAX_RATE rate

Limit (throttle) the maximum amount of data transferred from server to client per unit of time. The expected unit is kilobytes per second. If this option is specified, the value must either be equal to zero or it must fall within the range from 32 kB through 1 GB (inclusive). If zero is passed or the option is not specified, no restriction is imposed on the transfer. サーバからクライアントへ転送する単位時間当たりの最大データ容量を制限します(絞ります)。 予期される単位はkB/s(キロバイト/秒)です。 このオプションが指定された場合、値はゼロまたは32 kB以上1 GB以下でなければなりません。 ゼロが渡されるかオプションが指定されない場合、転送の制約は課されません。

TABLESPACE_MAP [ boolean ]

If true, include information about symbolic links present in the directory <filename>pg_tblspc</filename> in a file named <filename>tablespace_map</filename>. The tablespace map file includes each symbolic link name as it exists in the directory <filename>pg_tblspc/</filename> and the full path of that symbolic link. The default is false. trueの場合、ディレクトリpg_tblspcにあるシンボリックリンクに関する情報をtablespace_mapという名前のファイルに含めます。 テーブル空間マップファイルには、ディレクトリpg_tblspc/に存在する各シンボリックリンクの名前とそのシンボリックリンクのフルパスが含まれています。 デフォルトはfalseです。

VERIFY_CHECKSUMS [ boolean ]

If true, checksums are verified during a base backup if they are enabled. If false, this is skipped. The default is true. trueの場合、チェックサムが有効になっていれば、ベース・バックアップ中にチェックサムが検証されます。 falseの場合、スキップされます。 デフォルトはtrueです。

MANIFEST manifest_option

When this option is specified with a value of <literal>yes</literal> or <literal>force-encode</literal>, a backup manifest is created and sent along with the backup. The manifest is a list of every file present in the backup with the exception of any WAL files that may be included. It also stores the size, last modification time, and optionally a checksum for each file. A value of <literal>force-encode</literal> forces all filenames to be hex-encoded; otherwise, this type of encoding is performed only for files whose names are non-UTF8 octet sequences. <literal>force-encode</literal> is intended primarily for testing purposes, to be sure that clients which read the backup manifest can handle this case. For compatibility with previous releases, the default is <literal>MANIFEST 'no'</literal>. このオプションをyesまたはforce-encodeの値で設定すると、バックアップマニフェストが作成され、バックアップとともに送信されます。 マニフェストは、含まれる可能性のあるWALファイルを除きバックアップ内に存在するすべてのファイルのリストです。 また、サイズ、最終更新時刻、オプションでファイル毎のチェックサムも格納します。 force-encodeの値は、全てのファイル名を強制的に16進数でエンコーディングします。 それ以外の場合、このタイプのエンコードは、名前が非UTF-8オクテットシーケンスであるファイルに対してのみ実行されます。 force-encodeは、主にテスト目的で使用されており、バックアップマニュフェストを読み取るクライアントがこのケースを処理できることを確認するために使用されます。 以前のリリースとの互換性を保つため、デフォルトは、MANIFEST 'no'です。

MANIFEST_CHECKSUMS checksum_algorithm

Specifies the checksum algorithm that should be applied to each file included in the backup manifest. Currently, the available algorithms are <literal>NONE</literal>, <literal>CRC32C</literal>, <literal>SHA224</literal>, <literal>SHA256</literal>, <literal>SHA384</literal>, and <literal>SHA512</literal>. The default is <literal>CRC32C</literal>. バックアップマニュフェストに含まれている各ファイルに適用するチェックサムアルゴリズムを指定します。 現在使用可能なアルゴリズムは、NONECRC32CSHA224, SHA256SHA384SHA512です。 デフォルトはCRC32Cです。

When the backup is started, the server will first send two ordinary result sets, followed by one or more CopyOutResponse results. バックアップを開始する時、サーバはまず2つの通常の結果セットを送信し、続けて1つ以上のCopyOutResponse結果を送信します。

The first ordinary result set contains the starting position of the backup, in a single row with two columns. The first column contains the start position given in XLogRecPtr format, and the second column contains the corresponding timeline ID. 最初の通常の結果セットには、1行2列という形でバックアップの開始位置が含まれます。 最初の列にはXLogRecPtr書式の開始位置が、2番目の列には対応するタイムラインIDが含まれます。

The second ordinary result set has one row for each tablespace. The fields in this row are: 2番目の通常の結果セットには各テーブル空間に付き1行を持ちます。 この行のフィールドは以下の通りです。

spcoid (oid)

The OID of the tablespace, or null if it's the base directory. テーブル空間のOIDです。 ベースディレクトリの場合はNULLです。

spclocation (text)

The full path of the tablespace directory, or null if it's the base directory. テーブル空間ディレクトリのフルパスです。 ベースディレクトリの場合はNULLです。

size (int8)

The approximate size of the tablespace, in kilobytes (1024 bytes), if progress report has been requested; otherwise it's null. 進行状況の報告が要求された場合は、テーブル空間の概算容量です(キロバイト(1024バイト)単位)。 要求されていない場合はNULLです。

After the second regular result set, a CopyOutResponse will be sent. The payload of each CopyData message will contain a message in one of the following formats: 2番目の通常の結果セットの後、CopyOutResponseが送信されます。 各CopyDataメッセージのペイロードには、次のいずれかの形式のメッセージが含まれます

new archive (B)
Byte1('n')

Identifies the message as indicating the start of a new archive. There will be one archive for the main data directory and one for each additional tablespace; each will use tar format (following the <quote>ustar interchange format</quote> specified in the POSIX 1003.1-2008 standard). 新規アーカイブの開始を示すメッセージを識別します。 メイン・データ・ディレクトリ用に1つのアーカイブがあり、追加表領域ごとに1つのアーカイブがあります。 各アーカイブはtarフォーマットを使用します(POSIX 1003.1-2008標準で規定されているustar交換形式に従う)。

String

The file name for this archive. このアーカイブのファイル名。

String

For the main data directory, an empty string. For other tablespaces, the full path to the directory from which this archive was created. メインデータディレクトリの場合は空の文字列。 その他のテーブルスペースの場合は、このアーカイブが作成されたディレクトリへのフルパス。

manifest (B)
Byte1('m')

Identifies the message as indicating the start of the backup manifest. バックアップマニフェストの開始を示すメッセージを識別します。

archive or manifest data (B)
Byte1('d')

Identifies the message as containing archive or manifest data. メッセージにアーカイブデータまたはマニフェストデータが含まれていることを識別します。

Byten

Data bytes. データバイト。

progress report (B)
Byte1('p')

Identifies the message as a progress report. メッセージが進捗レポートであることを識別します。

Int64

The number of bytes from the current tablespace for which processing has been completed. 処理が完了した現在の表領域のバイト数。

After the CopyOutResponse, or all such responses, have been sent, a final ordinary result set will be sent, containing the WAL end position of the backup, in the same format as the start position. CopyOutResponse、あるいはこのような応答の全てが送信された後に、バックアップのWAL終了位置を含む通常の最終結果セットが開始位置と同じフォーマットで送信されます。

The tar archive for the data directory and each tablespace will contain all files in the directories, regardless of whether they are <productname>PostgreSQL</productname> files or other files added to the same directory. The only excluded files are: データディレクトリと各テーブル空間のtarアーカイブには、そのディレクトリ内のファイルがPostgreSQLファイルかそのディレクトリに追加された他のファイルかに関係なく、すべて含まれます。 以下に除かれるファイルを示します。

  • postmaster.pid

  • postmaster.opts

  • <filename>pg_internal.init</filename> (found in multiple directories) pg_internal.init(複数のディレクトリに在ります)

  • Various temporary files and directories created during the operation of the PostgreSQL server, such as any file or directory beginning with <filename>pgsql_tmp</filename> and temporary relations. PostgreSQLサーバの操作中に作成される種々の一時ファイルおよびディレクトリで、pgsql_tmpで始まるすべてのファイルおよびディレクトリ、および一時リレーション。

  • Unlogged relations, except for the init fork which is required to recreate the (empty) unlogged relation on recovery. ログを取らないリレーション。ただし、リカバリでログを取らないリレーションの再作成に必要なinitフォークは除かれない。

  • <filename>pg_wal</filename>, including subdirectories. If the backup is run with WAL files included, a synthesized version of <filename>pg_wal</filename> will be included, but it will only contain the files necessary for the backup to work, not the rest of the contents. サブディレクトリを含むpg_wal。 バックアップがwalファイルを含めて実行される場合、合成された版のpg_walが含まれます。 これにはバックアップが動作するために必要なファイルのみが含まれ、残りの内容は含まれません。

  • <filename>pg_dynshmem</filename>, <filename>pg_notify</filename>, <filename>pg_replslot</filename>, <filename>pg_serial</filename>, <filename>pg_snapshots</filename>, <filename>pg_stat_tmp</filename>, and <filename>pg_subtrans</filename> are copied as empty directories (even if they are symbolic links). pg_dynshmempg_notifypg_replslotpg_serialpg_snapshotspg_stat_tmppg_subtransは(それがシンボリックリンクであったとしても)空のディレクトリとしてコピーされます。

  • Files other than regular files and directories, such as symbolic links (other than for the directories listed above) and special device files, are skipped. (Symbolic links in <filename>pg_tblspc</filename> are maintained.) シンボリックリンク(上記で列挙したディレクトリは除きます)や特殊デバイスファイルなど、通常のファイルとディレクトリ以外のものは省略されます。 (pg_tblspc中のシンボリックリンクは保持されます。)

Owner, group, and file mode are set if the underlying file system on the server supports it. サーバ上の基盤となるファイルシステムがサポートする場合、所有者、グループ、ファイルのモードが設定されます。