pg_checksums
pg_checksums — enable, disable or check data checksums in a PostgreSQL database cluster
当前阅读 PG 18·选择有来源记录的版本
此版本暂无所选语言的定义,以下显示原始英文内容。
- Documented executable
- pg_checksums
- Executable version
- 18.6
- Reference inventory
- Server applications
- Option definition groups
- 11
- manual path
- app-pgchecksums.html
- signature
- pg_checksums [ option ...] [[ -D | --pgdata ] datadir ]
- synopsis
- pg_checksums [ option ...] [[ -D | --pgdata ] datadir ]
版本定义 PG 18
pg_checksums
pg_checksums — enable, disable or check data checksums in a PostgreSQL database cluster
Synopsis
pg_checksums [option...] [[ -D | --pgdata ]datadir]
Description
pg_checksums checks, enables or disables data checksums in a PostgreSQL cluster. The server must be shut down cleanly before running pg_checksums. When verifying checksums, the exit status is zero if there are no checksum errors, and nonzero if at least one checksum failure is detected. When enabling or disabling checksums, the exit status is nonzero if the operation failed.
When verifying checksums, every file in the cluster is scanned. When enabling checksums, each relation file block with a changed checksum is rewritten in-place. Disabling checksums only updates the file pg_control.
Options
The following command-line options are available:
-Ddirectory--pgdata=directory-
Specifies the directory where the database cluster is stored.
-c--check-
Checks checksums. This is the default mode if nothing else is specified.
-d--disable-
Disables checksums.
-e--enable-
Enables checksums.
-ffilenode--filenode=filenode-
Only validate checksums in the relation with filenode
filenode. -N--no-sync-
By default,
pg_checksumswill wait for all files to be written safely to disk. This option causespg_checksumsto return without waiting, which is faster, but means that a subsequent operating system crash can leave the updated data directory corrupt. Generally, this option is useful for testing but should not be used on a production installation. This option has no effect when using--check. -P--progress-
Enable progress reporting. Turning this on will deliver a progress report while checking or enabling checksums.
--sync-method=method-
When set to
fsync, which is the default,pg_checksumswill recursively open and synchronize all files in the data directory. The search for files will follow symbolic links for the WAL directory and each configured tablespace.On Linux,
syncfsmay be used instead to ask the operating system to synchronize the whole file systems that contain the data directory, the WAL files, and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when usingsyncfs.This option has no effect when
--no-syncis used. -v--verbose-
Enable verbose output. Lists all checked files.
-V--version-
Print the pg_checksums version and exit.
-?--help-
Show help about pg_checksums command line arguments, and exit.
Environment
PGDATA-
Specifies the directory where the database cluster is stored; can be overridden using the
-Doption. PG_COLOR-
Specifies whether to use color in diagnostic messages. Possible values are
always,autoandnever.
Notes
Enabling checksums in a large cluster can potentially take a long time. During this operation, the cluster or other programs that write to the data directory must not be started or else data loss may occur.
When using a replication setup with tools which perform direct copies of relation file blocks (for example pg_rewind), enabling or disabling checksums can lead to page corruptions in the shape of incorrect checksums if the operation is not done consistently across all nodes. When enabling or disabling checksums in a replication setup, it is thus recommended to stop all the clusters before switching them all consistently. Destroying all standbys, performing the operation on the primary and finally recreating the standbys from scratch is also safe.
If pg_checksums is aborted or killed while enabling or disabling checksums, the cluster's data checksum configuration remains unchanged, and pg_checksums can be re-run to perform the same operation.
Documented options
| Option and arguments | Description |
|---|---|
| -D directory --pgdata= directory | Specifies the directory where the database cluster is stored. |
| -c --check | Checks checksums. This is the default mode if nothing else is specified. |
| -d --disable | Disables checksums. |
| -e --enable | Enables checksums. |
| -f filenode --filenode= filenode | Only validate checksums in the relation with filenode filenode . |
| -N --no-sync | By default, pg_checksums will wait for all files to be written safely to disk. This option causes pg_checksums to return without waiting, which is faster, but means that a subsequent operating system crash can leave the updated data directory corrupt. Generally, this option is useful for testing but should not be used on a production installation. This option has no effect when using --check . |
| -P --progress | Enable progress reporting. Turning this on will deliver a progress report while checking or enabling checksums. |
| --sync-method= method | When set to fsync , which is the default, pg_checksums will recursively open and synchronize all files in the data directory. The search for files will follow symbolic links for the WAL directory and each configured tablespace. |
| -v --verbose | Enable verbose output. Lists all checked files. |
| -V --version | Print the pg_checksums version and exit. |
| -? --help | Show help about pg_checksums command line arguments, and exit. |
Environment variables
| Variable | Meaning |
|---|---|
| PGDATA | Specifies the directory where the database cluster is stored; can be overridden using the -D option. |
| PG_COLOR | Specifies whether to use color in diagnostic messages. Possible values are always , auto and never . |
比较版本
完整来源事实
environment
map[description:Specifies the directory where the database cluster is stored; can be overridden using the -D option. name:PGDATA], map[description:Specifies whether to use color in diagnostic messages. Possible values are always , auto and never . name:PG_COLOR]
options
map[description:Specifies the directory where the database cluster is stored. names:[-D directory --pgdata= directory] signature:-D directory --pgdata= directory source_url:/docs/18/app-pgchecksums.html summary:Specifies the directory where the database cluster is stored.], map[description:Checks checksums. This is the default mode if nothing else is specified. names:[-c --check] signature:-c --check source_url:/docs/18/app-pgchecksums.html summary:Checks checksums. This is the default mode if nothing else is specified.], map[description:Disables checksums. names:[-d --disable] signature:-d --disable source_url:/docs/18/app-pgchecksums.html summary:Disables checksums.], map[description:Enables checksums. names:[-e --enable] signature:-e --enable source_url:/docs/18/app-pgchecksums.html summary:Enables checksums.], map[description:Only validate checksums in the relation with filenode filenode . names:[-f filenode --filenode= filenode] signature:-f filenode --filenode= filenode source_url:/docs/18/app-pgchecksums.html summary:Only validate checksums in the relation with filenode filenode .], map[description:By default, pg_checksums will wait for all files to be written safely to disk. This option causes pg_checksums to return without waiting, which is faster, but means that a subsequent operating system crash can leave the updated data directory corrupt. Generally, this option is useful for testing but should not be used on a production installation. This option has no effect when using --check . names:[-N --no-sync] signature:-N --no-sync source_url:/docs/18/app-pgchecksums.html summary:By default, pg_checksums will wait for all files to be written safely to disk. This option causes pg_checksums to return without waiting, which is faster, but means that a subsequent operating system crash can leave the updated data directory corrupt. Generally, this option is useful for testing but should not be used on a production installation. This option has no effect when using --check .], map[description:Enable progress reporting. Turning this on will deliver a progress report while checking or enabling checksums. names:[-P --progress] signature:-P --progress source_url:/docs/18/app-pgchecksums.html summary:Enable progress reporting. Turning this on will deliver a progress report while checking or enabling checksums.], map[description:When set to fsync , which is the default, pg_checksums will recursively open and synchronize all files in the data directory. The search for files will follow symbolic links for the WAL directory and each configured tablespace. On Linux, syncfs may be used instead to ask the operating system to synchronize the whole file systems that contain the data directory, the WAL files, and each tablespace. See recovery_init_sync_method for information about the caveats to be aware of when using syncfs . This option has no effect when --no-sync is used. names:[--sync-method= method] signature:--sync-method= method source_url:/docs/18/app-pgchecksums.html summary:When set to fsync , which is the default, pg_checksums will recursively open and synchronize all files in the data directory. The search for files will follow symbolic links for the WAL directory and each configured tablespace.], map[description:Enable verbose output. Lists all checked files. names:[-v --verbose] signature:-v --verbose source_url:/docs/18/app-pgchecksums.html summary:Enable verbose output. Lists all checked files.], map[description:Print the pg_checksums version and exit. names:[-V --version] signature:-V --version source_url:/docs/18/app-pgchecksums.html summary:Print the pg_checksums version and exit.], map[description:Show help about pg_checksums command line arguments, and exit. names:[-? --help] signature:-? --help source_url:/docs/18/app-pgchecksums.html summary:Show help about pg_checksums command line arguments, and exit.]
来源引用
定义来源
center · PostgreSQL 18 · ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8
正文语言: en · ee8d1a3612338fd9adf250730cb640fcc5233b5491337cc00a316a44e3a0b9f8