EnterpriseDB / barman

Barman - Backup and Recovery Manager for PostgreSQL
https://www.pgbarman.org/
GNU General Public License v3.0
2.04k stars 191 forks source link

minimum redundancy requirements: FAILED (have 0 backups, expected at least 1) #569

Open miguelconde91 opened 2 years ago

miguelconde91 commented 2 years ago

I'm using 2.19 Barman by EnterpriseDB I executed barman check pg-0 and return this log:

2022-05-12 18:04:32,248 [300] barman.config DEBUG: Including configuration file: pg-0.conf
2022-05-12 18:04:32,248 [300] barman.cli DEBUG: Initialised Barman version 2.19 (config: /etc/barman.conf, args: {'color': 'auto', 'quiet': False, 'debug': False, 'format': 'console', 'command': 'check', 'server_name': ['pg-0'], 'nagios': False, 'func': <function check at 0x7fccbc7f3dc0>})
2022-05-12 18:04:32,252 [300] barman.server DEBUG: Retention policy for server pg-0: RECOVERY WINDOW OF 3 MONTHS
2022-05-12 18:04:32,252 [300] barman.server DEBUG: WAL retention policy for server pg-0: MAIN
Server pg-0:
2022-05-12 18:04:32,253 [300] barman.server DEBUG: Starting check: 'WAL archive'
2022-05-12 18:04:32,253 [300] barman.server DEBUG: Starting check: 'empty incoming directory'
2022-05-12 18:04:32,253 [300] barman.server DEBUG: Starting check: 'empty streaming directory'
2022-05-12 18:04:32,253 [300] barman.server DEBUG: Starting check: 'PostgreSQL'
2022-05-12 18:04:32,344 [300] barman.command_wrappers DEBUG: Command: ['/usr/bin/pg_receivewal', '--version']
2022-05-12 18:04:32,399 [300] barman.command_wrappers DEBUG: Command return code: 0
2022-05-12 18:04:32,399 [300] barman.command_wrappers DEBUG: Command stdout: pg_receivewal (PostgreSQL) 14.2 (Debian 14.2-1.pgdg110+1)

2022-05-12 18:04:32,400 [300] barman.command_wrappers DEBUG: Command stderr: 
2022-05-12 18:04:32,405 [300] barman.wal_archiver DEBUG: Look for 'barman_receive_wal' in 'synchronous_standby_names': ['']
2022-05-12 18:04:32,406 [300] barman.wal_archiver DEBUG: Synchronous WAL streaming for barman_receive_wal: False
2022-05-12 18:04:32,407 [300] barman.command_wrappers DEBUG: Command: ['/usr/bin/pg_basebackup', '--version']
2022-05-12 18:04:32,449 [300] barman.command_wrappers DEBUG: Command return code: 0
2022-05-12 18:04:32,450 [300] barman.command_wrappers DEBUG: Command stdout: pg_basebackup (PostgreSQL) 14.2 (Debian 14.2-1.pgdg110+1)

2022-05-12 18:04:32,450 [300] barman.command_wrappers DEBUG: Command stderr: 
2022-05-12 18:04:32,452 [300] barman.server DEBUG: Check 'PostgreSQL' succeeded for server 'pg-0'
        PostgreSQL: OK
2022-05-12 18:04:32,453 [300] barman.server DEBUG: Starting check: 'superuser or standard user with backup privileges'
2022-05-12 18:04:32,454 [300] barman.server DEBUG: Check 'superuser or standard user with backup privileges' succeeded for server 'pg-0'
        superuser or standard user with backup privileges: OK
2022-05-12 18:04:32,454 [300] barman.server DEBUG: Starting check: 'PostgreSQL streaming'
2022-05-12 18:04:32,454 [300] barman.server DEBUG: Check 'PostgreSQL streaming' succeeded for server 'pg-0'
        PostgreSQL streaming: OK
2022-05-12 18:04:32,455 [300] barman.server DEBUG: Starting check: 'wal_level'
2022-05-12 18:04:32,455 [300] barman.server DEBUG: Check 'wal_level' succeeded for server 'pg-0'
        wal_level: OK
2022-05-12 18:04:32,455 [300] barman.server DEBUG: Starting check: 'replication slot'
2022-05-12 18:04:32,455 [300] barman.server DEBUG: Check 'replication slot' succeeded for server 'pg-0'
        replication slot: OK
2022-05-12 18:04:32,455 [300] barman.server DEBUG: Starting check: 'directories'
2022-05-12 18:04:32,456 [300] barman.server DEBUG: Check 'directories' succeeded for server 'pg-0'
        directories: OK
2022-05-12 18:04:32,456 [300] barman.server DEBUG: Starting check: 'retention policy settings'
2022-05-12 18:04:32,457 [300] barman.server DEBUG: Check 'retention policy settings' succeeded for server 'pg-0'
        retention policy settings: OK
2022-05-12 18:04:32,458 [300] barman.server DEBUG: Starting check: 'backup maximum age'
2022-05-12 18:04:32,461 [300] barman.server DEBUG: Check 'backup maximum age' succeeded for server 'pg-0'
        backup maximum age: OK (interval provided: 7 days, latest backup age: 26 minutes, 31 seconds)
2022-05-12 18:04:32,462 [300] barman.server DEBUG: Starting check: 'backup minimum size'
2022-05-12 18:04:32,464 [300] barman.server DEBUG: Check 'backup minimum size' succeeded for server 'pg-0'
        backup minimum size: OK (49.2 MiB)
