-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-pgcreatesubscriber.html
More file actions
388 lines (387 loc) · 36.5 KB
/
Copy pathapp-pgcreatesubscriber.html
File metadata and controls
388 lines (387 loc) · 36.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
<?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="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="4" align="center"><a accesskey="h" href="index.html">PostgreSQL 17devel文書</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"></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><!--
<title>Description</title>
--><p>
<!--
<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 class="application">pg_createsubscriber</span> 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.»
</p><p>
<!--
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.
-->
《機械翻訳》«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 <span class="application">pg_createsubscriber</span> is the initial data copy. It does only the synchronization phase, which ensures each table is brought up to a synchronized state.»
</p><p>
<!--
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.
-->
《機械翻訳》«The <span class="application">pg_createsubscriber</span> 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, <a class="link" href="logical-replication-row-filter.html#LOGICAL-REPLICATION-ROW-FILTER-INITIAL-DATA-SYNC" title="29.3.5. 初期データ同期"> initial data synchronization</a> is recommended.»
</p></div><div class="refsect1" id="id-1.9.5.7.6"><h2>オプション</h2><!--
<title>Options</title>
--><p>
<!--
<application>pg_createsubscriber</application> accepts the following
command-line arguments:
-->
《機械翻訳》«<span class="application">pg_createsubscriber</span> accepts the following command-line arguments:»
</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>
<!--
The database name to create the subscription. Multiple databases can
be selected by writing multiple <option>-d</option> switches.
-->
《機械翻訳》«The database name to create the subscription. Multiple databases can be selected by writing multiple <code class="option">-d</code> switches.»
</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>
<!--
The target directory that contains a cluster directory from a physical
replica.
-->
《機械翻訳》«The target directory that contains a cluster directory from a physical replica.»
</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>
<!--
Do everything except actually modifying the target directory.
-->
《機械翻訳》«Do everything except actually modifying the target directory.»
</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>
<!--
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.
-->
《機械翻訳》«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.»
</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>
<!--
The connection string to the publisher. For details see <xref
linkend="libpq-connstring"/>.
-->
《機械翻訳》«The connection string to the publisher. For details see <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>
<!--
The directory to use for postmaster sockets on target server. The
default is current directory.
-->
《機械翻訳》«The directory to use for postmaster sockets on target server. The default is current directory.»
</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>
<!--
The maximum number of seconds to wait for recovery to end. Setting to
0 disables. The default is 0.
-->
《機械翻訳》«The maximum number of seconds to wait for recovery to end. Setting to 0 disables. The default is 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>
<!--
The user name to connect as on target server. Defaults to the current
operating system user name.
-->
《機械翻訳》«The user name to connect as on target server. Defaults to the current operating system user name.»
</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>
<!--
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.
-->
《機械翻訳》«Enables verbose mode. This will cause <span class="application">pg_createsubscriber</span> 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.»
</p></dd><dt><span class="term"><code class="option">--config-file=<em class="replaceable"><code>filename</code></em></code></span></dt><dd><p>
<!--
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.
-->
《機械翻訳》«Use the specified main server configuration file for the target data directory. The <span class="application">pg_createsubscriber</span> uses internally the <span class="application">pg_ctl</span> command to start and stop the target server. It allows you to specify the actual <code class="filename">postgresql.conf</code> configuration file if it is stored outside the data directory.»
</p></dd><dt><span class="term"><code class="option">--publication=<em class="replaceable"><code>name</code></em></code></span></dt><dd><p>
<!--
The publication name to set up the logical replication. Multiple
publications can be specified by writing multiple
<option>--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.
-->
《機械翻訳》«The publication name to set up the logical replication. Multiple publications can be specified by writing multiple <code class="option">--publication</code> 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.»
</p></dd><dt><span class="term"><code class="option">--replication-slot=<em class="replaceable"><code>name</code></em></code></span></dt><dd><p>
<!--
The replication slot name to set up the logical replication. Multiple
replication slots can be specified by writing multiple
<option>--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.
-->
《機械翻訳》«The replication slot name to set up the logical replication. Multiple replication slots can be specified by writing multiple <code class="option">--replication-slot</code> 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.»
</p></dd><dt><span class="term"><code class="option">--subscription=<em class="replaceable"><code>name</code></em></code></span></dt><dd><p>
<!--
The subscription name to set up the logical replication. Multiple
subscriptions can be specified by writing multiple
<option>--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.
-->
《機械翻訳》«The subscription name to set up the logical replication. Multiple subscriptions can be specified by writing multiple <code class="option">--subscription</code> 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.»
</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>
<!--
Print the <application>pg_createsubscriber</application> version and exit.
-->
《機械翻訳》«Print the <span class="application">pg_createsubscriber</span> version and exit.»
</p></dd><dt><span class="term"><code class="option">-?</code><br /></span><span class="term"><code class="option">--help</code></span></dt><dd><p>
<!--
Show help about <application>pg_createsubscriber</application> command
line arguments, and exit.
-->
《機械翻訳》«Show help about <span class="application">pg_createsubscriber</span> command line arguments, and exit.»
</p></dd></dl></div><p>
</p></div><div class="refsect1" id="id-1.9.5.7.7"><h2>注釈</h2><!--
<title>Notes</title>
--><div class="refsect2" id="id-1.9.5.7.7.2"><h3>Prerequisites</h3><p>
<!--
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>.
-->
《機械翻訳》«There are some prerequisites for <span class="application">pg_createsubscriber</span> 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 <span class="application">pg_createsubscriber</span>. 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 <a class="link" href="sql-createsubscription.html" title="CREATE SUBSCRIPTION">subscriptions</a> and using <a class="link" href="functions-admin.html#PG-REPLICATION-ORIGIN-ADVANCE"><code class="function">pg_replication_origin_advance()</code></a>.»
</p><p>
<!--
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.
-->
《機械翻訳》«The target server must be used as a physical standby. The target server must have <a class="xref" href="runtime-config-replication.html#GUC-MAX-REPLICATION-SLOTS">max_replication_slots</a> and <a class="xref" href="runtime-config-replication.html#GUC-MAX-LOGICAL-REPLICATION-WORKERS">max_logical_replication_workers</a> configured to a value greater than or equal to the number of specified databases. The target server must have <a class="xref" href="runtime-config-resource.html#GUC-MAX-WORKER-PROCESSES">max_worker_processes</a> configured to a value greater than the number of specified databases. The target server must accept local connections.»
</p><p>
<!--
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.
-->
《機械翻訳》«The source server must accept connections from the target server. The source server must not be in recovery. The source server must have <a class="xref" href="runtime-config-wal.html#GUC-WAL-LEVEL">wal_level</a> as <code class="literal">logical</code>. The source server must have <a class="xref" href="runtime-config-replication.html#GUC-MAX-REPLICATION-SLOTS">max_replication_slots</a> configured to a value greater than or equal to the number of specified databases plus existing replication slots. The source server must have <a class="xref" href="runtime-config-replication.html#GUC-MAX-WAL-SENDERS">max_wal_senders</a> configured to a value greater than or equal to the number of specified databases and existing WAL sender processes.»
</p></div><div class="refsect2" id="id-1.9.5.7.7.3"><h3>Warnings</h3><p>
<!--
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.
-->
《機械翻訳》«If <span class="application">pg_createsubscriber</span> 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.»
</p><p>
<!--
<application>pg_createsubscriber</application> usually starts the target
server with different connection settings during transformation. Hence,
connections to the target server should fail.
-->
《機械翻訳》«<span class="application">pg_createsubscriber</span> usually starts the target server with different connection settings during transformation. Hence, connections to the target server should fail.»
</p><p>
<!--
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.
-->
《機械翻訳》«During the recovery process, if the target server disconnects from the source server, <span class="application">pg_createsubscriber</span> 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.»
</p><p>
<!--
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.
-->
《機械翻訳》«Since DDL commands are not replicated by logical replication, avoid executing DDL commands that change the database schema while running <span class="application">pg_createsubscriber</span>. If the target server has already been converted to logical replica, the DDL commands might not be replicated, which might cause an error.»
</p><p>
<!--
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.
-->
《機械翻訳》«If <span class="application">pg_createsubscriber</span> 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.»
</p><p>
<!--
If the replication is using <xref linkend="guc-primary-slot-name"/>, it
will be removed from the source server after the logical replication
setup.
-->
《機械翻訳》«If the replication is using <a class="xref" href="runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME">primary_slot_name</a>, it will be removed from the source server after the logical replication setup.»
</p><p>
<!--
If the target server is a synchronous replica, transaction commits on the
primary might wait for replication while running
<application>pg_createsubscriber</application>.
-->
《機械翻訳》«If the target server is a synchronous replica, transaction commits on the primary might wait for replication while running <span class="application">pg_createsubscriber</span>.»
</p><p>
<!--
<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 class="application">pg_createsubscriber</span> changes the system identifier using <span class="application">pg_resetwal</span>. 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.»
</p></div><div class="refsect2" id="id-1.9.5.7.7.4"><h3>How It Works</h3><p>
<!--
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:
-->
《機械翻訳》«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:»
</p><div class="procedure"><ol class="procedure" type="1"><li class="step"><p>
<!--
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.
-->
《機械翻訳》«Start the target server with the specified command-line options. If the target server is already running, <span class="application">pg_createsubscriber</span> will terminate with an error.»
</p></li><li class="step"><p>
<!--
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.
-->
《機械翻訳》«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, <span class="application">pg_createsubscriber</span> will terminate with an error.»
</p></li><li class="step"><p>
<!--
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.
-->
《機械翻訳》«Create a publication and replication slot for each specified database on the source server. Each publication is created using <a class="link" href="sql-createpublication.html#SQL-CREATEPUBLICATION-PARAMS-FOR-ALL-TABLES"><code class="literal">FOR ALL TABLES</code></a>. If <code class="option">publication-name</code> option is not specified, it has the following name pattern: <span class="quote">「<span class="quote"><code class="literal">pg_createsubscriber_%u_%x</code></span>」</span> (parameter: database <em class="parameter"><code>oid</code></em>, random <em class="parameter"><code>int</code></em>). If <code class="option">replication-slot-name</code> is not specified, the replication slot has the following name pattern: <span class="quote">「<span class="quote"><code class="literal">pg_createsubscriber_%u_%x</code></span>」</span> (parameters: database <em class="parameter"><code>oid</code></em>, random <em class="parameter"><code>int</code></em>). 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 <a class="xref" href="runtime-config-wal.html#GUC-RECOVERY-TARGET-LSN">recovery_target_lsn</a> parameter and by the subscriptions as a replication start point. It guarantees that no transaction will be lost.»
</p></li><li class="step"><p>
<!--
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>--recovery-timeout</option> option is set,
<application>pg_createsubscriber</application> terminates if recovery
does not end until the given number of seconds.
-->
《機械翻訳》«Write recovery parameters into the target data directory and restart the target server. It specifies an LSN (<a class="xref" href="runtime-config-wal.html#GUC-RECOVERY-TARGET-LSN">recovery_target_lsn</a>) of the write-ahead log location up to which recovery will proceed. It also specifies <code class="literal">promote</code> as the action that the server should take once the recovery target is reached. Additional <a class="link" href="runtime-config-wal.html#RUNTIME-CONFIG-WAL-RECOVERY-TARGET" title="19.5.6. リカバリターゲット">recovery parameters</a> 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 <code class="option">--recovery-timeout</code> option is set, <span class="application">pg_createsubscriber</span> terminates if recovery does not end until the given number of seconds.»
</p></li><li class="step"><p>
<!--
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.
-->
《機械翻訳》«Create a subscription for each specified database on the target server. If <code class="option">subscription-name</code> is not specified, the subscription has the following name pattern: <span class="quote">「<span class="quote"><code class="literal">pg_createsubscriber_%u_%x</code></span>」</span> (parameters: database <em class="parameter"><code>oid</code></em>, random <em class="parameter"><code>int</code></em>). 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.»
</p></li><li class="step"><p>
<!--
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.
-->
《機械翻訳》«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.»
</p></li><li class="step"><p>
<!--
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.
-->
《機械翻訳》«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 <a class="link" href="functions-admin.html#PG-REPLICATION-ORIGIN-ADVANCE"><code class="function">pg_replication_origin_advance()</code></a> to set up the initial replication location.»
</p></li><li class="step"><p>
<!--
Enable the subscription for each specified database on the target server.
The subscription starts applying transactions from the replication start
point.
-->
《機械翻訳》«Enable the subscription for each specified database on the target server. The subscription starts applying transactions from the replication start point.»
</p></li><li class="step"><p>
<!--
If the standby server was using <xref linkend="guc-primary-slot-name"/>,
it has no use from now on so drop it.
-->
《機械翻訳》«If the standby server was using <a class="xref" href="runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME">primary_slot_name</a>, it has no use from now on so drop it.»
</p></li><li class="step"><p>
<!--
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.
-->
《機械翻訳》«Update the system identifier on the target server. The <a class="xref" href="app-pgresetwal.html" title="pg_resetwal"><span class="refentrytitle"><span class="application">pg_resetwal</span></span></a> is run to modify the system identifier. The target server is stopped as a <code class="command">pg_resetwal</code> requirement.»
</p></li></ol></div></div></div><div class="refsect1" id="id-1.9.5.7.8"><h2>例</h2><!--
<title>Examples</title>
--><p>
<!--
To create a logical replica for databases <literal>hr</literal> and
<literal>finance</literal> from a physical replica at
<literal>foo</literal>:
-->
《機械翻訳》«To create a logical replica for databases <code class="literal">hr</code> and <code class="literal">finance</code> from a physical replica at <code class="literal">foo</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><!--
<title>See Also</title>
--><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 17devel文書">ホーム</a></td><td width="40%" align="right" valign="top"> <span class="application">pg_ctl</span></td></tr></table></div></body></html>