Meetup Lille
Stefan Fercot
(28 janvier 2020)
Support |
Formation |
Conseil |
COMMIT
) une fois synchronisées sur disque$ pgbackrest --stanza=my_stanza stanza-create
P00 INFO: stanza-create command begin 2.23: ...
P00 INFO: stanza-create command end: completed successfully
$ pgbackrest --stanza=my_stanza check
P00 INFO: check command begin 2.23: ...
P00 INFO: WAL segment 000000010000000000000001 successfully archived to ...
P00 INFO: check command end: completed successfully
$ pgbackrest --stanza=my_stanza --type=full backup
P00 INFO: backup command begin 2.23: ...
P00 INFO: execute non-exclusive pg_start_backup() with label "...":
backup begins after the requested immediate checkpoint completes
P00 INFO: backup start archive = 000000010000000000000003, lsn = 0/3000060
P00 INFO: full backup size = 24.2MB
P00 INFO: execute non-exclusive pg_stop_backup() and wait for all WAL segments
to archive
P00 INFO: backup stop archive = 000000010000000000000003, lsn = 0/3000138
P00 INFO: new backup label = 20200128-150158F
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin 2.23: ...
P00 INFO: expire command end: completed successfully
$ pgbackrest --stanza=my_stanza --type=diff backup
P00 INFO: backup command begin 2.23: ...
P00 INFO: last backup label = 20200128-150158F, version = 2.23
P00 INFO: execute non-exclusive pg_start_backup() with label "...":
backup begins after the requested immediate checkpoint completes
P00 INFO: backup start archive = 000000010000000000000005, lsn = 0/5000028
P00 INFO: diff backup size = 24.2MB
P00 INFO: execute non-exclusive pg_stop_backup() and wait for all WAL segments
to archive
P00 INFO: backup stop archive = 000000010000000000000005, lsn = 0/5000138
P00 INFO: new backup label = 20200128-150158F_20200128-150245D
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin 2.23: ...
P00 INFO: expire command end: completed successfully
$ pgbackrest --stanza=my_stanza --type=incr backup
P00 INFO: backup command begin 2.23: ...
P00 INFO: last backup label = 20200128-150158F_20200128-150245D, version = 2.23
P00 INFO: execute non-exclusive pg_start_backup() with label "...":
backup begins after the requested immediate checkpoint completes
P00 INFO: backup start archive = 000000010000000000000007, lsn = 0/7000028
P00 INFO: incr backup size = 24.2MB
P00 INFO: execute non-exclusive pg_stop_backup() and wait for all WAL segments
to archive
P00 INFO: backup stop archive = 000000010000000000000007, lsn = 0/7000138
P00 INFO: new backup label = 20200128-150158F_20200128-150410I
P00 INFO: backup command end: completed successfully
P00 INFO: expire command begin 2.23: ...
P00 INFO: expire command end: completed successfully
INFO
$ pgbackrest info --stanza=my_stanza
stanza: my_stanza
status: ok
cipher: none
db (current)
wal archive min/max (12-1): 000000010000000000000003/000000010000000000000007
full backup: 20200128-150158F
timestamp start/stop: 2020-01-28 15:01:58 / 2020-01-28 15:02:14
wal start/stop: 000000010000000000000003 / 000000010000000000000003
database size: 24.2MB, backup size: 24.2MB
repository size: 2.9MB, repository backup size: 2.9MB
...
--repo-type
Repository Type Option (--repo-type)
Type of storage used for the repository.
The following repository types are supported:
cifs - Like posix, but disables links and directory fsyncs
posix - Posix-compliant file systems
s3 - AWS Simple Storage Service
Attention au CIFS !
[global]
repo1-host=backup-srv
repo1-host-user=postgres
...
[my_stanza]
pg1-path=/var/lib/pgsql/12/data
archive_command
$ sudo yum install nagios-plugins-pgbackrest-1.7-1.noarch.rpm
#===============================================================================
Package Repository
#===============================================================================
Installing:
nagios-plugins-pgbackrest nagios-plugins-pgbackrest-1.7-1.noarch
Installing for dependencies:
nagios-common epel
nagios-plugins epel
perl-IO-Tty base
perl-JSON base
perl-Net-SFTP-Foreign epel
perl-Sort-Key epel
#===============================================================================
--retention-full
--retention-age
--retention-age-to-full
--retention-full
--output=human
$ check_pgbackrest --stanza=my_stanza
--service=retention --retention-full=1 --output=human
Service : BACKUPS_RETENTION
Returns : 0 (OK)
Message : backups policy checks ok
Long message : full=1
Long message : diff=1
Long message : incr=1
Long message : latest=incr,20200128-150158F_20200128-150410I
Long message : latest_age=2m24s
$ check_pgbackrest --stanza=my_stanza
--service=retention --retention-full=1 --output=human
--retention-age=24h --retention-age-to-full=7d
Service : BACKUPS_RETENTION
Returns : 0 (OK)
Message : backups policy checks ok
Long message : full=1
Long message : diff=1
Long message : incr=1
Long message : latest=incr,20200128-150158F_20200128-150410I
Long message : latest_age=2m47s
Long message : latest_full=20200128-150158F
Long message : latest_full_age=5m
Se base uniquement sur la sortie de la commande pgbackrest info
!
pgbackrest info
--wal-segsize=size
Vérifier segment par segment, wal après wal !
--output=human
$ check_pgbackrest --stanza=my_stanza
--service=archives --repo-path=/var/lib/pgbackrest/archive --output=human
Service : WAL_ARCHIVES
Returns : 0 (OK)
Message : 81 WAL archived
Message : latest archived since 1m59s
Long message : latest_archive_age=1m59s
Long message : num_archives=81
Long message : archives_dir=/var/lib/pgbackrest/archive/my_stanza/12-1
Long message : min_wal=000000010000000000000003
Long message : max_wal=000000010000000000000053
Long message : oldest_archive=000000010000000000000003
Long message : latest_archive=000000010000000000000053
Long message : latest_bck_archive_start=000000010000000000000007
Long message : latest_bck_type=incr
$ rm -rf [...]/archive/my_stanza/12-1/0000000100000000/00000001000000000000001*
$ pgbackrest info --stanza=my_stanza
stanza: my_stanza
status: ok
cipher: none
db (current)
wal archive min/max (12-1): 000000010000000000000003/000000010000000000000053
...
pgBackRest ne remonte pas d’erreur !
$ check_pgbackrest --stanza=my_stanza
--service=archives --repo-path=/var/lib/pgbackrest/archive --output=human
Service : WAL_ARCHIVES
Returns : 2 (CRITICAL)
Message : wrong sequence or missing file @ '000000010000000000000010'
...
Message : wrong sequence or missing file @ '00000001000000000000001F'
...
Long message : min_wal=000000010000000000000003
Long message : max_wal=000000010000000000000053
Long message : oldest_archive=000000010000000000000003
Long message : latest_archive=000000010000000000000053
Long message : latest_bck_archive_start=000000010000000000000007
Long message : latest_bck_type=incr
latest_bck_archive_start
--repo-host
et --repo-host-user
Net::SFTP::Foreign
--repo-host
, --repo-host-user
repo1-s3-key
et repo1-s3-key-secret
Config::IniFiles
Net::Amazon::S3
--repo-s3
, --repo-s3-over-http
--ignore-archived-before
--ignore-archived-after
--latest-archive-age-alert
icinga-srv
exécute les commandes check_pgbackrest
en SSH avec Icinga 2pgsql-srv
héberge l’instance PostgreSQL à sauvegarder avec pgBackRestbackup-srv
héberge le partage CIFSicinga-srv
exécute les commandes check_pgbackrest
en SSH avec Icinga 2pgsql-srv
héberge l’instance PostgreSQL à sauvegarder avec pgBackRestbackup-srv
héberge les sauvegardes et archives de pgBackRestbackup-srv
icinga-srv
exécute les commandes check_pgbackrest
en SSH avec Icinga 2pgsql-srv
héberge l’instance PostgreSQL à sauvegarder avec pgBackRestbackup-srv
héberge le serveur MinIOpgbackrest ls
mtime
disponible à partir de la version 2.21cat
pour les .history
$ pgbackrest help ls
pgBackRest 2.23 - 'ls' command help
List paths/files in the repository.
This is intended to be a general purpose list function, but for now it only
works on the repository.
Command Options:
--filter filter output with a regular expression
--output output format [default=text]
--recurse include all subpaths in output [default=n]
--sort sort output ascending, descending, or none
[default=asc]
.deb
?renesepp
)