LinuxCommandLibrary

pg_basebackup

creates a base backup of a PostgreSQL cluster

TLDR

Create backup

$ pg_basebackup -D [backup_dir] -h [host] -U [user]
copy
Backup with progress
$ pg_basebackup -D [backup_dir] -P
copy
Backup as tar
$ pg_basebackup -D [backup_dir] -Ft
copy
Backup with WAL streaming
$ pg_basebackup -D [backup_dir] -X stream
copy

SYNOPSIS

pg_basebackup [options]

DESCRIPTION

pg_basebackup creates a base backup of a PostgreSQL cluster. Foundation for point-in-time recovery and streaming replication setup. Includes all database files.

PARAMETERS

-D, --pgdata dir

Backup destination.
-h, --host host
Database server host.
-U, --username user
Database user.
-P, --progress
Show progress.
-F, --format fmt
Output format (p=plain, t=tar).
-X, --wal-method method
WAL inclusion (fetch, stream, none).
-z
Compress tar output.
-Z level
Compression level.

SEE ALSO

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community