2022-05-12 18:04:32,464 [300] barman.server DEBUG: Starting check: 'wal maximum age'
2022-05-12 18:04:32,467 [300] barman.server DEBUG: Check 'wal maximum age' succeeded for server 'pg-0'
        wal maximum age: OK (no last_wal_maximum_age provided)
2022-05-12 18:04:32,467 [300] barman.server DEBUG: Starting check: 'wal size'
2022-05-12 18:04:32,467 [300] barman.server DEBUG: Check 'wal size' succeeded for server 'pg-0'
        wal size: OK (0 B)
2022-05-12 18:04:32,468 [300] barman.server DEBUG: Starting check: 'compression settings'
2022-05-12 18:04:32,469 [300] barman.server DEBUG: Check 'compression settings' succeeded for server 'pg-0'
        compression settings: OK
2022-05-12 18:04:32,469 [300] barman.server DEBUG: Starting check: 'failed backups'
2022-05-12 18:04:32,470 [300] barman.server DEBUG: Check 'failed backups' succeeded for server 'pg-0'
        failed backups: OK (there are 0 failed backups)
2022-05-12 18:04:32,470 [300] barman.server DEBUG: Starting check: 'minimum redundancy requirements'
2022-05-12 18:04:32,470 [300] barman.server ERROR: Check 'minimum redundancy requirements' failed for server 'pg-0'
        minimum redundancy requirements: FAILED (have 0 backups, expected at least 1)
2022-05-12 18:04:32,470 [300] barman.server DEBUG: Starting check: 'pg_basebackup'
2022-05-12 18:04:32,470 [300] barman.server DEBUG: Check 'pg_basebackup' succeeded for server 'pg-0'
        pg_basebackup: OK
2022-05-12 18:04:32,470 [300] barman.server DEBUG: Starting check: 'pg_basebackup compatible'
2022-05-12 18:04:32,470 [300] barman.server DEBUG: Check 'pg_basebackup compatible' succeeded for server 'pg-0'
        pg_basebackup compatible: OK
2022-05-12 18:04:32,473 [300] barman.server DEBUG: Starting check: 'pg_basebackup supports tablespaces mapping'
2022-05-12 18:04:32,480 [300] barman.server DEBUG: Check 'pg_basebackup supports tablespaces mapping' succeeded for server 'pg-0'
        pg_basebackup supports tablespaces mapping: OK
2022-05-12 18:04:32,480 [300] barman.server DEBUG: Starting check: 'configuration'
2022-05-12 18:04:32,481 [300] barman.server DEBUG: Starting check: 'systemid coherence'
2022-05-12 18:04:32,482 [300] barman.server DEBUG: Check 'systemid coherence' succeeded for server 'pg-0'
        systemid coherence: OK
2022-05-12 18:04:32,482 [300] barman.server DEBUG: Starting check: 'pg_receivexlog'
2022-05-12 18:04:32,483 [300] barman.server DEBUG: Check 'pg_receivexlog' succeeded for server 'pg-0'
        pg_receivexlog: OK
2022-05-12 18:04:32,484 [300] barman.server DEBUG: Starting check: 'pg_receivexlog compatible'
2022-05-12 18:04:32,484 [300] barman.server DEBUG: Check 'pg_receivexlog compatible' succeeded for server 'pg-0'
        pg_receivexlog compatible: OK
2022-05-12 18:04:32,485 [300] barman.server DEBUG: Starting check: 'receive-wal running'
2022-05-12 18:04:32,485 [300] barman.server DEBUG: Check 'receive-wal running' succeeded for server 'pg-0'
        receive-wal running: OK
2022-05-12 18:04:32,486 [300] barman.server DEBUG: Starting check: 'archiver errors'
2022-05-12 18:04:32,487 [300] barman.server DEBUG: Check 'archiver errors' succeeded for server 'pg-0'
        archiver errors: OK

Why I have this FAILED log?

2022-05-12 18:04:32,470 [300] barman.server ERROR: Check 'minimum redundancy requirements' failed for server 'pg-0'
        minimum redundancy requirements: FAILED (have 0 backups, expected at least 1)

I have created a previous manual backup.

elhananjair commented 2 years ago

I suspect that your retention policy setting is creating a problem with the minimum redundancy requirements you have set.

miguelconde91 commented 2 years ago

This is my barman.conf

; Commented lines show the default values

[barman]
; archiver = off
backup_method = rsync
; backup_directory = %(barman_home)s/%(name)s

backup_options = concurrent_backup

; This must be set to the BARMAN_DATA_DIR environment variable
barman_home = /var/lib/barman

barman_user = barman

; barman_lock_directory = %(barman_home)s
compression = gzip
configuration_files_directory = /etc/barman/barman.d
last_backup_maximum_age = 1 week
minimum_redundancy = 1
;network_compression = true
retention_policy = RECOVERY WINDOW of 3 MONTHS
; retention_policy_mode = auto
;reuse_backup = link
streaming_archiver = on
; wal_retention_policy = main

; use empty log_file for stderr output
log_file = ""
log_level = INFO

I have to define minimum_redundancy = 0?

elhananjair commented 2 years ago

I have to define minimum_redundancy = 0? If that's what you want you can do that, but setting minimum_redundancy to something greater than 0 helps you if you accidently try to execute the barman delete command.

In my knowledge, your current config is not a problem by itself. Have you taken any backups yet? check your /var/lib/barman/YOUR-SERVER/base