-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp-pgbasebackup.html
More file actions
1072 lines (1065 loc) · 92.3 KB
/
app-pgbasebackup.html
File metadata and controls
1072 lines (1065 loc) · 92.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
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?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_basebackup</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-pgamcheck.html" title="pg_amcheck" /><link rel="next" href="pgbench.html" title="pgbench" /><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-client.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-pgbasebackup.html">誤訳等の報告
</a></div></td></tr><tr><td width="10%" align="left"><a accesskey="p" href="app-pgamcheck.html" title="pg_amcheck">前へ</a> </td><td width="10%" align="left"><a accesskey="u" href="reference-client.html" title="PostgreSQLクライアントアプリケーション">上へ</a></td><td width="60%" align="center"><span class="application">pg_basebackup</span></td><td width="20%" align="right"> <a accesskey="n" href="pgbench.html" title="pgbench">次へ</a></td></tr></table><hr /></div><div class="refentry" id="APP-PGBASEBACKUP"><div class="titlepage"></div><a id="id-1.9.4.10.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle"><span class="application">pg_basebackup</span></span></h2><p>pg_basebackup<span class="original">
<refpurpose>take a base backup of a <productname>PostgreSQL</productname> cluster</refpurpose>
</span> — <span class="productname">PostgreSQL</span>クラスタのベースバックアップを取得する</p></div><div class="refsynopsisdiv"><h2>概要</h2><div class="cmdsynopsis"><p id="id-1.9.4.10.4.1"><code class="command">pg_basebackup</code> [<em class="replaceable"><code>option</code></em>...]</p></div></div><div class="refsect1" id="id-1.9.4.10.5"><h2>説明</h2><span class="original">
<title>Description</title>
</span><p>
<span class="original">
<application>pg_basebackup</application> is used to take a base backup of
a running <productname>PostgreSQL</productname> database cluster. The backup
is taken without affecting other clients of the database, and can be used
both for point-in-time recovery (see <xref linkend="continuous-archiving"/>)
and as the starting point for a log-shipping or streaming-replication standby
server (see <xref linkend="warm-standby"/>).
</span>
<span class="application">pg_basebackup</span>は、稼働中の<span class="productname">PostgreSQL</span>のデータベースクラスタのベースバックアップを取るために使用されます。
データベースへの他のクライアントに影響することなく、バックアップが取られます。
また、このバックアップはポイントインタイムリカバリ(<a class="xref" href="continuous-archiving.html" title="25.3. 継続的アーカイブとポイントインタイムリカバリ(PITR)">25.3</a>参照)とログシッピングやストリーミングレプリケーションスタンバイサーバ用の開始点(<a class="xref" href="warm-standby.html" title="26.2. ログシッピングスタンバイサーバ">26.2</a>参照)としても使用できます。
</p><p>
<span class="original">
<application>pg_basebackup</application> can take a full or incremental
base backup of the database. When used to take a full backup, it makes an
exact copy of the database cluster's files. When used to take an incremental
backup, some files that would have been part of a full backup may be
replaced with incremental versions of the same files, containing only those
blocks that have been modified since the reference backup. An incremental
backup cannot be used directly; instead,
<xref linkend="app-pgcombinebackup"/> must first
be used to combine it with the previous backups upon which it depends.
See <xref linkend="backup-incremental-backup" /> for more information
about incremental backups, and <xref linkend="backup-pitr-recovery" />
for steps to recover from a backup.
</span>
<span class="application">pg_basebackup</span>は、データベースのフルまたは増分のベースバックアップを取ることができます。
フルバックアップを取得するために使用すると、データベースクラスタのファイルの正確なコピーが作成されます。
増分バックアップを取得するために使用すると、フルバックアップの一部であったいくつかのファイルが、同じファイルの増分版に置き換えられることがあり、参照バックアップ以降に変更されたブロックだけが含まれます。
増分バックアップはそのままでは使用できません。
その代わりに、<a class="xref" href="app-pgcombinebackup.html" title="pg_combinebackup"><span class="refentrytitle"><span class="application">pg_combinebackup</span></span></a>を使用して、それが依存する以前のバックアップと組み合わせる必要があります。
増分バックアップの詳細については<a class="xref" href="continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP" title="25.3.3. 増分バックアップを作成する">25.3.3</a>を、バックアップからの復旧手順については<a class="xref" href="continuous-archiving.html#BACKUP-PITR-RECOVERY" title="25.3.5. 継続的アーカイブによるバックアップを使用した復旧">25.3.5</a>を参照してください。
</p><p>
<span class="original">
In any mode, <application>pg_basebackup</application> makes sure the server
is put into and out of backup mode automatically. Backups are always taken of
the entire database cluster; it is not possible to back up individual
databases or database objects. For selective backups, another tool such as
<xref linkend="app-pgdump"/> must be used.
</span>
どのモードでも、<span class="application">pg_basebackup</span>は、サーバをバックアップモードに入れ、また戻すことを自動的に確実に行ないます。
バックアップは常にデータベースクラスタ全体のバックアップを取ります。
個々のデータベースや個々のデータベースオブジェクトをバックアップすることはできません。
特定のものを対象としたバックアップに関しては<a class="xref" href="app-pgdump.html" title="pg_dump"><span class="refentrytitle"><span class="application">pg_dump</span></span></a>などの他のツールを使用しなければなりません。
</p><p>
<span class="original">
The backup is made over a regular <productname>PostgreSQL</productname>
connection that uses the replication protocol. The connection must be made
with a user ID that has <literal>REPLICATION</literal> permissions
(see <xref linkend="role-attributes"/>) or is a superuser,
and <link linkend="auth-pg-hba-conf"><filename>pg_hba.conf</filename></link>
must permit the replication connection. The server must also be configured
with <xref linkend="guc-max-wal-senders"/> set high enough to provide at
least one walsender for the backup plus one for WAL streaming (if used).
</span>
バックアップは、レプリケーションプロトコルを用いる通常の<span class="productname">PostgreSQL</span>接続を経由して作成されます。
この接続は<code class="literal">REPLICATION</code>権限(<a class="xref" href="role-attributes.html" title="21.2. ロールの属性">21.2</a>参照)を持つ、または、スーパーユーザであるユーザIDが確立しなければなりません。
さらに<a class="link" href="auth-pg-hba-conf.html" title="20.1. pg_hba.confファイル"><code class="filename">pg_hba.conf</code></a>でレプリケーション用の接続が許可されていなければなりません。
またサーバで<a class="xref" href="runtime-config-replication.html#GUC-MAX-WAL-SENDERS">max_wal_senders</a>を、バックアップ用に少なくとも1つのwalsenderとWALストリーミング用にもう1つ(使用する場合)を残すように十分大きく設定する必要があります。
</p><p>
<span class="original">
There can be multiple <command>pg_basebackup</command>s running at the same time, but it is usually
better from a performance point of view to take only one backup, and copy
the result.
</span>
同時に<code class="command">pg_basebackup</code>を複数実行できます。
しかし性能の観点からは、1つのバックアップのみを取り結果をコピーする方が通常は優れています。
</p><p>
<span class="original">
<application>pg_basebackup</application> can make a base backup from
not only a primary server but also a standby. To take a backup from a standby,
set up the standby so that it can accept replication connections (that is, set
<varname>max_wal_senders</varname> and <xref linkend="guc-hot-standby"/>,
and configure its <filename>pg_hba.conf</filename> appropriately).
You will also need to enable <xref linkend="guc-full-page-writes"/> on the primary.
</span>
<span class="application">pg_basebackup</span>は、プライマリサーバからだけではなくスタンバイからもベースバックアップを作成できます。
スタンバイからバックアップを取得するためには、レプリケーション接続を受け付けられるようにスタンバイを設定してください(つまり<code class="varname">max_wal_senders</code>と<a class="xref" href="runtime-config-replication.html#GUC-HOT-STANDBY">hot_standby</a>を設定し、<code class="filename">pg_hba.conf</code>を適切に設定してください)。
またプライマリで<a class="xref" href="runtime-config-wal.html#GUC-FULL-PAGE-WRITES">full_page_writes</a>を有効にする必要があります。
</p><p>
<span class="original">
Note that there are some limitations in taking a backup from a standby:
</span>
スタンバイからバックアップを取る場合にはいくつかの制限があることに注意してください。
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
<span class="original">
The backup history file is not created in the database cluster backed up.
</span>
バックアップ履歴ファイルはバックアップされるデータベースクラスタ内に作成されません。
</p></li><li class="listitem"><p>
<span class="original">
<application>pg_basebackup</application> cannot force the standby
to switch to a new WAL file at the end of backup.
When you are using <literal>-X none</literal>, if write activity on
the primary is low, <application>pg_basebackup</application> may
need to wait a long time for the last WAL file required for the backup
to be switched and archived. In this case, it may be useful to run
<function>pg_switch_wal</function> on the primary in order to
trigger an immediate WAL file switch.
</span>
<span class="application">pg_basebackup</span>はバックアップの終了時に
スタンバイに新しいWALファイルへの切り替えを強制することはできません。
<code class="literal">-X none</code>の使用時にプライマリでの書き込みアクティビティが低い場合、
<span class="application">pg_basebackup</span>はバックアップに必要な最後のWALファイルが
切り替わってアーカイブされるまで長時間待つ必要があるかもしれません。
このような場合、即時のWALファイル切り替えをトリガするためにプライマリで
<code class="function">pg_switch_wal</code>を実行するのがおそらく有用です。
</p></li><li class="listitem"><p>
<span class="original">
If the standby is promoted to be primary during backup, the backup fails.
</span>
バックアップ中にスタンバイがプライマリに昇格した場合、バックアップは失敗します。
</p></li><li class="listitem"><p>
<span class="original">
All WAL records required for the backup must contain sufficient full-page writes,
which requires you to enable <varname>full_page_writes</varname> on the primary.
</span>
バックアップに必要なすべてのWALレコードは、必要なだけの完全ページ書き出しを含んでいなければなりません。
つまりこれは、プライマリで<code class="varname">full_page_writes</code>を有効にすることが要求されます。
</p></li></ul></div><p>
</p><p>
<span class="original">
Whenever <application>pg_basebackup</application> is taking a base
backup, the server's <structname>pg_stat_progress_basebackup</structname>
view will report the progress of the backup.
See <xref linkend="basebackup-progress-reporting"/> for details.
</span>
<span class="application">pg_basebackup</span>がベースバックアップを取るときには必ず、サーバの<code class="structname">pg_stat_progress_basebackup</code>はバックアップの進行状況を報告します。
詳細は<a class="xref" href="progress-reporting.html#BASEBACKUP-PROGRESS-REPORTING" title="27.4.6. ベースバックアップの進捗状況のレポート">27.4.6</a>を参照してください。
</p></div><div class="refsect1" id="id-1.9.4.10.6"><h2>オプション</h2><span class="original">
<title>Options</title>
</span><p>
<span class="original">
The following command-line options control the location and format of the
output:
</span>
以下のコマンドラインオプションは出力の場所と書式を制御します。
</p><div class="variablelist"><dl class="variablelist"><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">
Sets the target directory to write the output to.
<application>pg_basebackup</application> will create this directory
(and any missing parent directories) if it does not exist. If it
already exists, it must be empty.
</span>
出力を書き出す対象のディレクトリを設定します。
<span class="application">pg_basebackup</span>は、存在していなければこのディレクトリ(とその親ディレクトリのうち存在していないものすべて)を作成します。
ディレクトリはすでに存在してもかまいませんが、空でなければなりません。
</p><p>
<span class="original">
When the backup is in tar format, the target directory may be
specified as <literal>-</literal> (dash), causing the tar file to be
written to <literal>stdout</literal>.
</span>
バックアップがtar形式であり、かつ、対象のディレクトリが<code class="literal">-</code>(ダッシュ)の場合、tarファイルを<code class="literal">stdout</code>に書き出します。
</p><p>
<span class="original">
This option is required.
</span>
このオプションは必須です。
</p></dd><dt><span class="term"><code class="option">-F <em class="replaceable"><code>format</code></em></code><br /></span><span class="term"><code class="option">--format=<em class="replaceable"><code>format</code></em></code></span></dt><dd><p>
<span class="original">
Selects the format for the output. <replaceable>format</replaceable>
can be one of the following:
</span>
出力形式を選択します。
<em class="replaceable"><code>format</code></em>には以下のいずれかを取ることができます。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">p</code><br /></span><span class="term"><code class="literal">plain</code></span></dt><dd><p>
<span class="original">
Write the output as plain files, with the same layout as the
source server's data directory and tablespaces. When the cluster has
no additional tablespaces, the whole database will be placed in
the target directory. If the cluster contains additional
tablespaces, the main data directory will be placed in the
target directory, but all other tablespaces will be placed
in the same absolute path as they have on the source server.
(See <option>&#45;-tablespace-mapping</option> to change that.)
</span>
普通のファイルとして、ソースサーバのデータディレクトリとテーブル空間と同じレイアウトで、出力を書き出します。
クラスタがテーブル空間を追加で持たない場合、データベース全体が指定したディレクトリに格納されます。
クラスタが追加のテーブル空間を持つ場合は、主データディレクトリは指定したディレクトリ内に格納されますが、他のテーブル空間はすべて、ソースサーバ上と同じ絶対パスに格納されます。
(これを変更するには<code class="option">--tablespace-mapping</code>を参照してください。)
</p><p>
<span class="original">
This is the default format.
</span>
これがデフォルトの書式です。
</p></dd><dt><span class="term"><code class="literal">t</code><br /></span><span class="term"><code class="literal">tar</code></span></dt><dd><p>
<span class="original">
Write the output as tar files in the target directory. The main
data directory's contents will be written to a file named
<filename>base.tar</filename>, and each other tablespace will be
written to a separate tar file named after that tablespace's OID.
</span>
指定したディレクトリ内にtarファイルとして出力を書き出します。
主データディレクトリの内容は<code class="filename">base.tar</code>という名前のファイルに書き出され、他のテーブル空間はすべてテーブル空間のOIDに因んだ名前の別のtarファイルに書き出されます。
</p><p>
<span class="original">
If the target directory is specified as <literal>-</literal>
(dash), the tar contents will be written to
standard output, suitable for piping to (for example)
<productname>gzip</productname>. This is only allowed if
the cluster has no additional tablespaces and WAL
streaming is not used.
</span>
対象ディレクトリとして<code class="literal">-</code>(ダッシュ)という値が指定された場合、tarの内容は標準出力に書き出されます。
これは(例えば)<span class="productname">gzip</span>へのパイプ処理に適しています。
これはクラスタが追加テーブル空間を持たず、WALストリーミングを使用していない場合のみ行うことができます。
</p></dd></dl></div></dd><dt><span class="term"><code class="option">-i <em class="replaceable"><code>old_manifest_file</code></em></code><br /></span><span class="term"><code class="option">--incremental=<em class="replaceable"><code>old_manifest_file</code></em></code></span></dt><dd><p>
<span class="original">
Performs an <link linkend="backup-incremental-backup">incremental
backup</link>. The backup manifest for the reference
backup must be provided, and will be uploaded to the server, which will
respond by sending the requested incremental backup.
</span>
<a class="link" href="continuous-archiving.html#BACKUP-INCREMENTAL-BACKUP" title="25.3.3. 増分バックアップを作成する">増分バックアップ</a>を実行します。
参照バックアップのバックアップマニフェストを用意する必要があります。また、そのバックアップマニフェストはサーバにアップロードされ、サーバは要求された増分バックアップを送信することで応答します。
</p></dd><dt><span class="term"><code class="option">-R</code><br /></span><span class="term"><code class="option">--write-recovery-conf</code></span></dt><dd><p>
<span class="original">
Creates a
<link linkend="file-standby-signal"><filename>standby.signal</filename></link>
<indexterm><primary><filename>standby.signal</filename></primary><secondary>pg_basebackup &#45;-write-recovery-conf</secondary></indexterm>
file and appends
connection settings to the <filename>postgresql.auto.conf</filename>
file in the target directory (or within the base archive file when
using tar format). This eases setting up a standby server using the
results of the backup.
</span>
<a class="link" href="warm-standby.html#FILE-STANDBY-SIGNAL"><code class="filename">standby.signal</code></a>
<a id="id-1.9.4.10.6.2.1.4.3.1.2" class="indexterm"></a>
を作成し、対象のディレクトリ(tar形式の場合はベースアーカイブファイルの中)にある<code class="filename">postgresql.auto.conf</code>に接続設定を追加します。
これにより、バックアップの結果を利用するスタンバイサーバの設定が容易になります。
</p><p>
<span class="original">
The <filename>postgresql.auto.conf</filename> file will record the connection
settings and, if specified, the replication slot
that <application>pg_basebackup</application> is using, so that
streaming replication and <link linkend="logicaldecoding-replication-slots-synchronization">
logical replication slot synchronization</link> will use the same
settings later on. The dbname will be recorded only if the dbname was
specified explicitly in the connection string or <link linkend="libpq-envars">
environment variable</link>.
</span>
<code class="filename">postgresql.auto.conf</code>ファイルは、接続設定と、指定されている場合は<span class="application">pg_basebackup</span>が使用しているレプリケーションスロットを記録します。
これにより、ストリーミングレプリケーションと<a class="link" href="logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION" title="47.2.3. レプリケーションスロットの同期">論理レプリケーションスロットの同期</a>が後で同じ設定を使用するようになります。
dbnameは、dbnameが接続文字列または<a class="link" href="libpq-envars.html" title="32.15. 環境変数">環境変数</a>で明示的に指定された場合にのみ記録されます。
</p></dd><dt><span class="term"><code class="option">-t <em class="replaceable"><code>target</code></em></code><br /></span><span class="term"><code class="option">--target=<em class="replaceable"><code>target</code></em></code></span></dt><dd><p>
<span class="original">
Instructs the server where to place the base backup. The default target
is <literal>client</literal>, which specifies that the backup should
be sent to the machine where <application>pg_basebackup</application>
is running. If the target is instead set to
<literal>server:/some/path</literal>, the backup will be stored on
the machine where the server is running in the
<literal>/some/path</literal> directory. Storing a backup on the
server requires superuser privileges or having privileges of the
<literal>pg_write_server_files</literal> role. If the target is set to
<literal>blackhole</literal>, the contents are discarded and not
stored anywhere. This should only be used for testing purposes, as you
will not end up with an actual backup.
</span>
ベースバックアップを格納する場所をサーバに指示します。
デフォルトターゲットは<code class="literal">client</code>です。これは<span class="application">pg_basebackup</span>が実行されているマシンにバックアップが送信されるように指定します。
ターゲットが<code class="literal">server:/some/path</code>に設定されている場合、バックアップはサーバが実行されているマシンの<code class="literal">/some/path</code>ディレクトリに格納されます。
サーバにバックアップを格納するには、スーパーユーザ権限または<code class="literal">pg_write_server_files</code>ロールの権限が必要です。
ターゲットが<code class="literal">blackhole</code>に設定されている場合、内容は破棄され、どこにも格納されません。
実際のバックアップは作成されないので、これはテスト目的でのみ使用してください。
</p><p>
<span class="original">
Since WAL streaming is implemented by
<application>pg_basebackup</application> rather than by the server,
this option cannot be used together with <literal>-Xstream</literal>.
Since that is the default, when this option is specified, you must also
specify either <literal>-Xfetch</literal> or <literal>-Xnone</literal>.
</span>
WALストリーミングはサーバではなく<span class="application">pg_basebackup</span>によって実装されているため、このオプションは<code class="literal">-Xstream</code>と一緒に使用することはできません。
それがデフォルトであるため、このオプションを指定する場合は<code class="literal">-Xfetch</code>か<code class="literal">-Xnone</code>も指定する必要があります。
</p></dd><dt><span class="term"><code class="option">-T <em class="replaceable"><code>olddir</code></em>=<em class="replaceable"><code>newdir</code></em></code><br /></span><span class="term"><code class="option">--tablespace-mapping=<em class="replaceable"><code>olddir</code></em>=<em class="replaceable"><code>newdir</code></em></code></span></dt><dd><p>
<span class="original">
Relocates the tablespace in directory <replaceable>olddir</replaceable>
to <replaceable>newdir</replaceable> during the backup. To be
effective, <replaceable>olddir</replaceable> must exactly match the
path specification of the tablespace as it is defined on the source
server. (But it is not an error if there is no tablespace
in <replaceable>olddir</replaceable> on the source server.)
Meanwhile <replaceable>newdir</replaceable> is a directory in the
receiving host's filesystem. As with the main target directory,
<replaceable>newdir</replaceable> need not exist already, but if
it does exist it must be empty.
Both <replaceable>olddir</replaceable>
and <replaceable>newdir</replaceable> must be absolute paths. If
either path needs to contain an equal sign (<literal>=</literal>),
precede that with a backslash. This option can be specified multiple
times for multiple tablespaces.
</span>
ディレクトリ<em class="replaceable"><code>olddir</code></em>にあるテーブル空間を、バックアップ中に<em class="replaceable"><code>newdir</code></em>に再配置します。
これが有効であるためには、<em class="replaceable"><code>olddir</code></em>が、ソースサーバでのテーブル空間のパス定義と完全に一致している必要があります。
(ただし、ソースサーバの<em class="replaceable"><code>olddir</code></em>内にテーブル空間がなくてもエラーにはなりません。)
一方、<em class="replaceable"><code>newdir</code></em>は受け取るホストのファイルシステム内のディレクトリです。
主対象ディレクトリと同様に、<em class="replaceable"><code>newdir</code></em>は既に存在している必要はありませんが、存在している場合には空でなければなりません。
<em class="replaceable"><code>olddir</code></em>と<em class="replaceable"><code>newdir</code></em>はいずれも絶対パスでなければなりません。
パス名に等号(<code class="literal">=</code>)を含む必要がある場合には、バックスラッシュをその前に付けてください。
このオプションは、複数のテーブル空間に対して複数回指定することができます。
</p><p>
<span class="original">
If a tablespace is relocated in this way, the symbolic links inside
the main data directory are updated to point to the new location. So
the new data directory is ready to be used for a new server instance
with all tablespaces in the updated locations.
</span>
この方法でテーブル空間を再配置すると、メインのデータディレクトリ内のシンボリックリンクは、新しい場所を指すように更新されます。
このため、新しいデータディレクトリは、すべてのテーブル空間が更新された場所にあり、新しいサーバインスタンスがすぐに使える状態になっています。
</p><p>
<span class="original">
Currently, this option only works with plain output format; it is
ignored if tar format is selected.
</span>
現在、このオプションはplain出力形式でのみ機能します。tar形式が選択されている場合は無視されます。
</p></dd><dt><span class="term"><code class="option">--waldir=<em class="replaceable"><code>waldir</code></em></code></span></dt><dd><p>
<span class="original">
Sets the directory to write WAL (write-ahead log) files to.
By default WAL files will be placed in
the <filename>pg_wal</filename> subdirectory of the target
directory, but this option can be used to place them elsewhere.
<replaceable>waldir</replaceable> must be an absolute path.
As with the main target directory,
<replaceable>waldir</replaceable> need not exist already, but if
it does exist it must be empty.
This option can only be specified when
the backup is in plain format.
</span>
WAL(先行書き込みログ)ファイルを書き込むディレクトリを設定します。
デフォルトでは、WALファイルは対象の<code class="filename">pg_wal</code>サブディレクトリに置かれますが、どこか他の場所に置くためにこのオプションが使えます。
<em class="replaceable"><code>waldir</code></em>は絶対パスでなければなりません。
主対象ディレクトリと同様に、<em class="replaceable"><code>waldir</code></em>は既に存在している必要はありませんが、存在している場合には空でなければなりません。
このオプションは、バックアップがplain形式の場合にのみ指定できます。
</p></dd><dt><span class="term"><code class="option">-X <em class="replaceable"><code>method</code></em></code><br /></span><span class="term"><code class="option">--wal-method=<em class="replaceable"><code>method</code></em></code></span></dt><dd><p>
<span class="original">
Includes the required WAL (write-ahead log) files in the
backup. This will include all write-ahead logs generated during
the backup. Unless the method <literal>none</literal> is specified,
it is possible to start a postmaster in the target
directory without the need to consult the WAL archive, thus
making the output a completely standalone backup.
</span>
必要なWAL(先行書き込みログ)ファイルをバックアップに含めます。
これはバックアップ中に生成された先行書き込みログ(WAL)をすべて含みます。
方法<code class="literal">none</code>を指定しない場合、WALアーカイブを考慮することなく展開した対象ディレクトリ内でpostmasterを起動することができます。
つまり出力は完全なスタンドアローンバックアップを作成します。
</p><p>
<span class="original">
The following <replaceable>method</replaceable>s for collecting the
write-ahead logs are supported:
</span>
以下の先行書き込みログ(WAL)を収集するための<em class="replaceable"><code>method</code></em>がサポートされます。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">n</code><br /></span><span class="term"><code class="literal">none</code></span></dt><dd><p>
<span class="original">
Don't include write-ahead logs in the backup.
</span>
先行書き込みログ(WAL)をバックアップに含めません。
</p></dd><dt><span class="term"><code class="literal">f</code><br /></span><span class="term"><code class="literal">fetch</code></span></dt><dd><p>
<span class="original">
The write-ahead log files are collected at the end of the backup.
Therefore, it is necessary for the source server's
<xref linkend="guc-wal-keep-size"/> parameter to be set high
enough that the required log data is not removed before the end
of the backup. If the required log data has been recycled
before it's time to transfer it, the backup will fail and be
unusable.
</span>
先行書き込みログ(WAL)ファイルはバックアップの最後に収集されます。
したがって、ソースサーバの<a class="xref" href="runtime-config-replication.html#GUC-WAL-KEEP-SIZE">wal_keep_size</a>パラメータを、バックアップの最後までログが削除されない程度に十分大きくする必要があります。
要求されるログデータが転送時点で再利用されていた場合、バックアップは失敗し、使用することができません。
</p><p>
<span class="original">
When tar format is used, the write-ahead log files will be
included in the <filename>base.tar</filename> file.
</span>
tar形式が使われれば、先行書き込みログ(WAL)ファイルは<code class="filename">base.tar</code>ファイルに含まれます。
</p></dd><dt><span class="term"><code class="literal">s</code><br /></span><span class="term"><code class="literal">stream</code></span></dt><dd><p>
<span class="original">
Stream write-ahead log data while the backup is being taken.
This method will open a second connection to the server and
start streaming the write-ahead log in parallel while running
the backup. Therefore, it will require two replication
connections not just one. As long as the client can keep up
with the write-ahead log data, using this method requires no
extra write-ahead logs to be saved on the source server.
</span>
バックアップを取る時に先行書き込みログ(WAL)データをストリームします。
この方法は第2のサーバ接続を開き、バックアップを実行している間、並行して先行書き込みログ(WAL)のストリーミングを始めます。
したがって、レプリケーション接続を、1つではなく2つ使用します。
クライアントが先行書き込みログ(WAL)データに追従している限り、このモードを使用すれば、ソースサーバ上に余分に保管される先行書き込みログ(WAL)は必要ありません。
</p><p>
<span class="original">
When tar format is used, the write-ahead log files will be
written to a separate file named <filename>pg_wal.tar</filename>
(if the server is a version earlier than 10, the file will be named
<filename>pg_xlog.tar</filename>).
</span>
tar形式が使われれば、先行書き込みログ(WAL)ファイルは<code class="filename">pg_wal.tar</code>という名の別のファイルに書き込まれます(サーバが10より前のバージョンの場合、<code class="filename">pg_xlog.tar</code>というファイル名になります)。
</p><p>
<span class="original">
This value is the default.
</span>
この値がデフォルトです。
</p></dd></dl></div></dd><dt><span class="term"><code class="option">-z</code><br /></span><span class="term"><code class="option">--gzip</code></span></dt><dd><p>
<span class="original">
Enables gzip compression of tar file output, with the default
compression level. Compression is only available when using
the tar format, and the suffix <filename>.gz</filename> will
automatically be added to all tar filenames.
</span>
tarファイル出力のデフォルトの圧縮レベルによるgzip圧縮を有効にします。
tarファイルを生成する場合のみ圧縮を利用することができ、すべてのtarファイルの名前に拡張子<code class="filename">.gz</code>が自動的に付加されます。
</p></dd><dt><span class="term"><code class="option">-Z <em class="replaceable"><code>level</code></em></code><br /></span><span class="term"><code class="option">-Z [{client|server}-]<em class="replaceable"><code>method</code></em>[:<em class="replaceable"><code>detail</code></em>]</code><br /></span><span class="term"><code class="option">--compress=<em class="replaceable"><code>level</code></em></code><br /></span><span class="term"><code class="option">--compress=[{client|server}-]<em class="replaceable"><code>method</code></em>[:<em class="replaceable"><code>detail</code></em>]</code></span></dt><dd><p>
<span class="original">
Requests compression of the backup. If <literal>client</literal> or
<literal>server</literal> is included, it specifies where the
compression is to be performed. Compressing on the server will reduce
transfer bandwidth but will increase server CPU consumption. The
default is <literal>client</literal> except when
<literal>&#45;-target</literal> is used. In that case, the backup is not
being sent to the client, so only server compression is sensible.
When <literal>-Xstream</literal>, which is the default, is used,
server-side compression will not be applied to the WAL. To compress
the WAL, use client-side compression, or
specify <literal>-Xfetch</literal>.
</span>
バックアップの圧縮を要求します。
<code class="literal">client</code>または<code class="literal">server</code>が含まれている場合、それは圧縮を実行する場所を指定します。
サーバで圧縮すると、転送帯域幅が減少しますが、サーバのCPU消費が増加します。
デフォルトは<code class="literal">client</code>ですが、<code class="literal">--target</code>を使用している場合は例外です。
その場合、バックアップはクライアントに送信されないため、サーバ圧縮のみが有効です。
デフォルトの<code class="literal">-Xstream</code>が使用されている場合、サーバ側の圧縮はWALに適用されません。
WALを圧縮するには、クライアント側の圧縮を使用するか、<code class="literal">-Xfetch</code>を指定します。
</p><p>
<span class="original">
The compression method can be set to <literal>gzip</literal>,
<literal>lz4</literal>, <literal>zstd</literal>,
<literal>none</literal> for no compression or an integer (no
compression if 0, <literal>gzip</literal> if greater than 0).
A compression detail string can optionally be specified.
If the detail string is an integer, it specifies the compression
level. Otherwise, it should be a comma-separated list of items,
each of the form
<replaceable>keyword</replaceable> or
<replaceable>keyword=value</replaceable>.
Currently, the supported keywords are <literal>level</literal>,
<literal>long</literal>, and <literal>workers</literal>.
The detail string cannot be used when the compression method
is specified as a plain integer.
</span>
圧縮方式は、<code class="literal">gzip</code>、<code class="literal">lz4</code>、<code class="literal">zstd</code>で、圧縮しない場合は<code class="literal">none</code>に設定できます。あるいは整数でも設定できます(0なら圧縮しない、0より大きければ<code class="literal">gzip</code>)。
オプションで圧縮の詳細文字列を指定できます。
詳細文字列が整数の場合は、圧縮レベルを指定します。
それ以外の場合は、<em class="replaceable"><code>keyword</code></em>または<em class="replaceable"><code>keyword=value</code></em>形式のカンマ区切りの項目のリストにする必要があります。
現在サポートされているキーワードは、<code class="literal">level</code>、<code class="literal">long</code>および<code class="literal">workers</code>です。
圧縮方式が単純な整数として指定されている場合、詳細文字列は使用できません。
</p><p>
<span class="original">
If no compression level is specified, the default compression level
will be used. If only a level is specified without mentioning an
algorithm, <literal>gzip</literal> compression will be used if the
level is greater than 0, and no compression will be used if the level
is 0.
</span>
圧縮レベルが指定されていない場合、デフォルトの圧縮レベルが使用されます。
アルゴリズムを指定せずにレベルのみが指定されている場合、レベルが0より大きい場合は<code class="literal">gzip</code>圧縮が使用され、レベルが0の場合は圧縮が使用されません。
</p><p>
<span class="original">
When the tar format is used with <literal>gzip</literal>,
<literal>lz4</literal>, or <literal>zstd</literal>, the suffix
<filename>.gz</filename>, <filename>.lz4</filename>, or
<filename>.zst</filename>, respectively, will be automatically added to
all tar filenames. When the plain format is used, client-side
compression may not be specified, but it is still possible to request
server-side compression. If this is done, the server will compress the
backup for transmission, and the client will decompress and extract it.
</span>
tar形式を<code class="literal">gzip</code>、<code class="literal">lz4</code>、<code class="literal">zstd</code>とともに使用すると、接尾辞<code class="filename">.gz</code>、<code class="filename">.lz4</code>、<code class="filename">.zst</code>がそれぞれすべてのtarファイルに自動的に追加されます。
plain形式を使用する場合、クライアント側の圧縮は指定されない可能性がありますが、サーバ側の圧縮を要求することは可能です。
この場合、サーバは転送用にバックアップを圧縮し、クライアントは展開して抽出します。
</p><p>
<span class="original">
When this option is used in combination with
<literal>-Xstream</literal>, <literal>pg_wal.tar</literal> will
be compressed using <literal>gzip</literal> if client-side gzip
compression is selected, but will not be compressed if any other
compression algorithm is selected, or if server-side compression
is selected.
</span>
このオプションを<code class="literal">-Xstream</code>と組み合わせて使用すると、クライアント側のgzip圧縮が選択されている場合、<code class="literal">pg_wal.tar</code>は<code class="literal">gzip</code>を使って圧縮されますが、他の圧縮アルゴリズムが選択されている場合やサーバ側の圧縮が選択されている場合は圧縮されません。
</p></dd></dl></div><p>
</p><p>
<span class="original">
The following command-line options control the generation of the
backup and the invocation of the program:
</span>
以下のコマンドラインオプションはバックアップの生成とこのプログラムの起動を制御します。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-c {fast|spread}</code><br /></span><span class="term"><code class="option">--checkpoint={fast|spread}</code></span></dt><dd><p>
<span class="original">
Sets checkpoint mode to fast (immediate) or spread (the default)
(see <xref linkend="backup-lowlevel-base-backup"/>).
</span>
チェックポイントモードをfast(即座に発行)またはspread(デフォルト)に設定します(<a class="xref" href="continuous-archiving.html#BACKUP-LOWLEVEL-BASE-BACKUP" title="25.3.4. 低レベルAPIを使用したベースバックアップの作成">25.3.4</a>を参照してください)。
</p></dd><dt><span class="term"><code class="option">-C</code><br /></span><span class="term"><code class="option">--create-slot</code></span></dt><dd><p>
<span class="original">
Specifies that the replication slot named by the
<literal>&#45;-slot</literal> option should be created before starting
the backup. An error is raised if the slot already exists.
</span>
バックアップ開始前に<code class="literal">--slot</code>オプションで名づけられたレプリケーションスロットを作成することを指定します。
スロットが既に存在する場合、エラーが生じます。
</p></dd><dt><span class="term"><code class="option">-l <em class="replaceable"><code>label</code></em></code><br /></span><span class="term"><code class="option">--label=<em class="replaceable"><code>label</code></em></code></span></dt><dd><p>
<span class="original">
Sets the label for the backup. If none is specified, a default value of
<quote><literal>pg_basebackup base backup</literal></quote> will be used.
</span>
バックアップのラベルを設定します。
何も指定がない場合、<span class="quote">「<span class="quote"><code class="literal">pg_basebackup base backup</code></span>」</span>というデフォルト値が使用されます。
</p></dd><dt><span class="term"><code class="option">-n</code><br /></span><span class="term"><code class="option">--no-clean</code></span></dt><dd><p>
<span class="original">
By default, when <command>pg_basebackup</command> aborts with an
error, it removes any directories it might have created before
discovering that it cannot finish the job (for example, the target
directory and write-ahead log directory). This option inhibits
tidying-up and is thus useful for debugging.
</span>
デフォルトでは、<code class="command">pg_basebackup</code>がエラーでアボートするとき、ジョブを完了できないことがわかるより前に作成したすべてのディレクトリ(例えば、対象のディレクトリと先行書き込みログ(WAL)のディレクトリ)を削除します。
このオプションはきれいに片付けることを禁止するので、デバッグのために有用です。
</p><p>
<span class="original">
Note that tablespace directories are not cleaned up either way.
</span>
テーブル空間のディレクトリはいずれにせよ削除されないことに注意してください。
</p></dd><dt><span class="term"><code class="option">-N</code><br /></span><span class="term"><code class="option">--no-sync</code></span></dt><dd><p>
<span class="original">
By default, <command>pg_basebackup</command> will wait for all files
to be written safely to disk. This option causes
<command>pg_basebackup</command> to return without waiting, which is
faster, but means that a subsequent operating system crash can leave
the base backup corrupt. Generally, this option is useful for testing
but should not be used when creating a production installation.
</span>
デフォルトでは<code class="command">pg_basebackup</code>は全てのファイルがディスクに安全に書き出されるのを待ちます。
このオプションで<code class="command">pg_basebackup</code>は待つことなく返ります。これは高速ですが、その後のオペレーションシステムのクラッシュでベースバックアップの破損が残るかもしれないことを意味します。
一般にこのオプションはテスト用に有用なのであって、本番導入の際に使うべきではありません。
</p></dd><dt><span class="term"><code class="option">-P</code><br /></span><span class="term"><code class="option">--progress</code></span></dt><dd><p>
<span class="original">
Enables progress reporting. Turning this on will deliver an approximate
progress report during the backup. Since the database may change during
the backup, this is only an approximation and may not end at exactly
<literal>100%</literal>. In particular, when WAL log is included in the
backup, the total amount of data cannot be estimated in advance, and
in this case the estimated target size will increase once it passes the
total estimate without WAL.
</span>
進行状況報告を有効にします。
これを有効にすると、バックアップ中におおよその進行状況が報告されます。
データベースはバックアップ中に変更があるかもしれませんので、これはおおよそでしかなくちょうど<code class="literal">100%</code>では終わらないかもしれません。
特に、WALログがバックアップに含まれる場合、データ総量は前もって予測することはできません。
このためこの場合、推定対象容量はWALなしの総推定量を過ぎた後増加します。
</p></dd><dt><span class="term"><code class="option">-r <em class="replaceable"><code>rate</code></em></code><br /></span><span class="term"><code class="option">--max-rate=<em class="replaceable"><code>rate</code></em></code></span></dt><dd><p>
<span class="original">
Sets the maximum transfer rate at which data is collected from the
source server. This can be useful to limit the impact
of <application>pg_basebackup</application> on the server. Values
are in kilobytes per second. Use a suffix of <literal>M</literal>
to indicate megabytes per second. A suffix of <literal>k</literal>
is also accepted, and has no effect. Valid values are between 32
kilobytes per second and 1024 megabytes per second.
</span>
ソースサーバから収集されるデータの最大転送速度です。
これは、サーバでの<span class="application">pg_basebackup</span>の影響を制限するのに有用です。
値は秒あたりのキロバイト数です。
添字<code class="literal">M</code>を使うと秒あたりのメガバイト数を指定できます。
添字<code class="literal">k</code>を使うこともできますが、効果はありません。
有効な値は秒あたり32キロバイトから秒あたり1024メガバイトまでです。
</p><p>
<span class="original">
This option always affects transfer of the data directory. Transfer of
WAL files is only affected if the collection method
is <literal>fetch</literal>.
</span>
このオプションはデータディレクトリの転送に対しては、常に影響があります。
WALファイルの転送については、収集方法が<code class="literal">fetch</code>の場合にのみ影響があります。
</p></dd><dt><span class="term"><code class="option">-S <em class="replaceable"><code>slotname</code></em></code><br /></span><span class="term"><code class="option">--slot=<em class="replaceable"><code>slotname</code></em></code></span></dt><dd><p>
<span class="original">
This option can only be used together with <literal>-X
stream</literal>. It causes WAL streaming to use the specified
replication slot. If the base backup is intended to be used as a
streaming-replication standby using a replication slot, the standby
should then use the same replication slot name as
<xref linkend="guc-primary-slot-name"/>. This ensures that the
primary server does not remove any necessary WAL data in the time
between the end of the base backup and the start of streaming
replication on the new standby.
</span>
このオプションは<code class="literal">-X stream</code>と一緒でのみ使用できます。
これはWALストリーミングに指定したレプリケーションスロットを使用させます。
レプリケーションスロットを使うストリーミングレプリケーションのスタンバイとしてベースバックアップを使用するつもりであるなら、スタンバイは<a class="xref" href="runtime-config-replication.html#GUC-PRIMARY-SLOT-NAME">primary_slot_name</a>と同じレプリケーションスロット名を使うべきです。
これにより、ベースバックアップ終了と新しいスタンバイでのストリーミングレプリケーション開始の間の時間にプライマリサーバが必要なWALデータを削除しないことが確実になります。
</p><p>
<span class="original">
The specified replication slot has to exist unless the
option <option>-C</option> is also used.
</span>
指定されたレプリケーションスロットは、オプション<code class="option">-C</code>も使われている場合を除き、存在していなければなりません。
</p><p>
<span class="original">
If this option is not specified and the server supports temporary
replication slots (version 10 and later), then a temporary replication
slot is automatically used for WAL streaming.
</span>
このオプションが指定されておらず、サーバが一時レプリケーションスロットに対応している(バージョン10以降)場合、WALストリーミングに対して一時レプリケーションスロットが自動的に使われます。
</p></dd><dt><span class="term"><code class="option">--sync-method=<em class="replaceable"><code>method</code></em></code></span></dt><dd><p>
<span class="original">
When set to <literal>fsync</literal>, which is the default,
<command>pg_basebackup</command> will recursively open and synchronize
all files in the backup directory. When the plain format is used, the
search for files will follow symbolic links for the WAL directory and
each configured tablespace.
</span>
デフォルトの<code class="literal">fsync</code>に設定すると、<code class="command">pg_basebackup</code>はバックアップディレクトリ内の全てのファイルを再帰的にオープンし同期します。
plain形式を使用する場合、ファイルの検索はWALディレクトリと設定された各テーブル空間のシンボリックリンクをたどります。
</p><p>
<span class="original">
On Linux, <literal>syncfs</literal> may be used instead to ask the
operating system to synchronize the whole file system that contains the
backup directory. When the plain format is used,
<command>pg_basebackup</command> will also synchronize the file systems
that contain the WAL files and each tablespace. See
<xref linkend="guc-recovery-init-sync-method"/> for information about
the caveats to be aware of when using <literal>syncfs</literal>.
</span>
Linuxでは、<code class="literal">syncfs</code>を代わりに使用して、バックアップディレクトリを含むファイルシステム全体を同期化するようにオペレーティングシステムに要求できます。
plain形式を使用する場合、<code class="command">pg_basebackup</code>はWALファイルと各テーブル空間を含むファイルシステムも同期化します。
<code class="literal">syncfs</code>を使用する際に注意すべき点については、<a class="xref" href="runtime-config-error-handling.html#GUC-RECOVERY-INIT-SYNC-METHOD">recovery_init_sync_method</a>を参照してください。
</p><p>
<span class="original">
This option has no effect when <option>&#45;-no-sync</option> is used.
</span>
このオプションは<code class="option">--no-sync</code>が使われている場合は効果がありません。
</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. Will output some extra steps during startup and
shutdown, as well as show the exact file name that is currently being
processed if progress reporting is also enabled.
</span>
冗長モードを有効にします。
開始時および終了段階でいくつか追加の段階が出力されます。
また進行状況報告も有効な場合、現在処理中のファイル名も正しく出力されます。
</p></dd><dt><span class="term"><code class="option">--manifest-checksums=<em class="replaceable"><code>algorithm</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the checksum algorithm that should be applied to each file
included in the backup manifest. Currently, the available
algorithms are <literal>NONE</literal>, <literal>CRC32C</literal>,
<literal>SHA224</literal>, <literal>SHA256</literal>,
<literal>SHA384</literal>, and <literal>SHA512</literal>.
The default is <literal>CRC32C</literal>.
</span>
バックアップマニフェストに含まれる各ファイル適用されるチェックサムアルゴリズムを指定します。
現在利用できるアルゴリズムは<code class="literal">NONE</code>、<code class="literal">CRC32C</code>、<code class="literal">SHA224</code>、<code class="literal">SHA256</code>、<code class="literal">SHA384</code>、<code class="literal">SHA512</code>です。
デフォルトは<code class="literal">CRC32C</code>です。
</p><p>
<span class="original">
If <literal>NONE</literal> is selected, the backup manifest will
not contain any checksums. Otherwise, it will contain a checksum
of each file in the backup using the specified algorithm. In addition,
the manifest will always contain a <literal>SHA256</literal>
checksum of its own contents. The <literal>SHA</literal> algorithms
are significantly more CPU-intensive than <literal>CRC32C</literal>,
so selecting one of them may increase the time required to complete
the backup.
</span>
<code class="literal">NONE</code>が選択されれば、バックアップマニフェストはチェックサムを含みません。
それ以外の場合、バックアップ内の各ファイルの指定したアルゴリズムを使ったチェックサムを含みます。
さらに、マニフェストは自身の内容の<code class="literal">SHA256</code>チェックサムを常に含みます。
<code class="literal">SHA</code>アルゴリズムは<code class="literal">CRC32C</code>よりもかなりCPU集約的なため、そのどれかを1つを選択するとバックアップの完了に掛かる時間が増えるでしょう。
</p><p>
<span class="original">
Using a SHA hash function provides a cryptographically secure digest
of each file for users who wish to verify that the backup has not been
tampered with, while the CRC-32C algorithm provides a checksum that is
much faster to calculate; it is good at catching errors due to accidental
changes but is not resistant to malicious modifications. Note that, to
be useful against an adversary who has access to the backup, the backup
manifest would need to be stored securely elsewhere or otherwise
verified not to have been modified since the backup was taken.
</span>
SHAハッシュ関数を使うと、バックアップが変更されていないことを検証したい利用者にとっては暗号学的に安全な各ファイルのダイジェストが提供されますが、一方、CRC-32Cアルゴリズムでは計算がずっと速いチェックサムが提供されます。偶発的な変更によるエラーを捕捉するのには良いですが、悪意のある修正に対して抵抗力はありません。
バックアップにアクセスした敵に対抗するのに有用なように、バックアップマニフェストは、どこか他のところに安全に保管するか、バックアップが取られて以来変更されたことがないのを検証する必要があることに注意してください。
</p><p>
<span class="original">
<xref linkend="app-pgverifybackup"/> can be used to check the
integrity of a backup against the backup manifest.
</span>
<a class="xref" href="app-pgverifybackup.html" title="pg_verifybackup"><span class="refentrytitle"><span class="application">pg_verifybackup</span></span></a>を使ってバックアップマニフェストに対するバックアップの完全性を検査できます。
</p></dd><dt><span class="term"><code class="option">--manifest-force-encode</code></span></dt><dd><p>
<span class="original">
Forces all filenames in the backup manifest to be hex-encoded.
If this option is not specified, only non-UTF8 filenames are
hex-encoded. This option is mostly intended to test that tools which
read a backup manifest file properly handle this case.
</span>
バックアップマニフェスト内のファイル名をすべて強制的に16進数でエンコードします。
このオプションが指定されなければ、UTF8でないファイル名だけが16進数でエンコードされます。
このオプションは主に、バックアップマニフェストファイルを読むツールが、この場合を正しく扱うか試験することを意図しています。
</p></dd><dt><span class="term"><code class="option">--no-estimate-size</code></span></dt><dd><p>
<span class="original">
Prevents the server from estimating the total
amount of backup data that will be streamed, resulting in the
<structfield>backup_total</structfield> column in the
<structname>pg_stat_progress_basebackup</structname> view
always being <literal>NULL</literal>.
</span>
ストリームされるバックアップデータの総量をサーバが評価しないようにします。その結果、<code class="structname">pg_stat_progress_basebackup</code>ビューの<code class="structfield">backup_total</code>列は常に<code class="literal">NULL</code>になります。
</p><p>
<span class="original">
Without this option, the backup will start by enumerating
the size of the entire database, and then go back and send
the actual contents. This may make the backup take slightly
longer, and in particular it will take longer before the first
data is sent. This option is useful to avoid such estimation
time if it's too long.
</span>
このオプションがなければ、バックアップはまずデータベース全体容量を計算し、その後バックアップに戻り、実際の内容を送信します。
これにより、バックアップに要する時間は少し長くなるかもしれません。特に最初のデータが送られるようになるまでの時間がより長くなります。
このオプションは、評価時間が長過ぎる場合にそれを避けるのに有用です。
</p><p>
<span class="original">
This option is not allowed when using <option>&#45;-progress</option>.
</span>
<code class="option">--progress</code>を使う場合には、このオプションは認められません。
</p></dd><dt><span class="term"><code class="option">--no-manifest</code></span></dt><dd><p>
<span class="original">
Disables generation of a backup manifest. If this option is not
specified, the server will generate and send a backup manifest
which can be verified using <xref linkend="app-pgverifybackup"/>.
The manifest is a list of every file present in the backup with the
exception of any WAL files that may be included. It also stores the
size, last modification time, and an optional checksum for each file.
</span>
バックアップマニフェストを生成しないようにします。
このオプションが指定されなければ、サーバは<a class="xref" href="app-pgverifybackup.html" title="pg_verifybackup"><span class="refentrytitle"><span class="application">pg_verifybackup</span></span></a>を使って検証できるバックアップマニフェストを生成し送信します。
マニフェストは、含まれるかもしれないWALファイルを除いて、バックアップの中にある各ファイルの一覧です。
各ファイルの大きさや最終修正時刻、省略可能なチェックサムも保存されます。
</p></dd><dt><span class="term"><code class="option">--no-slot</code></span></dt><dd><p>
<span class="original">
Prevents the creation of a temporary replication slot
for the backup.
</span>
バックアップ時に一時レプリケーションスロットを作成しないようにします。
</p><p>
<span class="original">
By default, if log streaming is selected but no slot name is given
with the <option>-S</option> option, then a temporary replication
slot is created (if supported by the source server).
</span>
デフォルトでは、ログストリーミングが選択されたものの<code class="option">-S</code>オプションでスロット名が与えられなかった場合、(ソースサーバがサポートしていれば)一時レプリケーションスロットが作成されます。
</p><p>
<span class="original">
The main purpose of this option is to allow taking a base backup when
the server has no free replication slots. Using a replication slot
is almost always preferred, because it prevents needed WAL from being
removed by the server during the backup.
</span>
このオプションの主な目的は、サーバにレプリケーションスロットの空きが無いときにベースバックアップを取得できるようにすることです。
レプリケーションスロットを使うことは、必要とされるWALがバックアップ中のサーバにより削除されることを防止するため、ほとんどの場合に好ましいです。
</p></dd><dt><span class="term"><code class="option">--no-verify-checksums</code></span></dt><dd><p>
<span class="original">
Disables verification of checksums, if they are enabled on the server
the base backup is taken from.
</span>
ベースバックアップ取得元のサーバでチェックサムの検証が有効になっている場合に、チェックサムの検証を無効化します。
</p><p>
<span class="original">
By default, checksums are verified and checksum failures will result
in a non-zero exit status. However, the base backup will not be
removed in such a case, as if the <option>&#45;-no-clean</option> option
had been used. Checksum verification failures will also be reported
in the <link linkend="monitoring-pg-stat-database-view">
<structname>pg_stat_database</structname></link> view.
</span>
デフォルトでは、チェックサムは検証され、チェックサムエラーは非ゼロの終了ステータスをもたらします。
とはいえ、このような場合には、<code class="option">--no-clean</code>オプションが使われていたかのように、ベースバックアップは削除されません。
チェックサム検証の失敗は<a class="link" href="monitoring-stats.html#MONITORING-PG-STAT-DATABASE-VIEW" title="27.2.17. pg_stat_database"><code class="structname">pg_stat_database</code></a>ビューでも報告されます。
</p></dd></dl></div><p>
</p><p>
<span class="original">
The following command-line options control the connection to the source
server:
</span>
以下のオプションはソースサーバへの接続パラメータを制御します。
</p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="option">-d <em class="replaceable"><code>connstr</code></em></code><br /></span><span class="term"><code class="option">--dbname=<em class="replaceable"><code>connstr</code></em></code></span></dt><dd><p>
<span class="original">
Specifies parameters used to connect to the server, as a <link
linkend="libpq-connstring">connection string</link>; these
will override any conflicting command line options.
</span>
サーバとの接続のために使用するパラメータを、<a class="link" href="libpq-connect.html#LIBPQ-CONNSTRING" title="32.1.1. 接続文字列">接続文字列</a>として指定します。
衝突するコマンドラインオプションよりも優先します。
</p><p>
<span class="original">
This option is called <literal>&#45;-dbname</literal> for consistency with other
client applications, but because <application>pg_basebackup</application>
doesn't connect to any particular database in the cluster, any database
name included in the connection string will be ignored by the server.
However, a database name supplied that way overrides the default
database name (<literal>replication</literal>) for purposes of
looking up the replication connection's password
in <filename>~/.pgpass</filename>. Similarly, middleware or proxies
used in connecting to <productname>PostgreSQL</productname> might
utilize the name for purposes such as connection routing. The
database name can also be used
by <link linkend="logicaldecoding-replication-slots-synchronization">
logical replication slot synchronization</link>.
</span>
他のクライアントアプリケーションとの整合性を保つために、このオプションは<code class="literal">--dbname</code>と呼ばれますが、<span class="application">pg_basebackup</span>はクラスタ内の特定のデータベースに接続しないため、接続文字列に含まれるデータベース名はサーバによって無視されます。
しかし、そのようにして提供されたデータベース名は、レプリケーション接続のパスワードを<code class="filename">~/.pgpass</code>で検索するためのデフォルトのデータベース名(<code class="literal">replication</code>)を上書きします。
同様に、<span class="productname">PostgreSQL</span>への接続に使用されるミドルウェアやプロキシは、接続ルーティングなどのために、この名前を利用する可能性があります。
データベース名は<a class="link" href="logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS-SYNCHRONIZATION" title="47.2.3. レプリケーションスロットの同期">論理レプリケーションスロットの同期</a>でも使用できます。
</p></dd><dt><span class="term"><code class="option">-h <em class="replaceable"><code>host</code></em></code><br /></span><span class="term"><code class="option">--host=<em class="replaceable"><code>host</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the host name of the machine on which the server is
running. If the value begins with a slash, it is used as the
directory for a Unix domain socket. The default is taken
from the <envar>PGHOST</envar> environment variable, if set,
else a Unix domain socket connection is attempted.
</span>
サーバが稼働しているマシンのホスト名を指定します。
この値がスラッシュから始まる場合、Unixドメインソケット用のディレクトリとして使用されます。
デフォルトは、設定されていれば環境変数<code class="envar">PGHOST</code>から取得されます。
設定されていなければ、Unixドメインソケット接続とみなされます。
</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">--port=<em class="replaceable"><code>port</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the TCP port or local Unix domain socket file
extension on which the server is listening for connections.
Defaults to the <envar>PGPORT</envar> environment variable, if
set, or a compiled-in default.
</span>
サーバが接続を監視するTCPポートもしくはローカルUnixドメインソケットファイルの拡張子を指定します。
デフォルトは、設定されている場合、環境変数<code class="envar">PGPORT</code>の値となります。設定されていなければ、コンパイル時のデフォルト値となります。
</p></dd><dt><span class="term"><code class="option">-s <em class="replaceable"><code>interval</code></em></code><br /></span><span class="term"><code class="option">--status-interval=<em class="replaceable"><code>interval</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the number of seconds between status packets sent back to
the source server. Smaller values allow more accurate monitoring of
backup progress from the server.
A value of zero disables periodic status updates completely,
although an update will still be sent when requested by the server, to
avoid timeout-based disconnects. The default value is 10 seconds.
</span>
状態パケットがソースサーバに返送される間隔を秒単位で指定します。
より小さな値を指定することで、より正確にサーバからバックアップの進行状況を監視できます。
ゼロという値は定期的な状態更新を完全に無効にします。
しかし、タイムアウトによる切断を防止するために、サーバにより要求された場合には更新が送信されます。
デフォルト値は10秒です。
</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">--username=<em class="replaceable"><code>username</code></em></code></span></dt><dd><p>
<span class="original">
Specifies the user name to connect as.
</span>
接続ユーザ名を指定します。
</p></dd><dt><span class="term"><code class="option">-w</code><br /></span><span class="term"><code class="option">--no-password</code></span></dt><dd><p>
<span class="original">
Prevents issuing a password prompt. If the server requires
password authentication and a password is not available by
other means such as a <filename>.pgpass</filename> file, the
connection attempt will fail. This option can be useful in
batch jobs and scripts where no user is present to enter a
password.
</span>
パスワードの入力を促しません。
サーバがパスワード認証を必要とし、かつ、<code class="filename">.pgpass</code>ファイルなどの他の方法が利用できない場合、接続試行は失敗します。
バッチジョブやスクリプトなどパスワードを入力するユーザが存在しない場合にこのオプションは有用かもしれません。
</p></dd><dt><span class="term"><code class="option">-W</code><br /></span><span class="term"><code class="option">--password</code></span></dt><dd><p>
<span class="original">
Forces <application>pg_basebackup</application> to prompt for a
password before connecting to the source server.
</span>
ソースサーバに接続する前に、<span class="application">pg_basebackup</span>は強制的にパスワード入力を促します。
</p><p>
<span class="original">
This option is never essential, since
<application>pg_basebackup</application> will automatically prompt
for a password if the server demands password authentication.
However, <application>pg_basebackup</application> will waste a
connection attempt finding out that the server wants a password.
In some cases it is worth typing <option>-W</option> to avoid the extra
connection attempt.
</span>
サーバがパスワード認証を要求する場合<span class="application">pg_basebackup</span>は自動的にパスワード入力を促しますので、これが重要になることはありません。
しかし、<span class="application">pg_basebackup</span>は、サーバにパスワードが必要かどうかを判断するための接続試行を無駄に行います。
こうした余計な接続試行を防ぐために<code class="option">-W</code>の入力が有意となる場合もあります。
</p></dd></dl></div><p>
</p><p>
<span class="original">
Other options are also available:
</span>
以下のその他のオプションも使用することができます。
</p><div class="variablelist"><dl class="variablelist"><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">
Prints the <application>pg_basebackup</application> version and exits.
</span>
<span class="application">pg_basebackup</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">
Shows help about <application>pg_basebackup</application> command line
arguments, and exits.
</span>
<span class="application">pg_basebackup</span>コマンドライン引数の使用方法を表示し、終了します。
</p></dd></dl></div><p>
</p></div><div class="refsect1" id="id-1.9.4.10.7"><h2>環境</h2><span class="original">
<title>Environment</title>
</span><p>
<span class="original">
This utility, like most other <productname>PostgreSQL</productname> utilities,
uses the environment variables supported by <application>libpq</application>
(see <xref linkend="libpq-envars"/>).
</span>
このユーティリティは、他のほとんどの<span class="productname">PostgreSQL</span>ユーティリティと同様、<span class="application">libpq</span>でサポートされる環境変数(<a class="xref" href="libpq-envars.html" title="32.15. 環境変数">32.15</a>参照)を使います。
</p><p>
<span class="original">
The environment variable <envar>PG_COLOR</envar> specifies whether to use
color in diagnostic messages. Possible values are
<literal>always</literal>, <literal>auto</literal> and
<literal>never</literal>.
</span>
環境変数<code class="envar">PG_COLOR</code>は診断メッセージで色を使うかどうかを指定します。
指定可能な値は<code class="literal">always</code>、<code class="literal">auto</code>、<code class="literal">never</code>です。
</p></div><div class="refsect1" id="id-1.9.4.10.8"><h2>注釈</h2><span class="original">
<title>Notes</title>
</span><p>
<span class="original">
At the beginning of the backup, a checkpoint needs to be performed on the
source server. This can take some time (especially if the option
<literal>&#45;-checkpoint=fast</literal> is not used), during
which <application>pg_basebackup</application> will appear to be idle.
</span>
バックアップの開始時に、ソースサーバ上でチェックポイントを実行する必要があります。
(特にオプション <code class="literal">--checkpoint=fast</code> を使用していない場合)これには少し時間を要する場合があり、その間 <span class="application">pg_basebackup</span> はアイドル状態であるように見えます。
</p><p>
<span class="original">
The backup will include all files in the data directory and tablespaces,
including the configuration files and any additional files placed in the
directory by third parties, except certain temporary files managed by
PostgreSQL and operating system files. But only regular files and
directories are copied, except that
symbolic links used for tablespaces are preserved. Symbolic links pointing
to certain directories known to PostgreSQL are copied as empty directories.
Other symbolic links and special device files are skipped.
See <xref linkend="protocol-replication"/> for the precise details.
</span>
このバックアップには、設定ファイルやサードパーティによりディレクトリに格納された追加ファイルを含め、データディレクトリとテーブル空間内のすべてのファイルが含まれますが、PostgreSQLによって管理される一部の一時ファイルとオペレーティングシステムのファイルは含まれません。
ただし、テーブル空間に使われるシンボリックリンクが保存されることを除くと、通常のファイルとディレクトリのみがコピーされます。
PostgreSQLが認識している一部のディレクトリを指すシンボリックリンクは空のディレクトリとしてコピーされます。
その他のシンボリックリンクおよび特殊デバイスファイルはスキップされます。
(正確な詳細については<a class="xref" href="protocol-replication.html" title="54.4. ストリーミングレプリケーションプロトコル">54.4</a>を参照してください。)
</p><p>
<span class="original">
In plain format, tablespaces will be backed up to the same path
they have on the source server, unless the
option <literal>&#45;-tablespace-mapping</literal> is used. Without
this option, running a plain format base backup on the same host as the
server will not work if tablespaces are in use, because the backup would
have to be written to the same directory locations as the original
tablespaces.
</span>
plain形式では、オプション<code class="literal">--tablespace-mapping</code>が使われなければ、テーブル空間はソースサーバ上のと同じパスでバックアップされます。
このオプションがないと、サーバと同じホスト上でのplain形式のベースバックアップの実行は動作しません、というのは、バックアップを元のテーブル空間と同じディレクトリに書き込まなければならないからです。
</p><p>
<span class="original">
When tar format is used, it is the user's responsibility to unpack each
tar file before starting a PostgreSQL server that uses the data. If there
are additional tablespaces, the
tar files for them need to be unpacked in the correct locations. In this
case the symbolic links for those tablespaces will be created by the server
according to the contents of the <filename>tablespace_map</filename> file that is
included in the <filename>base.tar</filename> file.
</span>
tar形式を使う場合、そのデータを使うPostgreSQLサーバを起動する前に各tarファイルを解凍するのはユーザの責任です。
追加のテーブル空間がある場合、それについてのtarファイルは、正しい場所に解凍される必要があります。
この場合、テーブル空間へのシンボリックリンクは、<code class="filename">base.tar</code>ファイルに含まれる<code class="filename">tablespace_map</code>ファイルの内容に基づいて、サーバが作成します。
</p><p>
<span class="original">
<application>pg_basebackup</application> works with servers of the same
or older major version, down to 9.1. However, WAL streaming mode (<literal>-X