NAME
pg-basebackup -- make base backup from PostgreSQL instance
SYNOPSIS
pg-basebackup -sdfeukr
pg-basebackup --src postgres:/// --dst . --file backup.tar.lz4
DESCRIPTION
-s, --src, --url Backup source URL, optional, "postgres:///" by default, if password is required, it should be given in url, ENV or .pgpass
-d, --dst, --dir Where to put backup files, "/pg/backup" by default
-f, --file Overwrite default backup filename, "backup_${tag}_${date}.tar.lz4"-r, --remove .lz4 Files mtime before n minutes ago will be removed, default is 1200(20hour)-t, --tag Backup file tag, if not set, target cluster_name or local ip address will be used. Also used as part of DEFAULT filename
-k, --key Encryption key when --encrypt is specified, default key is ${tag}-u, --upload Upload backup files to cloud storage, (need your own implementation)-e, --encryption Encrypt with RC4 using OpenSSL, if not key is specified, tag is used as key
-h, --help Print this message
postgres@pg-meta-1:~$ pg-basebackup
[2025-07-13 06:16:05][INFO]================================================================[2025-07-13 06:16:05][INFO][INIT] pg-basebackup begin, checking parameters
[2025-07-13 06:16:05][DEBUG][INIT]#====== BINARY[2025-07-13 06:16:05][DEBUG][INIT] pg_basebackup : /usr/pgsql/bin/pg_basebackup
[2025-07-13 06:16:05][DEBUG][INIT] openssl : /usr/bin/openssl
[2025-07-13 06:16:05][DEBUG][INIT]#====== PARAMETER[2025-07-13 06:16:05][DEBUG][INIT] filename (-f) : backup_pg-meta_20250713.tar.lz4
[2025-07-13 06:16:05][DEBUG][INIT] src (-s) : postgres:///
[2025-07-13 06:16:05][DEBUG][INIT] dst (-d) : /pg/backup
[2025-07-13 06:16:05][DEBUG][INIT] tag (-t) : pg-meta
[2025-07-13 06:16:05][DEBUG][INIT] key (-k) : pg-meta
[2025-07-13 06:16:05][DEBUG][INIT] encrypt (-e) : false[2025-07-13 06:16:05][DEBUG][INIT] upload (-u) : false[2025-07-13 06:16:05][DEBUG][INIT] remove (-r) : -mmin +1200
[2025-07-13 06:16:05][INFO][LOCK] acquire lock @ /tmp/backup.lock
[2025-07-13 06:16:05][INFO][LOCK] lock acquired success on /tmp/backup.lock, pid=107417[2025-07-13 06:16:05][INFO][BKUP] backup begin, from postgres:/// to /pg/backup/backup_pg-meta_20250713.tar.lz4
[2025-07-13 06:16:05][INFO][BKUP] backup in normal mode
pg_basebackup: initiating base backup, waiting for checkpoint to completepg_basebackup: checkpoint completed
pg_basebackup: write-ahead log start point: 0/7000028 on timeline 1pg_basebackup: write-ahead log end point: 0/7000FD8
pg_basebackup: syncing data to disk ...
pg_basebackup: base backup completed
[2025-07-13 06:16:06][INFO][BKUP] backup complete!
[2025-07-13 06:16:06][INFO][RMBK] remove local obsolete backup: 1200[2025-07-13 06:16:06][INFO][BKUP] find obsolete backups: find /pg/backup/ -maxdepth 1 -type f -mmin +1200 -name 'backup*.lz4'[2025-07-13 06:16:06][WARN][BKUP] remove obsolete backups:
[2025-07-13 06:16:06][INFO][RMBK] remove old backup complete[2025-07-13 06:16:06][INFO][LOCK] release lock @ /tmp/backup.lock
[2025-07-13 06:16:06][INFO][DONE] backup procedure complete!
[2025-07-13 06:16:06][INFO]================================================================