Linux command
pg_receivewal 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Receive WAL
pg_receivewal -D [wal_dir] -h [host] -U [username]
Receive using a replication slot
pg_receivewal -D [wal_dir] -S [slot_name] -h [host]
Create a replication slot
pg_receivewal -D [wal_dir] -S [slot_name] --create-slot -h [host]
Receive with gzip compression
pg_receivewal -D [wal_dir] -Z [gzip:5] -h [host]
Receive without looping
pg_receivewal -D [wal_dir] -n -h [host]
说明
pg_receivewal streams WAL from server to archive. Creates continuous WAL archive for point-in-time recovery. Alternative to archive_command for WAL archiving.
参数
- -D, --directory _dir_
- WAL destination directory (required).
- -h, --host _host_
- Server hostname or socket directory.
- -p, --port _port_
- Server port number.
- -U, --username _name_
- Username to connect as.
- -S, --slot _name_
- Use a replication slot.
- -Z, --compress _method:detail_
- Compression method and optional level (gzip, lz4, or none).
- -n, --no-loop
- Don't retry on connection errors; exit immediately.
- -s, --status-interval _seconds_
- Seconds between status packets (default: 10).
- -E, --endpos _lsn_
- Stop replication at the specified LSN.
- --create-slot
- Create a new physical replication slot, then exit.
- --drop-slot
- Drop the named replication slot, then exit.
- --if-not-exists
- Don't error if slot already exists with --create-slot.
- --synchronous
- Flush WAL data to disk immediately after receipt.
- --no-sync
- Don't force WAL data to be flushed to disk.
FAQ
What is the pg_receivewal command used for?
pg_receivewal streams WAL from server to archive. Creates continuous WAL archive for point-in-time recovery. Alternative to archive_command for WAL archiving.
How do I run a basic pg_receivewal example?
Run `pg_receivewal -D [wal_dir] -h [host] -U [username]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -D, --directory _dir_ do in pg_receivewal?
WAL destination directory (required).