-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-pg-ctl.html
More file actions
526 lines (526 loc) · 48.3 KB
/
app-pg-ctl.html
File metadata and controls
526 lines (526 loc) · 48.3 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
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
<?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_ctl</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-pgcreatesubscriber.html" title="pg_createsubscriber" /><link rel="next" href="app-pgresetwal.html" title="pg_resetwal" /><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 18.3文書</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 18.3 : app-pg-ctl.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-pgcreatesubscriber.html" title="pg_createsubscriber">前へ</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_ctl</span></td><td width="20%" align="right"> <a accesskey="n" href="app-pgresetwal.html" title="pg_resetwal">次へ</a></td></tr></table><hr /></div><div class="refentry" id="APP-PG-CTL"><div class="titlepage"></div><a id="id-1.9.5.8.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">pg_ctl</span></span></h2><p>pg_ctl<span class="original">
<refpurpose>initialize, start, stop, or control a <productname>PostgreSQL</productname> server</refpurpose>
</span> — <span class="productname">PostgreSQL</span>サーバを初期化、起動、停止、制御する</p></div><div class="refsynopsisdiv"><h2>概要</h2><div class="cmdsynopsis"><p id="id-1.9.5.8.4.1"><code class="command">pg_ctl</code> <code class="option">init[db]</code> [<code class="option">-D</code> <em class="replaceable"><code>datadir</code></em>] [<code class="option">-s</code>] [<code class="option">-o</code> <em class="replaceable"><code>initdb-options</code></em>]</p></div><div class="cmdsynopsis"><p id="id-1.9.5.8.4.2"><code class="command">pg_ctl</code> <code class="option">start</code> [<code class="option">-D</code> <em class="replaceable"><code>datadir</code></em>] [<code class="option">-l</code> <em class="replaceable"><code>filename</code></em>] [<code class="option">-W</code>] [<code class="option">-t</code> <em class="replaceable"><code>seconds</code></em>] [<code class="option">-s</code>] [<code class="option">-o</code> <em class="replaceable"><code>options</code></em>] [<code class="option">-p</code> <em class="replaceable"><code>path</code></em>] [<code class="option">-c</code>]</p></div><div class="cmdsynopsis"><p id="id-1.9.5.8.4.3"><code class="command">pg_ctl</code> <code class="option">stop</code> [<code class="option">-D</code> <em class="replaceable"><code>datadir</code></em>] [<code class="option">-m</code>
<code class="option">s[mart]</code> | <code class="option">f[ast]</code> | <code class="option">i[mmediate]</code>
] [<code class="option">-W</code>] [<code class="option">-t</code> <em class="replaceable"><code>seconds</code></em>] [<code class="option">-s</code>]</p></div><div class="cmdsynopsis"><p id="id-1.9.5.8.4.4"><code class="command">pg_ctl</code> <code class="option">restart</code> [<code class="option">-D</code> <em class="replaceable"><code>datadir</code></em>] [<code class="option">-m</code>
<code class="option">s[mart]</code> | <code class="option">f[ast]</code> | <code class="option">i[mmediate]</code>
] [<code class="option">-W</code>] [<code class="option">-t</code> <em class="replaceable"><code>seconds</code></em>] [<code class="option">-s</code>] [<code class="option">-o</code> <em class="replaceable"><code>options</code></em>] [<code class="option">-c</code>]</p></div><div class="cmdsynopsis"><p id="id-1.9.5.8.4.5"><code class="command">pg_ctl</code> <code class="option">reload</code> [<code class="option">-D</code> <em class="replaceable"><code>datadir</code></em>] [<code class="option">-s</code>]</p></div><div class="cmdsynopsis"><p id="id-1.9.5.8.4.6"><code class="command">pg_ctl</code> <code class="option">status</code> [<code class="option">-D</code> <em class="replaceable"><code>datadir</code></em>]</p></div><div class="cmdsynopsis"><p id="id-1.9.5.8.4.7"><code class="command">pg_ctl</code> <code class="option">promote</code> [<code class="option">-D</code> <em class="replaceable"><code>datadir</code></em>] [<code class="option">-W</code>] [<code class="option">-t</code> <em class="replaceable"><code>seconds</code></em>] [<code class="option">-s</code>]</p></div><div class="cmdsynopsis"><p id="id-1.9.5.8.4.8"><code class="command">pg_ctl</code> <code class="option">logrotate</code> [<code class="option">-D</code> <em class="replaceable"><code>datadir</code></em>] [<code class="option">-s</code>]</p></div><div class="cmdsynopsis"><p id="id-1.9.5.8.4.9"><code class="command">pg_ctl</code> <code class="option">kill</code> <em class="replaceable"><code>signal_name</code></em> <em class="replaceable"><code>process_id</code></em> </p></div><span class="original">
<para>On Microsoft Windows, also:</para>
</span><p>Microsoft Windows上ではさらに</p><div class="cmdsynopsis"><p id="id-1.9.5.8.4.11"><code class="command">pg_ctl</code> <code class="option">register</code> [<code class="option">-D</code> <em class="replaceable"><code>datadir</code></em>] [<code class="option">-N</code> <em class="replaceable"><code>servicename</code></em>] [<code class="option">-U</code> <em class="replaceable"><code>username</code></em>] [<code class="option">-P</code> <em class="replaceable"><code>password</code></em>] [<code class="option">-S</code>
<code class="option">a[uto]</code> | <code class="option">d[emand]</code>
] [<code class="option">-e</code> <em class="replaceable"><code>source</code></em>] [<code class="option">-W</code>] [<code class="option">-t</code> <em class="replaceable"><code>seconds</code></em>] [<code class="option">-s</code>] [<code class="option">-o</code> <em class="replaceable"><code>options</code></em>]</p></div><div class="cmdsynopsis"><p id="id-1.9.5.8.4.12"><code class="command">pg_ctl</code> <code class="option">unregister</code> [<code class="option">-N</code> <em class="replaceable"><code>servicename</code></em>]</p></div></div><div class="refsect1" id="APP-PG-CTL-DESCRIPTION"><h2>説明</h2><span class="original">
<title>Description</title>
</span><p>
<span class="original">
<application>pg_ctl</application> is a utility for initializing a
<productname>PostgreSQL</productname> database cluster, starting,
stopping, or restarting the <productname>PostgreSQL</productname>
database server (<xref linkend="app-postgres"/>), or displaying the
status of a running server. Although the server can be started
manually, <application>pg_ctl</application> encapsulates tasks such
as redirecting log output and properly detaching from the terminal
and process group. It also provides convenient options for
controlled shutdown.
</span>
<span class="application">pg_ctl</span>は<span class="productname">PostgreSQL</span>データベースクラスタの初期化、<span class="productname">PostgreSQL</span>のデータベースサーバ(<a class="xref" href="app-postgres.html" title="postgres"><span class="refentrytitle"><span class="application">postgres</span></span></a>)を起動、停止、再起動する、あるいは稼働中のサーバの状態を表示するためのユーティリティです。
サーバは手動で起動することも可能ですが、<span class="application">pg_ctl</span>は、ログ出力のリダイレクトや、端末とプロセスグループの適切な分離などの作業を隠蔽してくれます。
さらにシャットダウン制御のための便利なオプションも提供します。
</p><p>
<span class="original">
The <option>init</option> or <option>initdb</option> mode creates a new
<productname>PostgreSQL</productname> database cluster, that is,
a collection of databases that will be managed by a single
server instance. This mode invokes the <command>initdb</command>
command. See <xref linkend="app-initdb"/> for details.
</span>
<code class="option">init</code>または<code class="option">initdb</code>モードは<span class="productname">PostgreSQL</span>の新しいデータベースクラスタ、つまり、単一のサーバインスタンスで管理されるデータベースの集合を作成します。
このモードは<code class="command">initdb</code>コマンドを呼び出します。
詳しくは<a class="xref" href="app-initdb.html" title="initdb"><span class="refentrytitle"><span class="application">initdb</span></span></a>を参照して下さい。
</p><p>
<span class="original">
<option>start</option> mode launches a new server. The
server is started in the background, and its standard input is attached
to <filename>/dev/null</filename> (or <literal>nul</literal> on Windows).
On Unix-like systems, by default, the server's standard output and
standard error are sent to <application>pg_ctl</application>'s
standard output (not standard error). The standard output of
<application>pg_ctl</application> should then be redirected to a
file or piped to another process such as a log rotating program
like <application>rotatelogs</application>; otherwise <command>postgres</command>
will write its output to the controlling terminal (from the
background) and will not leave the shell's process group. On
Windows, by default the server's standard output and standard error
are sent to the terminal. These default behaviors can be changed
by using <option>-l</option> to append the server's output to a log file.
Use of either <option>-l</option> or output redirection is recommended.
</span>
<code class="option">start</code>モードは、新しいサーバを起動します。
サーバはバックグラウンドで起動され、その標準入力は<code class="filename">/dev/null</code>(Windowsの場合は<code class="literal">nul</code>)に接続されます。
Unix系のシステムではデフォルトで、サーバの標準出力と標準エラーは<span class="application">pg_ctl</span>の標準出力に転送されます(標準エラー出力には転送されません)。
<span class="application">pg_ctl</span>の標準出力はファイルにリダイレクトするか、例えば<span class="application">rotatelogs</span>などのログローテーションプログラムのような別プロセスにパイプで渡すべきです。
こうしないと、<code class="command">postgres</code>はその出力を(バックグラウンドから)制御端末に書き出しますので、シェルのプロセスグループから切り離すことができません。
Windowsではデフォルトで、サーバの標準出力と標準エラーは端末に送信されます。
こうしたデフォルトの動作は<code class="option">-l</code>を用いてサーバの出力をログファイルに追加するように変更することができます。
<code class="option">-l</code>または出力のリダイレクトのどちらかを使用することを勧めます。
</p><p>
<span class="original">
<option>stop</option> mode shuts down the server that is running in
the specified data directory. Three different
shutdown methods can be selected with the <option>-m</option>
option. <quote>Smart</quote> mode disallows new connections, then waits
for all existing clients to disconnect.
If the server is in hot standby, recovery and streaming replication
will be terminated once all clients have disconnected.
<quote>Fast</quote> mode (the default) does not wait for clients to disconnect.
All active transactions are
rolled back and clients are forcibly disconnected, then the
server is shut down. <quote>Immediate</quote> mode will abort
all server processes immediately, without a clean shutdown. This choice
will lead to a crash-recovery cycle during the next server start.
</span>
<code class="option">stop</code>モードは、指定されたデータディレクトリで稼働しているサーバを停止(シャットダウン)します。
<code class="option">-m</code>オプションでは、3つの異なる停止方式を選択できます。
<span class="quote">「<span class="quote">smart</span>」</span>モードは、新しい接続を禁止してから、全ての接続しているクライアントが切断するまで待ちます。
サーバがホットスタンバイ状態の場合、すべてのクライアント接続が切断された後にリカバリとストリーミングレプリケーションは終了します。
<span class="quote">「<span class="quote">fast</span>」</span>モード(デフォルト)はクライアントが切断するまで待ちません。
全ての実行中のトランザクションをロールバックし、クライアントとの接続を強制的に切断した後、サーバを停止します。
<span class="quote">「<span class="quote">immediate</span>」</span>モードは、クリーンアップ処理なしで、全てのサーバプロセスを即座に中断します。
これを選択すると、次回のサーバ起動時にクラッシュリカバリサイクルが始まります。
</p><p>
<span class="original">
<option>restart</option> mode effectively executes a stop followed
by a start. This allows changing the <command>postgres</command>
command-line options, or changing configuration-file options that
cannot be changed without restarting the server.
If relative paths were used on the command line during server
start, <option>restart</option> might fail unless
<application>pg_ctl</application> is executed in the same current
directory as it was during server start.
</span>
<code class="option">restart</code>モードは、実質的にはstopを実行して、その後、startを実行します。
この時、<code class="command">postgres</code>のコマンドラインオプションを変更、またはサーバの再起動なしには変更できない設定ファイルオプションを変更することができます。
サーバ起動時に相対パスがコマンドラインから使用されていた場合、サーバ起動時と同じカレントディレクトリで<span class="application">pg_ctl</span>を実行しなければ、<code class="option">restart</code>が失敗する可能性があります。
</p><p>
<span class="original">
<option>reload</option> mode simply sends the
<command>postgres</command> server process a <systemitem>SIGHUP</systemitem>
signal, causing it to reread its configuration files
(<filename>postgresql.conf</filename>,
<filename>pg_hba.conf</filename>, etc.). This allows changing
configuration-file options that do not require a full server restart
to take effect.
</span>
<code class="option">reload</code>モードは、単に<code class="command">postgres</code>サーバプロセスに<span class="systemitem">SIGHUP</span>シグナルを送り、(<code class="filename">postgresql.conf</code>、<code class="filename">pg_hba.conf</code>などの)設定ファイルの再読み込みを実行させます。
これにより、設定ファイルのオプションで完全なサーバ再起動を必要としないものについて、変更を反映させることができます。
</p><p>
<span class="original">
<option>status</option> mode checks whether a server is running in
the specified data directory. If it is, the server's <acronym>PID</acronym>
and the command line options that were used to invoke it are displayed.
If the server is not running, <application>pg_ctl</application> returns
an exit status of 3. If an accessible data directory is not
specified, <application>pg_ctl</application> returns an exit status of 4.
</span>
<code class="option">status</code>モードは指定したデータディレクトリでサーバが稼働しているかどうかを確認します。
稼働している場合はサーバの<acronym class="acronym">PID</acronym>と、サーバを起動する時に使われたコマンドラインオプションを表示します。
サーバが稼働していない場合、<span class="application">pg_ctl</span>は終了ステータス3を返します。
アクセス可能なデータディレクトリが指定されていない場合、<span class="application">pg_ctl</span>は終了ステータス4を返します。
</p><p>
<span class="original">
<option>promote</option> mode commands the standby server that is
running in the specified data directory to end standby mode
and begin read-write operations.
</span>
<code class="option">promote</code>モードは、指定したデータディレクトリで実行中のスタンバイサーバに、スタンバイモードを終了し、読み書きの操作を開始するように指示します。
</p><p>
<span class="original">
<option>logrotate</option> mode rotates the server log file.
For details on how to use this mode with external log rotation tools, see
<xref linkend="logfile-maintenance"/>.
</span>
<code class="option">logrotate</code>モードはサーバログファイルをローテーションします。
外部のログローテーションツールでこのモードを使う方法の詳細については、<a class="xref" href="logfile-maintenance.html" title="24.3. ログファイルの保守">24.3</a>を参照してください。
</p><p>
<span class="original">
<option>kill</option> mode sends a signal to a specified process.
This is primarily valuable on <productname>Microsoft Windows</productname>
which does not have a built-in <application>kill</application> command. Use
<literal>&#45;-help</literal> to see a list of supported signal names.
</span>
<code class="option">kill</code>モードは指定したプロセスにシグナルを送信します。
これは主に、組み込みの<span class="application">kill</span>コマンドがない<span class="productname">Microsoft Windows</span>で有用です。
サポートされているシグナル名の一覧を見るには<code class="literal">--help</code>を使ってください。
</p><p>
<span class="original">
<option>register</option> mode registers the <productname>PostgreSQL</productname>
server as a system service on <productname>Microsoft Windows</productname>.
The <option>-S</option> option allows selection of service start type,
either <quote>auto</quote> (start service automatically on system startup)
or <quote>demand</quote> (start service on demand).
</span>
<code class="option">register</code>モードは<span class="productname">PostgreSQL</span>サーバを<span class="productname">Microsoft Windows</span>上のシステムサービスとして登録します。
<code class="option">-S</code>オプションにより、<span class="quote">「<span class="quote">auto</span>」</span>(システムの起動時に自動的にサービスを開始する)と<span class="quote">「<span class="quote">demand</span>」</span>(要求に応じてサービスを開始する)のいずれかのサービス開始種別を選択できます。
</p><p>
<span class="original">
<option>unregister</option> mode unregisters a system service
on <productname>Microsoft Windows</productname>. This undoes the effects of the
<option>register</option> command.
</span>
<code class="option">unregister</code>モードにより<span class="productname">Microsoft Windows</span>上のシステムサービスを登録解除することができます。
これは過去に<code class="option">register</code>コマンドによりなされた変更を元に戻します。
</p></div><div class="refsect1" id="APP-PG-CTL-OPTIONS"><h2>オプション</h2><span class="original">
<title>Options</title>
</span><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-c</code><br /></span><span class="term"><code class="option">--core-files</code></span></dt><dd><p>
<span class="original">
Attempt to allow server crashes to produce core files, on platforms
where this is possible, by lifting any soft resource limit placed on
core files.
This is useful in debugging or diagnosing problems by allowing a
stack trace to be obtained from a failed server process.
</span>
実現可能なプラットフォームにおいて、サーバクラッシュ時にcoreファイルを生成できるように関連するソフトリソース制限を上げます。
障害が起きたサーバプロセスからスタックトレースを取得できますので、問題のデバッグや診断の際に有用です。
</p></dd><dt><span class="term"><code class="option">-D <em class="replaceable"><code>datadir</code></em></code><br /></span><span class="term"><code class="option">--pgdata=<em class="replaceable"><code>datadir</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the file system location of the database configuration files. If
this option is omitted, the environment variable
<envar>PGDATA</envar> is used.
</span>
データベース設定ファイルのファイルシステム上の場所を指定します。
このオプションが省略された場合、環境変数<code class="envar">PGDATA</code>が使われます。
</p></dd><dt><span class="term"><code class="option">-l <em class="replaceable"><code>filename</code></em></code><br /></span><span class="term"><code class="option">--log=<em class="replaceable"><code>filename</code></em></code></span></dt><dd><p>
<span class="original">
Append the server log output to
<replaceable>filename</replaceable>. If the file does not
exist, it is created. The <systemitem>umask</systemitem> is set to 077,
so access to the log file is disallowed to other users by default.
</span>
サーバログ出力を<em class="replaceable"><code>filename</code></em>に追記します。
そのファイルが存在しない場合は作成されます。
<span class="systemitem">umask</span>は077に設定されますので、他のユーザからのログファイルへのアクセスはデフォルトでは許可されません。
</p></dd><dt><span class="term"><code class="option">-m <em class="replaceable"><code>mode</code></em></code><br /></span><span class="term"><code class="option">--mode=<em class="replaceable"><code>mode</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the shutdown mode. <replaceable>mode</replaceable>
can be <literal>smart</literal>, <literal>fast</literal>, or
<literal>immediate</literal>, or the first letter of one of
these three. If this option is omitted, <literal>fast</literal> is
the default.
</span>
停止(シャットダウン)モードを指定します。
<em class="replaceable"><code>mode</code></em>は<code class="literal">smart</code>、<code class="literal">fast</code>、<code class="literal">immediate</code>、もしくはこの3つのモード名の最初の1文字をとることができます。
このオプションが省略された時は<code class="literal">fast</code>がデフォルトとなります。
</p></dd><dt><span class="term"><code class="option">-o <em class="replaceable"><code>options</code></em></code><br /></span><span class="term"><code class="option">--options=<em class="replaceable"><code>options</code></em></code></span></dt><dd><p>
<span class="original">
Specifies options to be passed directly to the
<command>postgres</command> command.
<option>-o</option> can be specified multiple times, with all the given
options being passed through.
</span>
<code class="command">postgres</code>コマンドに直接渡されるオプションを指定します。
<code class="option">-o</code>は複数回指定することができ、そこで指定されたすべてのオプションが渡されます。
</p><p>
<span class="original">
The <replaceable>options</replaceable> should usually be surrounded by single or
double quotes to ensure that they are passed through as a group.
</span>
<em class="replaceable"><code>options</code></em>はそれが一つのグループとして渡されるようにするため、通常は単一引用符または二重引用符で括るべきです。
</p></dd><dt><span class="term"><code class="option">-o <em class="replaceable"><code>initdb-options</code></em></code><br /></span><span class="term"><code class="option">--options=<em class="replaceable"><code>initdb-options</code></em></code></span></dt><dd><p>
<span class="original">
Specifies options to be passed directly to the
<command>initdb</command> command.
<option>-o</option> can be specified multiple times, with all the given
options being passed through.
</span>
<code class="command">initdb</code>コマンドに直接渡されるオプションを指定します。
<code class="option">-o</code>は複数回指定することができ、そこで指定されたすべてのオプションが渡されます。
</p><p>
<span class="original">
The <replaceable>initdb-options</replaceable> should usually be surrounded by single or
double quotes to ensure that they are passed through as a group.
</span>
<em class="replaceable"><code>initdb-options</code></em>はそれが一つのグループとして渡されるようにするため、通常は単一引用符または二重引用符で括るべきです。
</p></dd><dt><span class="term"><code class="option">-p <em class="replaceable"><code>path</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the location of the <filename>postgres</filename>
executable. By default the <filename>postgres</filename> executable is taken from the same
directory as <command>pg_ctl</command>, or failing that, the hard-wired
installation directory. It is not necessary to use this
option unless you are doing something unusual and get errors
that the <filename>postgres</filename> executable was not found.
</span>
<code class="filename">postgres</code>の実行プログラムの位置を指定します。
デフォルトでは<code class="filename">postgres</code>の実行プログラムは<code class="command">pg_ctl</code>と同じディレクトリにあるものとみなされます。また、このディレクトリに存在しなければ、構築時に指定したインストールディレクトリが使われます。
このオプションは、何か異例なことをしていて<code class="filename">postgres</code>が見つからないというようなエラーが出ない限り、使う必要はありません。
</p><p>
<span class="original">
In <literal>init</literal> mode, this option analogously
specifies the location of the <filename>initdb</filename>
executable.
</span>
<code class="literal">init</code>モードでは、このオプションは同様に<code class="filename">initdb</code>実行プログラムの場所を指定します。
</p></dd><dt><span class="term"><code class="option">-s</code><br /></span><span class="term"><code class="option">--silent</code></span></dt><dd><p>
<span class="original">
Print only errors, no informational messages.
</span>
エラーメッセージのみを表示し、その他の情報を表示しません。
</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">--timeout=<em class="replaceable"><code>seconds</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the maximum number of seconds to wait when waiting for an
operation to complete (see option <option>-w</option>). Defaults to
the value of the <envar>PGCTLTIMEOUT</envar> environment variable or, if
not set, to 60 seconds.
</span>
操作が完了するまで待機する最大の秒数を指定します(オプション<code class="option">-w</code>を参照)。
デフォルトは環境変数<code class="envar">PGCTLTIMEOUT</code>の値で、それが設定されていなければ60秒です。
</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_ctl</application> version and exit.
</span>
<span class="application">pg_ctl</span>のバージョンを表示し、終了します。
</p></dd><dt><span class="term"><code class="option">-w</code><br /></span><span class="term"><code class="option">--wait</code></span></dt><dd><p>
<span class="original">
Wait for the operation to complete. This is supported for the
modes <literal>start</literal>, <literal>stop</literal>,
<literal>restart</literal>, <literal>promote</literal>,
and <literal>register</literal>, and is the default for those modes.
</span>
操作が完了するのを待ちます。
これは<code class="literal">start</code>、<code class="literal">stop</code>、<code class="literal">restart</code>、<code class="literal">promote</code>、<code class="literal">register</code>のモードについてサポートされており、これらのモードについてのデフォルトです。
</p><p>
<span class="original">
When waiting, <command>pg_ctl</command> repeatedly checks the
server's <acronym>PID</acronym> file, sleeping for a short amount
of time between checks. Startup is considered complete when
the <acronym>PID</acronym> file indicates that the server is ready to
accept connections. Shutdown is considered complete when the server
removes the <acronym>PID</acronym> file.
<command>pg_ctl</command> returns an exit code based on the
success of the startup or shutdown.
</span>
待機している場合、<code class="command">pg_ctl</code>は繰り返しサーバの<acronym class="acronym">PID</acronym>ファイルを確認し、確認と確認の間は少しの時間スリープします。
起動は、サーバが接続を受け付ける準備ができたことを<acronym class="acronym">PID</acronym>ファイルが示した時に、完了したとみなされます。
停止は、サーバが<acronym class="acronym">PID</acronym>ファイルを削除した時に、完了したとみなされます。
<code class="command">pg_ctl</code>は、起動もしくは停止が成功したかどうかに基づいて終了コードを返します。
</p><p>
<span class="original">
If the operation does not complete within the timeout (see
option <option>-t</option>), then <command>pg_ctl</command> exits with
a nonzero exit status. But note that the operation might continue in
the background and eventually succeed.
</span>
操作がタイムアウト(オプション<code class="option">-t</code>参照)までに完了しなかった場合、<code class="command">pg_ctl</code>は非ゼロの終了コードで終了します。
しかし、その操作はバックグラウンドで実行し続け、最終的に成功するかもしれないことに注意してください。
</p></dd><dt><span class="term"><code class="option">-W</code><br /></span><span class="term"><code class="option">--no-wait</code></span></dt><dd><p>
<span class="original">
Do not wait for the operation to complete. This is the opposite of
the option <option>-w</option>.
</span>
操作が完了するのを待ちません。
オプション<code class="option">-w</code>の反対です。
</p><p>
<span class="original">
If waiting is disabled, the requested action is triggered, but there
is no feedback about its success. In that case, the server log file
or an external monitoring system would have to be used to check the
progress and success of the operation.
</span>
待機が無効化されていると、要求された操作は実行されますが、それが成功したかどうかのフィードバックがなくなります。
その場合、サーバのログファイルや外部のモニタリングシステムを使って操作の進行状況や成功したかどうかを確認する必要があるでしょう。
</p><p>
<span class="original">
In prior releases of PostgreSQL, this was the default except for
the <literal>stop</literal> mode.
</span>
PostgreSQLの以前のリリースでは、<code class="literal">stop</code>モードを除き、これがデフォルトでした。
</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_ctl</application> command line
arguments, and exit.
</span>
<span class="application">pg_ctl</span>コマンドライン引数の説明を表示し、終了します。
</p></dd></dl></div><p>
<span class="original">
If an option is specified that is valid, but not relevant to the selected
operating mode, <application>pg_ctl</application> ignores it.
</span>
指定されたオプションが有効ではあるが、指定の操作モードと関係ないものである場合、<span class="application">pg_ctl</span>はそれを無視します。
</p><div class="refsect2" id="APP-PG-CTL-WINDOWS-OPTIONS"><h3>Windows用オプション</h3><span class="original">
<title>Options for Windows</title>
</span><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-e <em class="replaceable"><code>source</code></em></code></span></dt><dd><p>
<span class="original">
Name of the event source for <application>pg_ctl</application> to use
for logging to the event log when running as a Windows service. The
default is <literal>PostgreSQL</literal>. Note that this only controls
messages sent from <application>pg_ctl</application> itself; once
started, the server will use the event source specified
by its <xref linkend="guc-event-source"/> parameter. Should the server
fail very early in startup, before that parameter has been set,
it might also log using the default event
source name <literal>PostgreSQL</literal>.
</span>
Windowsのサービスとして実行する際に、イベントログへの出力用に<span class="application">pg_ctl</span>が使用するイベントソースの名前です。
デフォルトは<code class="literal">PostgreSQL</code>です。
これは<span class="application">pg_ctl</span>自体からのメッセージのみを制御することに注意してください。
サーバが起動した後は、<a class="xref" href="runtime-config-logging.html#GUC-EVENT-SOURCE">event_source</a>で指定したイベントソースが使用されます。
サーバが起動の非常に早い段階のパラメータが設定されるより前に障害を起こした場合は、デフォルトのイベントソース名の<code class="literal">PostgreSQL</code>を使用するかもしれません。
</p></dd><dt><span class="term"><code class="option">-N <em class="replaceable"><code>servicename</code></em></code></span></dt><dd><p>
<span class="original">
Name of the system service to register. This name will be used
as both the service name and the display name.
The default is <literal>PostgreSQL</literal>.
</span>
登録するシステムサービスの名前です。
この名前は、システム名としても表示名としても使用されます。
デフォルトは<code class="literal">PostgreSQL</code>です。
</p></dd><dt><span class="term"><code class="option">-P <em class="replaceable"><code>password</code></em></code></span></dt><dd><p>
<span class="original">
Password for the user to run the service as.
</span>
サービスを開始するユーザ用のパスワードです。
</p></dd><dt><span class="term"><code class="option">-S <em class="replaceable"><code>start-type</code></em></code></span></dt><dd><p>
<span class="original">
Start type of the system service. <replaceable>start-type</replaceable> can
be <literal>auto</literal>, or <literal>demand</literal>, or
the first letter of one of these two. If this option is omitted,
<literal>auto</literal> is the default.
</span>
システムサービスの起動種類です。
<em class="replaceable"><code>start-type</code></em>は<code class="literal">auto</code>、<code class="literal">demand</code>、またはこれら2単語の先頭の文字のいずれかです。
このオプションを省略した時は<code class="literal">auto</code>がデフォルトとなります。
</p></dd><dt><span class="term"><code class="option">-U <em class="replaceable"><code>username</code></em></code></span></dt><dd><p>
<span class="original">
User name for the user to run the service as. For domain users, use the
format <literal>DOMAIN\username</literal>.
</span>
サービスを起動するユーザのユーザ名です。
ドメインユーザの場合は<code class="literal">DOMAIN\username</code>書式を使用してください。
</p></dd></dl></div></div></div><div class="refsect1" id="id-1.9.5.8.7"><h2>環境</h2><span class="original">
<title>Environment</title>
</span><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="envar">PGCTLTIMEOUT</code></span></dt><dd><p>
<span class="original">
Default limit on the number of seconds to wait when waiting for startup
or shutdown to complete. If not set, the default is 60 seconds.
</span>
起動または終了が完了するまでに待機する秒数のデフォルトの最大値です。
設定されていない場合のデフォルトは60秒です。
</p></dd><dt><span class="term"><code class="envar">PGDATA</code></span></dt><dd><p>
<span class="original">
Default data directory location.
</span>
デフォルトのデータディレクトリの場所です。
</p></dd></dl></div><p>
<span class="original">
Most <command>pg_ctl</command> modes require knowing the data directory
location; therefore, the <option>-D</option> option is required
unless <envar>PGDATA</envar> is set.
</span>
ほとんどの<code class="command">pg_ctl</code>のモードはデータディレクトリの位置を知っている必要があるため、<code class="envar">PGDATA</code>が設定されていないときは<code class="option">-D</code>オプションが必須です。
</p><p>
<span class="original">
For additional variables that affect the server,
see <xref linkend="app-postgres"/>.
</span>
サーバに影響を与える他の変数については<a class="xref" href="app-postgres.html" title="postgres"><span class="refentrytitle"><span class="application">postgres</span></span></a>を参照してください。
</p></div><div class="refsect1" id="id-1.9.5.8.8"><h2>ファイル</h2><span class="original">
<title>Files</title>
</span><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="filename">postmaster.pid</code></span></dt><dd><p>
<span class="original">
<application>pg_ctl</application> examines this file in the data
directory to determine whether the server is currently running.
</span>
<span class="application">pg_ctl</span>は、データディレクトリのこのファイルを検査して、サーバが現在稼働中かどうかを決定します。
</p></dd><dt><span class="term"><code class="filename">postmaster.opts</code></span></dt><dd><span class="original">
<para>If this file exists in the data directory,
<application>pg_ctl</application> (in <option>restart</option> mode)
will pass the contents of the file as options to
<application>postgres</application>, unless overridden
by the <option>-o</option> option. The contents of this file
are also displayed in <option>status</option> mode.
</span><p>
このファイルがデータディレクトリにあれば、<span class="application">pg_ctl</span>(の<code class="option">restart</code>モード)は、<code class="option">-o</code>で上書きされるものを除き、このファイルの内容をオプションとして<span class="application">postgres</span>に渡します。
また、このファイルの内容が<code class="option">status</code>モードで表示されます。
</p></dd></dl></div></div><div class="refsect1" id="R1-APP-PGCTL-2"><h2>例</h2><span class="original">
<title>Examples</title>
</span><div class="refsect2" id="R2-APP-PGCTL-3"><h3>サーバの起動</h3><span class="original">
<title>Starting the Server</title>
</span><p>
<span class="original">
To start the server, waiting until the server is
accepting connections:
</span>
以下はサーバが接続を植え付けられるようになるまで待機する起動例です。
</p><pre class="screen">
<code class="prompt">$</code> <strong class="userinput"><code>pg_ctl start</code></strong>
</pre><p>
</p><p>
<span class="original">
To start the server using port 5433, and
running without <function>fsync</function>, use:
</span>
ポート5433を使い<code class="function">fsync</code>なしでサーバを起動します。
</p><pre class="screen">
<code class="prompt">$</code> <strong class="userinput"><code>pg_ctl -o "-F -p 5433" start</code></strong>
</pre></div><div class="refsect2" id="R2-APP-PGCTL-4"><h3>サーバの停止</h3><span class="original">
<title>Stopping the Server</title>
</span><p>
<span class="original">
To stop the server, use:
</span>
サーバを停止するためには以下を使用します。
</p><pre class="screen">
<code class="prompt">$</code> <strong class="userinput"><code>pg_ctl stop</code></strong>
</pre><p>
<span class="original">
The <option>-m</option> option allows control over
<emphasis>how</emphasis> the server shuts down:
</span>
<code class="option">-m</code>オプションにより<span class="emphasis"><em>どのように</em></span>バックエンドを停止させるかを制御できます。
</p><pre class="screen">
<code class="prompt">$</code> <strong class="userinput"><code>pg_ctl stop -m smart</code></strong>
</pre></div><div class="refsect2" id="R2-APP-PGCTL-5"><h3>サーバの再起動</h3><span class="original">
<title>Restarting the Server</title>
</span><p>
<span class="original">
Restarting the server is almost equivalent to stopping the
server and starting it again, except that by default,
<command>pg_ctl</command> saves and reuses the command line options that
were passed to the previously-running instance. To restart
the server using the same options as before, use:
</span>
サーバの再起動は、サーバを停止してもう一度起動するのとほぼ同じですが、違うのは、<code class="command">pg_ctl</code>がデフォルトでは以前起動していたインスタンスに渡されていたコマンドラインオプションを保存し再利用することです。
下記はサーバを以前と同じオプションを使って再起動する方法です。
</p><pre class="screen">
<code class="prompt">$</code> <strong class="userinput"><code>pg_ctl restart</code></strong>
</pre><p>
</p><p>
<span class="original">
But if <option>-o</option> is specified, that replaces any previous options.
To restart using port 5433, disabling <function>fsync</function> upon restart:
</span>
しかし、<code class="option">-o</code>を指定すれば、それによって以前のオプションが置換されます。
以下はポート5433を使って再起動し、再起動後に<code class="function">fsync</code>を無効にする方法です。
</p><pre class="screen">
<code class="prompt">$</code> <strong class="userinput"><code>pg_ctl -o "-F -p 5433" restart</code></strong>
</pre></div><div class="refsect2" id="R2-APP-PGCTL-6"><h3>サーバの状態表示</h3><span class="original">
<title>Showing the Server Status</title>
</span><p>
<span class="original">
Here is sample status output from
<application>pg_ctl</application>:
</span>
下記は<span class="application">pg_ctl</span>からの状態の出力の例です。
</p><pre class="screen">
<code class="prompt">$</code> <strong class="userinput"><code>pg_ctl status</code></strong>
<code class="computeroutput">
pg_ctl: server is running (PID: 13718)
/usr/local/pgsql/bin/postgres "-D" "/usr/local/pgsql/data" "-p" "5433" "-B" "128"
</code></pre><p>
<span class="original">
The second line is the command that would be invoked in restart mode.
</span>
2行目は再起動(restart)モードで呼び出されるコマンドラインです。
</p></div></div><div class="refsect1" id="id-1.9.5.8.10"><h2>関連項目</h2><span class="original">
<title>See Also</title>
</span><span class="simplelist"><a class="xref" href="app-initdb.html" title="initdb"><span class="refentrytitle"><span class="application">initdb</span></span></a>, <a class="xref" href="app-postgres.html" title="postgres"><span class="refentrytitle"><span class="application">postgres</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-pgcreatesubscriber.html" title="pg_createsubscriber">前へ</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-pgresetwal.html" title="pg_resetwal">次へ</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="application">pg_createsubscriber</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.3文書">ホーム</a></td><td width="40%" align="right" valign="top"> <span class="application">pg_resetwal</span></td></tr></table></div></body></html>