Linux command
pg_basebackup 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Create backup
pg_basebackup -D [backup_dir] -h [host] -U [user]
Backup with progress
pg_basebackup -D [backup_dir] -P
Backup as tar
pg_basebackup -D [backup_dir] -Ft
Backup with WAL streaming
pg_basebackup -D [backup_dir] -X stream
说明
pg_basebackup creates a base backup of a PostgreSQL cluster. Foundation for point-in-time recovery and streaming replication setup. Includes all database files.
参数
- -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.
FAQ
What is the pg_basebackup command used for?
pg_basebackup creates a base backup of a PostgreSQL cluster. Foundation for point-in-time recovery and streaming replication setup. Includes all database files.
How do I run a basic pg_basebackup example?
Run `pg_basebackup -D [backup_dir] -h [host] -U [user]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -D, --pgdata _dir_ do in pg_basebackup?
Backup destination.