-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-pgcreatesubscriber.html
More file actions
484 lines (483 loc) · 44.5 KB
/
app-pgcreatesubscriber.html
File metadata and controls
484 lines (483 loc) · 44.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>pg_createsubscriber</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="app-pgcontroldata.html" title="pg_controldata" /><link rel="next" href="app-pg-ctl.html" title="pg_ctl" /><meta name="viewport" content="width=device-width,initial-scale=1.0" /></head><body id="docContent" class="container-fluid col-10"><div class="other_version"><a href="https://www.postgresql.jp/document/">バージョンごとのドキュメント一覧</a></div><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="4" align="center"><a accesskey="h" href="index.html">PostgreSQL 17beta2文書</a></th></tr><tr><td width="10%" align="left"></td><td width="10%" align="left"></td><td width="60%" align="center"><a href="reference-server.html" title="PostgreSQLサーバアプリケーション">PostgreSQLサーバアプリケーション</a></td><td width="20%" align="right"><div class="actions"><a class="issue" title="github" href="https://github.com/pgsql-jp/jpug-doc/issues/new?template=bug_report.yml&what-happened=version 17beta2 : app-pgcreatesubscriber.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-pgcontroldata.html" title="pg_controldata">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-server.html" title="PostgreSQLサーバアプリケーション">上へ</a></td><td width="60%" align="center"><span class="application">pg_createsubscriber</span></td><td width="20%" align="right"> <a accesskey="n" href="app-pg-ctl.html" title="pg_ctl">次へ</a></td></tr></table><hr /></div><div class="refentry" id="APP-PGCREATESUBSCRIBER"><div class="titlepage"></div><a id="id-1.9.5.7.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">pg_createsubscriber</span></span></h2><p>pg_createsubscriber — convert a physical replica into a new logical replica</p></div><div class="refsynopsisdiv"><h2>概要</h2><div class="cmdsynopsis"><p id="id-1.9.5.7.4.1"><code class="command">pg_createsubscriber</code> [<em class="replaceable"><code>option</code></em>...] { <code class="option">-d</code> | <code class="option">--database</code> }<em class="replaceable"><code>dbname</code></em> { <code class="option">-D</code> | <code class="option">--pgdata</code> }<em class="replaceable"><code>datadir</code></em> { <code class="option">-P</code> | <code class="option">--publisher-server</code> }<em class="replaceable"><code>connstr</code></em> </p></div></div><div class="refsect1" id="id-1.9.5.7.5"><h2>説明</h2><span class="original">
<title>Description</title>
</span><p>
<span class="original">
<application>pg_createsubscriber</application> creates a new logical
replica from a physical standby server. All tables in the specified
database are included in the logical replication setup. A pair of
publication and subscription objects are created for each database. It
must be run at the target server.
</span>
《機械翻訳》<span class="application">pg_createsubscriber</span>は、物理スタンバイサーバから新しい論理レプリカを作成します。
指定されたデータベース内のすべてのテーブルが論理レプリケーション設定に含まれます。
各データベースに対して、パブリケーションとサブスクリプションのオブジェクトのペアが作成されます。
ターゲットサーバで実行する必要があります。
</p><p>
<span class="original">
After a successful run, the state of the target server is analogous to a
fresh logical replication setup. The main difference between the logical
replication setup and <application>pg_createsubscriber</application> is the
initial data copy. It does only the synchronization phase, which ensures
each table is brought up to a synchronized state.
</span>
《機械翻訳》正常に実行された後、ターゲットサーバの状態は、新しい論理レプリケーションセットアップと同様になります。
論理レプリケーションセットアップと<span class="application">pg_createsubscriber</span>の主な違いは、最初のデータコピーです。
同期フェーズのみを実行し、各テーブルが同期された状態になるようにします。
</p><p>
<span class="original">
The <application>pg_createsubscriber</application> targets large database
systems because in logical replication setup, most of the time is spent
doing the initial data copy. Furthermore, a side effect of this long time
spent synchronizing data is usually a large amount of changes to be applied
(that were produced during the initial data copy), which increases even
more the time when the logical replica will be available. For smaller
databases, <link linkend="logical-replication-row-filter-initial-data-sync">
initial data synchronization</link> is recommended.
</span>
《機械翻訳》<span class="application">pg_createsubscriber</span>は、論理的なレプリケーションの設定において、ほとんどの時間が最初のデータコピーの実行に費やされるため、大規模なデータベースシステムを対象としています。
さらに、データの同期に長い時間がかかるため、通常は適用する必要のある大量の変更が発生します(これらの変更は、最初のデータ・コピー中に生成されます)。
このため、論理レプリカを使用できるようになるまでの時間がさらに長くなります。
小規模なデータベースでは、<a class="link" href="logical-replication-row-filter.html#LOGICAL-REPLICATION-ROW-FILTER-INITIAL-DATA-SYNC" title="29.4.5. 初期データ同期">初期データ同期</a>をお勧めします。
</p></div><div class="refsect1" id="id-1.9.5.7.6"><h2>オプション</h2><span class="original">
<title>Options</title>
</span><p>
<span class="original">
<application>pg_createsubscriber</application> accepts the following
command-line arguments:
</span>
《機械翻訳》<span class="application">pg_createsubscriber</span>は、以下のコマンドライン引数を受け付けます。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-d <em class="replaceable"><code>dbname</code></em></code><br /></span><span class="term"><code class="option">--database=<em class="replaceable"><code>dbname</code></em></code></span></dt><dd><p>
<span class="original">
The database name to create the subscription. Multiple databases can
be selected by writing multiple <option>-d</option> switches.
</span>
《機械翻訳》サブスクリプションを作成するデータベース名。
複数の<code class="option">-d</code>スイッチを書くことで、複数のデータベースを選択できます。
</p></dd><dt><span class="term"><code class="option">-D <em class="replaceable"><code>directory</code></em></code><br /></span><span class="term"><code class="option">--pgdata=<em class="replaceable"><code>directory</code></em></code></span></dt><dd><p>
<span class="original">
The target directory that contains a cluster directory from a physical
replica.
</span>
《機械翻訳》物理レプリカのクラスタ ディレクトリを含むターゲット ディレクトリ。
</p></dd><dt><span class="term"><code class="option">-n</code><br /></span><span class="term"><code class="option">--dry-run</code></span></dt><dd><p>
<span class="original">
Do everything except actually modifying the target directory.
</span>
《機械翻訳》ターゲットディレクトリを実際に更新する以外はすべてのことを行います。
</p></dd><dt><span class="term"><code class="option">-p <em class="replaceable"><code>port</code></em></code><br /></span><span class="term"><code class="option">--subscriber-port=<em class="replaceable"><code>port</code></em></code></span></dt><dd><p>
<span class="original">
The port number on which the target server is listening for
connections. Defaults to running the target server on port 50432 to
avoid unintended client connections.
</span>
《機械翻訳》ターゲット・サーバーが接続をリスニングするポート番号。
デフォルトでは、ターゲット・サーバーはポート50432で実行され、意図しないクライアント接続を回避します。
</p></dd><dt><span class="term"><code class="option">-P <em class="replaceable"><code>connstr</code></em></code><br /></span><span class="term"><code class="option">--publisher-server=<em class="replaceable"><code>connstr</code></em></code></span></dt><dd><p>
<span class="original">
The connection string to the publisher. For details see <xref
linkend="libpq-connstring"/>.
</span>
《機械翻訳》パブリッシャへの接続文字列。
詳細は<a class="xref" href="libpq-connect.html#LIBPQ-CONNSTRING" title="32.1.1. 接続文字列">32.1.1</a>を参照してください。
</p></dd><dt><span class="term"><code class="option">-s <em class="replaceable"><code>dir</code></em></code><br /></span><span class="term"><code class="option">--socket-directory=<em class="replaceable"><code>dir</code></em></code></span></dt><dd><p>
<span class="original">
The directory to use for postmaster sockets on target server. The
default is current directory.
</span>
《機械翻訳》ターゲットサーバー上のpostmasterソケットに使用するディレクトリ。
デフォルトは現在のディレクトリです。
</p></dd><dt><span class="term"><code class="option">-t <em class="replaceable"><code>seconds</code></em></code><br /></span><span class="term"><code class="option">--recovery-timeout=<em class="replaceable"><code>seconds</code></em></code></span></dt><dd><p>
<span class="original">
The maximum number of seconds to wait for recovery to end. Setting to
0 disables. The default is 0.
</span>
《機械翻訳》リカバリーが終了するまでの最大待ち時間(秒)。
0に設定すると無効になります。
デフォルトは0です。
</p></dd><dt><span class="term"><code class="option">-U <em class="replaceable"><code>username</code></em></code><br /></span><span class="term"><code class="option">--subscriber-username=<em class="replaceable"><code>username</code></em></code></span></dt><dd><p>
<span class="original">
The user name to connect as on target server. Defaults to the current
operating system user name.
</span>
《機械翻訳》ターゲット・サーバーに接続するためのユーザー名。
デフォルトは、現在のオペレーティング・システム・ユーザー名です。
</p></dd><dt><span class="term"><code class="option">-v</code><br /></span><span class="term"><code class="option">--verbose</code></span></dt><dd><p>
<span class="original">
Enables verbose mode. This will cause
<application>pg_createsubscriber</application> to output progress
messages and detailed information about each step to standard error.
Repeating the option causes additional debug-level messages to appear
on standard error.
</span>
《機械翻訳》冗長モードを有効にします。
これにより<span class="application">pg_createsubscriber</span>は進捗メッセージと各ステップの詳細情報を標準エラーに出力します。
オプションを繰り返すと、追加のデバッグレベルメッセージが標準エラーに出力されます。
</p></dd><dt><span class="term"><code class="option">--config-file=<em class="replaceable"><code>filename</code></em></code></span></dt><dd><p>
<span class="original">
Use the specified main server configuration file for the target data
directory. The <application>pg_createsubscriber</application> uses
internally the <application>pg_ctl</application> command to start and
stop the target server. It allows you to specify the actual
<filename>postgresql.conf</filename> configuration file if it is stored
outside the data directory.
</span>
《機械翻訳》ターゲットデータディレクトリに指定したメインサーバ設定ファイルを使用します。
<span class="application">pg_createsubscriber</span>は内部的に<span class="application">pg_ctl</span>コマンドを使用してターゲットサーバを起動および停止します。
これにより、実際の<code class="filename">postgresql.conf</code>設定ファイルがデータディレクトリの外部に保存されている場合に、その設定ファイルを指定することができます。
</p></dd><dt><span class="term"><code class="option">--publication=<em class="replaceable"><code>name</code></em></code></span></dt><dd><p>
<span class="original">
The publication name to set up the logical replication. Multiple
publications can be specified by writing multiple
<option>&#45;-publication</option> switches. The number of publication
names must match the number of specified databases, otherwise an error
is reported. The order of the multiple publication name switches must
match the order of database switches. If this option is not specified,
a generated name is assigned to the publication name.
</span>
《機械翻訳》論理レプリケーションを設定するパブリケーション名。
複数の<code class="option">--publication</code>スイッチを指定することで、複数のパブリケーションを指定できます。
パブリケーション名の数は、指定されたデータベースの数と一致する必要があります。
一致しない場合、エラーが報告されます。
パブリケーション名のスイッチの順序は、データベースのスイッチの順序と一致する必要があります。
このオプションを指定しない場合、生成された名前がパブリケーション名に割り当てられます。
</p></dd><dt><span class="term"><code class="option">--replication-slot=<em class="replaceable"><code>name</code></em></code></span></dt><dd><p>
<span class="original">
The replication slot name to set up the logical replication. Multiple
replication slots can be specified by writing multiple
<option>&#45;-replication-slot</option> switches. The number of
replication slot names must match the number of specified databases,
otherwise an error is reported. The order of the multiple replication
slot name switches must match the order of database switches. If this
option is not specified, the subscription name is assigned to the
replication slot name.
</span>
《機械翻訳》論理レプリケーションを設定するレプリケーションスロット名。
複数の<code class="option">--replication-slot</code>スイッチを書くことで、複数のレプリケーションスロットを指定できます。
レプリケーションスロット名の数は、指定されたデータベースの数と一致しなければなりません。
一致しない場合、エラーが報告されます。
複数のレプリケーションスロット名スイッチの順序は、データベーススイッチの順序と一致しなければなりません。
このオプションを指定しない場合、サブスクリプション名がレプリケーションスロット名に割り当てられます。
</p></dd><dt><span class="term"><code class="option">--subscription=<em class="replaceable"><code>name</code></em></code></span></dt><dd><p>
<span class="original">
The subscription name to set up the logical replication. Multiple
subscriptions can be specified by writing multiple
<option>&#45;-subscription</option> switches. The number of subscription
names must match the number of specified databases, otherwise an error
is reported. The order of the multiple subscription name switches must
match the order of database switches. If this option is not specified,
a generated name is assigned to the subscription name.
</span>
《機械翻訳》論理レプリケーションを設定するサブスクリプション名。
複数の<code class="option">--subscription</code>スイッチを指定することで、複数のサブスクリプションを指定できます。
サブスクリプション名の数は、指定されたデータベースの数と一致する必要があります。
一致しない場合、エラーが報告されます。
複数のサブスクリプション名スイッチの順序は、データベーススイッチの順序と一致する必要があります。
このオプションを指定しない場合、生成された名前がサブスクリプション名に割り当てられます。
</p></dd><dt><span class="term"><code class="option">-V</code><br /></span><span class="term"><code class="option">--version</code></span></dt><dd><p>
<span class="original">
Print the <application>pg_createsubscriber</application> version and exit.
</span>
《機械翻訳》<span class="application">pg_createsubscriber</span>のバージョンを出力して終了します。
</p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
<span class="original">
Show help about <application>pg_createsubscriber</application> command
line arguments, and exit.
</span>
《機械翻訳》<span class="application">pg_createsubscriber</span>コマンドライン引数についてのヘルプを表示し、終了します。
</p></dd></dl></div><p>
</p></div><div class="refsect1" id="id-1.9.5.7.7"><h2>注釈</h2><span class="original">
<title>Notes</title>
</span><div class="refsect2" id="id-1.9.5.7.7.2"><h3>Prerequisites</h3><p>
<span class="original">
There are some prerequisites for
<application>pg_createsubscriber</application> to convert the target server
into a logical replica. If these are not met, an error will be reported.
The source and target servers must have the same major version as the
<application>pg_createsubscriber</application>. The given target data
directory must have the same system identifier as the source data
directory. The given database user for the target data directory must have
privileges for creating <link
linkend="sql-createsubscription">subscriptions</link> and using <link
linkend="pg-replication-origin-advance"><function>pg_replication_origin_advance()</function></link>.
</span>
《機械翻訳》<span class="application">pg_createsubscriber</span>がターゲットサーバを論理レプリカに変換するためには、いくつかの前提条件があります。
これらの条件が満たされない場合、エラーが報告されます。
ソースサーバとターゲットサーバは<span class="application">pg_createsubscriber</span>と同じメジャーバージョンでなければなりません。
指定されたターゲット・データ・ディレクトリは、ソース・データ・ディレクトリと同じシステム識別子を持つ必要があります。
ターゲットデータディレクトリの指定されたデータベースユーザは、<a class="link" href="sql-createsubscription.html" title="CREATE SUBSCRIPTION">サブスクリプションの作成</a>と<a class="link" href="functions-admin.html#PG-REPLICATION-ORIGIN-ADVANCE"><code class="function">pg_replication_origin_advance()</code></a>を使用するための権限を持たなければなりません。
</p><p>
<span class="original">
The target server must be used as a physical standby. The target server
must have <xref linkend="guc-max-replication-slots"/> and <xref
linkend="guc-max-logical-replication-workers"/> configured to a value
greater than or equal to the number of specified databases. The target
server must have <xref linkend="guc-max-worker-processes"/> configured to a
value greater than the number of specified databases. The target server
must accept local connections.
</span>
《機械翻訳》ターゲット・サーバは、フィジカル・スタンバイとして使用する必要があります。
ターゲット・サーバの<a class="xref" href="runtime-config-replication.html#GUC-MAX-REPLICATION-SLOTS">max_replication_slots</a>と<a class="xref" href="runtime-config-replication.html#GUC-MAX-LOGICAL-REPLICATION-WORKERS">max_logical_replication_workers</a>は、指定されたデータベースの数以上の値に設定されている必要があります。
ターゲット・サーバの<a class="xref" href="runtime-config-resource.html#GUC-MAX-WORKER-PROCESSES">max_worker_processes</a>は、指定されたデータベースの数以上の値に設定されている必要があります。
ターゲット・サーバは、ローカル接続を受け入れる必要があります。
</p><p>
<span class="original">
The source server must accept connections from the target server. The
source server must not be in recovery. The source server must have <xref
linkend="guc-wal-level"/> as <literal>logical</literal>. The source server
must have <xref linkend="guc-max-replication-slots"/> configured to a value
greater than or equal to the number of specified databases plus existing
replication slots. The source server must have <xref
linkend="guc-max-wal-senders"/> configured to a value greater than or equal
to the number of specified databases and existing WAL sender processes.
</span>
《機械翻訳》ソース・サーバーはターゲット・サーバーからの接続を受け入れなければなりません。
ソース・サーバはリカバリ状態であってはなりません。
ソースサーバは<a class="xref" href="runtime-config-wal.html#GUC-WAL-LEVEL">wal_level</a>を<code class="literal">logical</code>にする必要があります。
ソースサーバは、指定されたデータベースの数に既存のレプリケーションスロットを加えた値以上に<a class="xref" href="runtime-config-replication.html#GUC-MAX-REPLICATION-SLOTS">max_replication_slots</a>を設定する必要があります。
ソースサーバは、指定されたデータベースの数以上の値に<a class="xref" href="runtime-config-replication.html#GUC-MAX-WAL-SENDERS">max_wal_senders</a>を設定する必要があります。
</p></div><div class="refsect2" id="id-1.9.5.7.7.3"><h3>Warnings</h3><p>
<span class="original">
If <application>pg_createsubscriber</application> fails after the target
server was promoted, then the data directory is likely not in a state that
can be recovered. In such case, creating a new standby server is
recommended.
</span>
《機械翻訳》ターゲットサーバの昇格後に<span class="application">pg_createsubscriber</span>が失敗した場合、データディレクトリはリカバリ可能な状態ではない可能性があります。
このような場合は、新しいスタンバイサーバを作成することをお勧めします。
</p><p>
<span class="original">
<application>pg_createsubscriber</application> usually starts the target
server with different connection settings during transformation. Hence,
connections to the target server should fail.
</span>
《機械翻訳》<span class="application">pg_createsubscriber</span>は通常、変換中に異なる接続設定でターゲットサーバを起動します。
したがって、ターゲットサーバへの接続は失敗するはずです。
</p><p>
<span class="original">
During the recovery process, if the target server disconnects from the
source server, <application>pg_createsubscriber</application> will check a
few times if the connection has been reestablished to stream the required
WAL. After a few attempts, it terminates with an error.
</span>
《機械翻訳》リカバリプロセス中に、ターゲットサーバがソースサーバから切断された場合、<span class="application">pg_createsubscriber</span>は、必要なWALをストリームするために接続が再確立されたかどうかを数回チェックします。
数回試行した後、エラーで終了します。
</p><p>
<span class="original">
Since DDL commands are not replicated by logical replication, avoid
executing DDL commands that change the database schema while running
<application>pg_createsubscriber</application>. If the target server has
already been converted to logical replica, the DDL commands might not be
replicated, which might cause an error.
</span>
《機械翻訳》DDLコマンドは論理レプリケーションではレプリケートされないため、<span class="application">pg_createsubscriber</span>の実行中にデータベーススキーマを変更するDDLコマンドは実行しないでください。
ターゲットサーバがすでに論理レプリカに変換されている場合、DDLコマンドはレプリケートされない可能性があり、エラーが発生する可能性があります。
</p><p>
<span class="original">
If <application>pg_createsubscriber</application> fails while processing,
objects (publications, replication slots) created on the source server are
removed. The removal might fail if the target server cannot connect to
the source server. In such a case, a warning message will inform the
objects left. If the target server is running, it will be stopped.
</span>
《機械翻訳》処理中に<span class="application">pg_createsubscriber</span>が失敗した場合、ソースサーバ上に作成されたオブジェクト(パブリケーション、レプリケーションスロット)は削除されます。
ターゲットサーバがソースサーバに接続できない場合、削除は失敗する可能性があります。
このような場合、警告メッセージが残されたオブジェクトを通知します。
ターゲットサーバが実行中の場合は、停止されます。
</p><p>
<span class="original">
If the replication is using <xref linkend="guc-primary-slot-name"/>, it
will be removed from the source server after the logical replication
setup.
</span>
《機械翻訳》レプリケーションが<a class="xref" href="runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME">primary_slot_name</a>を使用している場合、論理的なレプリケーション設定後にソースサーバから削除されます。
</p><p>
<span class="original">
If the target server is a synchronous replica, transaction commits on the
primary might wait for replication while running
<application>pg_createsubscriber</application>.
</span>
《機械翻訳》ターゲットサーバが同期レプリカの場合、<span class="application">pg_createsubscriber</span>の実行中にプライマリでのトランザクションコミットがレプリケーションを待つことがあります。
</p><p>
<span class="original">
<application>pg_createsubscriber</application> sets up logical
replication with two-phase commit disabled. This means that any
prepared transactions will be replicated at the time
of <command>COMMIT PREPARED</command>, without advance preparation.
Once setup is complete, you can manually drop and re-create the
subscription(s) with
the <link linkend="sql-createsubscription-params-with-two-phase"><literal>two_phase</literal></link>
option enabled.
</span>
《機械翻訳》<span class="application">pg_createsubscriber</span>は二相ロジカルレプリケーションを無効にしてコミットを設定します。
これは、準備されたトランザクションが事前の準備なしに<code class="command">コミットプリペアド</code>の時点で複製されることを意味します。
セットアップが完了したら、<a class="link" href="sql-createsubscription.html#SQL-CREATESUBSCRIPTION-PARAMS-WITH-TWO-PHASE"><code class="literal">two_phase</code></a>オプションを有効にしてサブスクリプションを手動で削除し、再作成することができます。
</p><p>
<span class="original">
<application>pg_createsubscriber</application> changes the system
identifier using <application>pg_resetwal</application>. It would avoid
situations in which the target server might use WAL files from the source
server. If the target server has a standby, replication will break and a
fresh standby should be created.
</span>
《機械翻訳》<span class="application">pg_createsubscriber</span>は<span class="application">pg_resetwal</span>を使用してシステム識別子を変更します。
これは、ターゲットサーバがソースサーバからのWALファイルを使用する可能性がある状況を回避します。
ターゲットサーバにスタンバイがある場合、レプリケーションが中断され、新しいスタンバイを作成する必要があります。
</p></div><div class="refsect2" id="id-1.9.5.7.7.4"><h3>How It Works</h3><p>
<span class="original">
The basic idea is to have a replication start point from the source server
and set up a logical replication to start from this point:
</span>
《機械翻訳》基本的な考え方は、ソース・サーバからレプリケーションの開始ポイントを設定し、このポイントから開始する論理レプリケーションをセットアップすることです。
</p><div class="procedure"><ol class="procedure" type="1"><li class="step"><p>
<span class="original">
Start the target server with the specified command-line options. If the
target server is already running,
<application>pg_createsubscriber</application> will terminate with an
error.
</span>
《機械翻訳》指定したコマンドラインオプションでターゲットサーバを起動します。
ターゲットサーバがすでに実行中の場合、<span class="application">pg_createsubscriber</span>はエラーで終了します。
</p></li><li class="step"><p>
<span class="original">
Check if the target server can be converted. There are also a few
checks on the source server. If any of the prerequisites are not met,
<application>pg_createsubscriber</application> will terminate with an
error.
</span>
《機械翻訳》ターゲットサーバを変換できるかどうかをチェックします。
ソースサーバに対してもいくつかのチェックが行われます。
前提条件のいずれかが満たされていない場合、<span class="application">pg_createsubscriber</span>はエラーで終了します。
</p></li><li class="step"><p>
<span class="original">
Create a publication and replication slot for each specified database on
the source server. Each publication is created using <link
linkend="sql-createpublication-params-for-all-tables"><literal>FOR ALL
TABLES</literal></link>. If <option>publication-name</option> option is
not specified, it has the following name pattern:
<quote><literal>pg_createsubscriber_%u_%x</literal></quote> (parameter:
database <parameter>oid</parameter>, random <parameter>int</parameter>).
If <option>replication-slot-name</option> is not specified, the
replication slot has the following name pattern:
<quote><literal>pg_createsubscriber_%u_%x</literal></quote> (parameters:
database <parameter>oid</parameter>, random <parameter>int</parameter>).
These replication slots will be used by the subscriptions in a future
step. The last replication slot LSN is used as a stopping point in the
<xref linkend="guc-recovery-target-lsn"/> parameter and by the
subscriptions as a replication start point. It guarantees that no
transaction will be lost.
</span>
《機械翻訳》ソース・サーバー上の指定されたデータベースごとに、パブリケーションとレプリケーション・スロットを作成します。
各パブリケーションは<a class="link" href="sql-createpublication.html#SQL-CREATEPUBLICATION-PARAMS-FOR-ALL-TABLES"><code class="literal">FOR ALL TABLES</code></a>を使用して作成されます。
<code class="option">publication-name</code>オプションが指定されていない場合、次の名前パターンになります。
<span class="quote">「<span class="quote"><code class="literal">pg_createsubscriber_%u_%x</code></span>」</span>(パラメータ: データベース<em class="parameter"><code>oid</code></em>,ランダム<em class="parameter"><code>int</code></em>)<code class="option">replication-slot-name</code>が指定されない場合、レプリケーションスロットは次の名前パターンを持ちます。
<span class="quote">「<span class="quote"><code class="literal">pg_createsubscriber_%u_%x</code></span>」</span>(パラメータ: データベース<em class="parameter"><code>oid</code></em>,ランダム<em class="parameter"><code>int</code></em>)これらのレプリケーション スロットは、今後の手順でサブスクリプションによって使用されます。
最後のレプリケーションスロットLSNは、<a class="xref" href="runtime-config-wal.html#GUC-RECOVERY-TARGET-LSN">recovery_target_lsn</a>パラメータの停止点として、また、サブスクリプションによってレプリケーション開始点として使用されます。
これにより、トランザクションが失われることがなくなります。
</p></li><li class="step"><p>
<span class="original">
Write recovery parameters into the target data directory and restart the
target server. It specifies an LSN (<xref
linkend="guc-recovery-target-lsn"/>) of the write-ahead log location up
to which recovery will proceed. It also specifies
<literal>promote</literal> as the action that the server should take
once the recovery target is reached. Additional <link
linkend="runtime-config-wal-recovery-target">recovery parameters</link>
are added to avoid unexpected behavior during the recovery process such
as end of the recovery as soon as a consistent state is reached (WAL
should be applied until the replication start location) and multiple
recovery targets that can cause a failure. This step finishes once the
server ends standby mode and is accepting read-write transactions. If
<option>&#45;-recovery-timeout</option> option is set,
<application>pg_createsubscriber</application> terminates if recovery
does not end until the given number of seconds.
</span>
《機械翻訳》ターゲット・データ・ディレクトリにリカバリ・パラメータを書き込み、ターゲット・サーバを再起動します。
リカバリが進行する先の先行書き込みログの場所のLSN(<a class="xref" href="runtime-config-wal.html#GUC-RECOVERY-TARGET-LSN">recovery_target_lsn</a>)を指定します。
また、リカバリ対象に到達した時点でサーバが取るべきアクションとして<code class="literal">promote</code>を指定します。
整合性のある状態に到達したらすぐにリカバリを終了する(WALはレプリケーション開始位置まで適用されるべきである)、複数のリカバリターゲットが障害を引き起こす可能性があるなど、リカバリプロセス中の予期しない動作を回避するために、<a class="link" href="runtime-config-wal.html#RUNTIME-CONFIG-WAL-RECOVERY-TARGET" title="19.5.6. リカバリターゲット">リカバリターゲット</a>の追加パラメータが追加されました。
このステップは、サーバがスタンバイモードを終了し、読み取り/書き込みトランザクションを受け入れると完了します。
<code class="option">--recovery-timeout</code>オプションが設定されている場合、指定された秒数が経過するまでリカバリが終了しない場合、<span class="application">pg_createsubscriber</span>は終了します。
</p></li><li class="step"><p>
<span class="original">
Create a subscription for each specified database on the target server.
If <option>subscription-name</option> is not specified, the subscription
has the following name pattern:
<quote><literal>pg_createsubscriber_%u_%x</literal></quote> (parameters:
database <parameter>oid</parameter>, random <parameter>int</parameter>).
It does not copy existing data from the source server. It does not
create a replication slot. Instead, it uses the replication slot that
was created in a previous step. The subscription is created but it is
not enabled yet. The reason is the replication progress must be set to
the replication start point before starting the replication.
</span>
《機械翻訳》ターゲット・サーバー上の指定した各データベースに対してサブスクリプションを作成します。
<code class="option">サブスクリプション名</code>が指定されない場合、サブスクリプションは次の名前パターンを持ちます。
<span class="quote">「<span class="quote"><code class="literal">pg_createsubscriber_%u_%x</code></span>」</span>(パラメータ: データベース<em class="parameter"><code>oid</code></em>,ランダム<em class="parameter"><code>int</code></em>)ソース・サーバから既存のデータをコピーしません。
レプリケーション・スロットは作成されません。
代わりに、前の手順で作成したレプリケーション スロットを使用します。
サブスクリプションは作成されましたが、まだ有効ではありません。
これは、レプリケーションを開始する前に、レプリケーションの進行状況をレプリケーション開始点に設定する必要があるためです。
</p></li><li class="step"><p>
<span class="original">
Drop publications on the target server that were replicated because they
were created before the replication start location. It has no use on
the subscriber.
</span>
《機械翻訳》レプリケーション開始位置より前に作成されたために複製されたパブリケーションを、ターゲット・サーバにドロップします。
加入者には何のメリットもない。
</p></li><li class="step"><p>
<span class="original">
Set the replication progress to the replication start point for each
subscription. When the target server starts the recovery process, it
catches up to the replication start point. This is the exact LSN to be
used as a initial replication location for each subscription. The
replication origin name is obtained since the subscription was created.
The replication origin name and the replication start point are used in
<link
linkend="pg-replication-origin-advance"><function>pg_replication_origin_advance()</function></link>
to set up the initial replication location.
</span>
《機械翻訳》各サブスクリプションのレプリケーション開始点にレプリケーションの進行状況を設定します。
ターゲット・サーバがリカバリ・プロセスを開始すると、レプリケーションの開始時点まで処理が追いつきます。
これは、各サブスクリプションの初期レプリケーションの場所として使用される正確なLSNです。
サブスクリプションが作成されたため,レプリケーション・オリジン名が取得されます複製起点名と複製開始点は、<a class="link" href="functions-admin.html#PG-REPLICATION-ORIGIN-ADVANCE"><code class="function">pg_replication_origin_advance()</code></a>で初期複製場所を設定するために使用されます。
</p></li><li class="step"><p>
<span class="original">
Enable the subscription for each specified database on the target server.
The subscription starts applying transactions from the replication start
point.
</span>
《機械翻訳》ターゲット・サーバー上の指定した各データベースのサブスクリプションを使用可能にします。
サブスクリプションは、レプリケーション開始ポイントからトランザクションを適用し始めます。
</p></li><li class="step"><p>
<span class="original">
If the standby server was using <xref linkend="guc-primary-slot-name"/>,
it has no use from now on so drop it.
</span>
《機械翻訳》スタンバイサーバが<a class="xref" href="runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME">primary_slot_name</a>を使用していた場合、それは今後は使用されないので削除してください。
</p></li><li class="step"><p>
<span class="original">
Update the system identifier on the target server. The
<xref linkend="app-pgresetwal"/> is run to modify the system identifier.
The target server is stopped as a <command>pg_resetwal</command> requirement.
</span>
《機械翻訳》ターゲットサーバのシステム識別子を更新します。
<a class="xref" href="app-pgresetwal.html" title="pg_resetwal"><span class="refentrytitle"><span class="application">pg_resetwal</span></span></a>が実行され、システム識別子が変更されます。
ターゲットサーバは<code class="command">pg_resetwal</code>の要件として停止されます。
</p></li></ol></div></div></div><div class="refsect1" id="id-1.9.5.7.8"><h2>例</h2><span class="original">
<title>Examples</title>
</span><p>
<span class="original">
To create a logical replica for databases <literal>hr</literal> and
<literal>finance</literal> from a physical replica at
<literal>foo</literal>:
</span>
《機械翻訳》物理レプリカからデータベース<code class="literal">hr</code>と<code class="literal">finance</code>の論理レプリカを作成するには、以下のようにします。
</p><pre class="screen">
<code class="prompt">$</code> <strong class="userinput"><code>pg_createsubscriber -D /usr/local/pgsql/data -P "host=foo" -d hr -d finance</code></strong>
</pre><p>
</p></div><div class="refsect1" id="id-1.9.5.7.9"><h2>関連項目</h2><span class="original">
<title>See Also</title>
</span><span class="simplelist"><a class="xref" href="app-pgbasebackup.html" title="pg_basebackup"><span class="refentrytitle"><span class="application">pg_basebackup</span></span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="app-pgcontroldata.html" title="pg_controldata">前へ</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-server.html" title="PostgreSQLサーバアプリケーション">上へ</a></td><td width="40%" align="right"> <a accesskey="n" href="app-pg-ctl.html" title="pg_ctl">次へ</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">pg_controldata</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 17beta2文書">ホーム</a></td><td width="40%" align="right" valign="top"> <span class="application">pg_ctl</span></td></tr></table></div></body></html>