DOCKER: BACKUP DOES NOT EXECUTE

27 views
Skip to first unread message

Alan Eduardo F. Dias

unread,
Feb 23, 2023, 7:28:21 PM2/23/23
to Barman, Backup and Recovery Manager for PostgreSQL
Good Evening,

I'm configuring the Barman in Docker, however, even the Containers having communication with each other via SSH, the "barman check" returned OK in all items, Backup does not happen. I'm configuring a Backup via Streaming.

There are two containers configured:
1) server0001 (barman server 3.4.0)
2) client0001 (PostgreSQL 12)

barman.conf:
[barman]
barman_user = barman
configuration_files_directory = /etc/barman.d
barman_home = /var/lib/barman
log_file = /var/log/barman/barman.log
log_level = DEBUG
compression = gzip

[client0001]
description = "Example of PostgreSQL Database (Streaming-Only)"
conninfo = host=client0001 user=barman dbname=postgres password=123456
streaming_conninfo = host=client0001 user=streaming_barman password=123456
backup_method = postgres
streaming_archiver = on
slot_name = barman
create_slot = auto

"barman check client0001" output:
barman@server0001:/code$ barman check client0001
Server client0001:
        PostgreSQL: OK
        superuser or standard user with backup privileges: OK
        PostgreSQL streaming: OK
        wal_level: OK
        replication slot: OK
        directories: OK
        retention policy settings: OK
        backup maximum age: OK (no last_backup_maximum_age provided)
        backup minimum size: OK (0 B)
        wal maximum age: OK (no last_wal_maximum_age provided)
        wal size: OK (0 B)
        compression settings: OK
        failed backups: OK (there are 0 failed backups)
        minimum redundancy requirements: OK (have 0 backups, expected at least 0)
        pg_basebackup: OK
        pg_basebackup compatible: OK
        pg_basebackup supports tablespaces mapping: OK
        systemid coherence: OK (no system Id stored on disk)
        pg_receivexlog: OK
        pg_receivexlog compatible: OK
        receive-wal running: OK
        archiver errors: OK

"barman replication-status client0001" output:
barman@server0001:/code$ barman replication-status client0001
Status of streaming clients for server 'client0001':
  Current LSN on master: 0/3000060
  Number of streaming clients: 1

  1. Async WAL streamer
     Application name: barman_receive_wal
     Sync stage      : 3/3 Remote write
     Communication   : TCP/IP
     IP Address      : 10.7.0.11 / Port: 59802 / Host: -
     User name       : streaming_barman
     Current state   : streaming (async)
     Replication slot: barman
     WAL sender PID  : 85
     Started at      : 2023-02-24 00:16:34.272204+00:00
     Sent LSN   : 0/3000060 (diff: 0 B)
     Write LSN  : 0/3000060 (diff: 0 B)
     Flush LSN  : 0/3000000 (diff: -96 B)

"barman status client0001" output:
barman@server0001:/code$ barman status client0001
Server client0001:
        Description: Example of PostgreSQL Database (Streaming-Only)
        Active: True
        Disabled: False
        PostgreSQL version: 12.14
        Cluster state: in production
        Current data size: 23.7 MiB
        PostgreSQL Data directory: /var/lib/postgresql/data
        Current WAL segment: 000000010000000000000003
        Passive node: False
        Retention policies: not enforced
        No. of available backups: 0
        First available backup: None
        Last available backup: None
        Minimum redundancy requirements: satisfied (0/0)

"barman diagnose" output:
barman@server0001:/code$ barman diagnose
{
    "global": {
        "config": {
            "barman_home": "/var/lib/barman",
            "barman_user": "barman",
            "compression": "gzip",
            "configuration_files_directory": "/etc/barman.d",
            "errors_list": [],
            "log_file": "/var/log/barman/barman.log",
            "log_level": "DEBUG"
        },
        "system_info": {
            "barman_ver": "3.4.0",
            "kernel_ver": "Linux server0001 5.15.79.1-microsoft-standard-WSL2 #1 SMP Wed Nov 23 01:01:46 UTC 2022 x86_64 GNU/Linux",
            "python_ver": "",
            "release": "Debian GNU/Linux 10.13",
            "rsync_ver": "rsync  version 3.1.3  protocol version 31",
            "ssh_ver": "",
            "timestamp": "2023-02-24T00:18:17.118498+00:00"
        }
    },
    "servers": {
        "client0001": {
            "backups": {},
            "config": {
                "active": true,
                "archiver": false,
                "archiver_batch_size": 0,
                "backup_compression": null,
                "backup_compression_format": null,
                "backup_compression_level": null,
                "backup_compression_location": null,
                "backup_compression_workers": null,
                "backup_directory": "/var/lib/barman/client0001",
                "backup_method": "postgres",
                "backup_options": "concurrent_backup",
                "bandwidth_limit": null,
                "barman_home": "/var/lib/barman",
                "barman_lock_directory": "/var/lib/barman",
                "basebackup_retry_sleep": 30,
                "basebackup_retry_times": 0,
                "basebackups_directory": "/var/lib/barman/client0001/base",
                "check_timeout": 30,
                "compression": "gzip",
                "conninfo": "host=client0001 user=barman dbname=postgres password=*REDACTED*",
                "create_slot": "auto",
                "custom_compression_filter": null,
                "custom_compression_magic": null,
                "custom_decompression_filter": null,
                "description": "Example of PostgreSQL Database (Streaming-Only)",
                "disabled": false,
                "errors_directory": "/var/lib/barman/client0001/errors",
                "forward_config_path": false,
                "immediate_checkpoint": false,
                "incoming_wals_directory": "/var/lib/barman/client0001/incoming",
                "last_backup_maximum_age": null,
                "last_backup_minimum_size": null,
                "last_wal_maximum_age": null,
                "max_incoming_wals_queue": null,
                "minimum_redundancy": 0,
                "msg_list": [],
                "name": "client0001",
                "network_compression": false,
                "parallel_jobs": 1,
                "path_prefix": null,
                "post_archive_retry_script": null,
                "post_archive_script": null,
                "post_backup_retry_script": null,
                "post_backup_script": null,
                "post_delete_retry_script": null,
                "post_delete_script": null,
                "post_recovery_retry_script": null,
                "post_recovery_script": null,
                "post_wal_delete_retry_script": null,
                "post_wal_delete_script": null,
                "pre_archive_retry_script": null,
                "pre_archive_script": null,
                "pre_backup_retry_script": null,
                "pre_backup_script": null,
                "pre_delete_retry_script": null,
                "pre_delete_script": null,
                "pre_recovery_retry_script": null,
                "pre_recovery_script": null,
                "pre_wal_delete_retry_script": null,
                "pre_wal_delete_script": null,
                "primary_conninfo": null,
                "primary_ssh_command": null,
                "recovery_options": "",
                "recovery_staging_path": null,
                "retention_policy": null,
                "retention_policy_mode": "auto",
                "reuse_backup": null,
                "slot_name": "barman",
                "snapshot_disks": null,
                "snapshot_gcp_project": null,
                "snapshot_instance": null,
                "snapshot_provider": null,
                "snapshot_zone": null,
                "ssh_command": null,
                "streaming_archiver": true,
                "streaming_archiver_batch_size": 0,
                "streaming_archiver_name": "barman_receive_wal",
                "streaming_backup_name": "barman_streaming_backup",
                "streaming_conninfo": "host=client0001 user=streaming_barman password=*REDACTED*",
                "streaming_wals_directory": "/var/lib/barman/client0001/streaming",
                "tablespace_bandwidth_limit": null,
                "wal_retention_policy": "main",
                "wals_directory": "/var/lib/barman/client0001/wals"
            },
            "status": {
                "archive_timeout": 0,
                "checkpoint_timeout": 300,
                "config_file": "/var/lib/postgresql/data/postgresql.conf",
                "connection_error": null,
                "current_lsn": "0/3000060",
                "current_size": 24842653.0,
                "current_xlog": "000000010000000000000003",
                "data_checksums": "off",
                "data_directory": "/var/lib/postgresql/data",
                "has_backup_privileges": true,
                "hba_file": "/var/lib/postgresql/data/pg_hba.conf",
                "hot_standby": "on",
                "ident_file": "/var/lib/postgresql/data/pg_ident.conf",
                "is_in_recovery": false,
                "is_superuser": true,
                "max_replication_slots": "10",
                "max_wal_senders": "10",
                "pg_basebackup_bwlimit": true,
                "pg_basebackup_compatible": true,
                "pg_basebackup_installed": true,
                "pg_basebackup_path": "/usr/bin/pg_basebackup",
                "pg_basebackup_tbls_mapping": true,
                "pg_basebackup_version": "15.2",
                "pg_receivexlog_compatible": true,
                "pg_receivexlog_installed": true,
                "pg_receivexlog_path": "/usr/bin/pg_receivewal",
                "pg_receivexlog_supports_slots": true,
                "pg_receivexlog_synchronous": false,
                "pg_receivexlog_version": "15.2",
                "postgres_systemid": "7203508724061519910",
                "replication_slot": [
                    "barman",
                    true,
                    "0/3000000"
                ],
                "replication_slot_support": true,
                "server_txt_version": "12.14",
                "streaming": true,
                "streaming_supported": true,
                "streaming_systemid": "7203508724061519910",
                "synchronous_standby_names": [
                    ""
                ],
                "timeline": 1,
                "version_supported": true,
                "wal_compression": "off",
                "wal_keep_segments": "0",
                "wal_level": "replica",
                "xlog_segment_size": 16777216,
                "xlogpos": "0/3000060"
            },
            "wals": {
                "last_archived_wal_per_timeline": {
                    "00000001": {
                        "compression": "gzip",
                        "name": "000000010000000000000002",
                        "size": 16448,
                        "time": 1677197798.2765784
                    }
                }
            }
        }
    }
}

" barman backup client0001" output (Do not change. It is waiting).
barman@server0001:/code$ barman backup client0001
Starting backup using postgres method for server client0001 in /var/lib/barman/client0001/base/20230224T001955
Backup start at LSN: 0/3000060 (000000010000000000000003, 00000060)
Starting backup copy via pg_basebackup for 20230224T001955

barman.log:
root@server0001:/code# tail -f /var/log/barman/barman.log

2023-02-24 00:18:17,152 [85] barman.command_wrappers DEBUG: Command stderr:
2023-02-24 00:18:17,153 [85] barman.wal_archiver DEBUG: Look for 'barman_receive_wal' in 'synchronous_standby_names': ['']
2023-02-24 00:18:17,153 [85] barman.wal_archiver DEBUG: Synchronous WAL streaming for barman_receive_wal: False
2023-02-24 00:18:17,153 [85] barman.command_wrappers DEBUG: Command: ['/usr/bin/pg_basebackup', '--version']
2023-02-24 00:18:17,172 [85] Command DEBUG: pg_basebackup (PostgreSQL) 15.2 (Debian 15.2-1.pgdg100+1)
2023-02-24 00:18:17,172 [85] barman.command_wrappers DEBUG: Command return code: 0
2023-02-24 00:18:17,172 [85] barman.command_wrappers DEBUG: Command stdout: pg_basebackup (PostgreSQL) 15.2 (Debian 15.2-1.pgdg100+1)

2023-02-24 00:18:17,172 [85] barman.command_wrappers DEBUG: Command stderr:
2023-02-24 00:19:55,100 [110] barman.config DEBUG: Including configuration file: client0001.conf
2023-02-24 00:19:55,100 [110] barman.cli DEBUG: Initialised Barman version 3.4.0 (config: /etc/barman.conf, args: {'color': 'auto', 'quiet': False, 'debug': False, 'format': 'console', 'command': 'backup', 'server_name': ['client0001'], 'reuse_backup': None, 'retry_times': None, 'retry_sleep': None, 'jobs': None, 'wait': False, 'wait_timeout': None, 'backup_name': None, 'func': <function backup at 0x7f0d3bce9bf8>})
2023-02-24 00:19:55,108 [110] barman.backup_executor DEBUG: The default backup strategy for postgres backup_method is: concurrent_backup
2023-02-24 00:19:55,109 [110] barman.server DEBUG: Starting check: 'WAL archive'
2023-02-24 00:19:55,109 [110] barman.server DEBUG: Starting check: 'empty incoming directory'
2023-02-24 00:19:55,109 [110] barman.server DEBUG: Starting check: 'empty streaming directory'
2023-02-24 00:19:55,109 [110] barman.server DEBUG: Starting check: 'PostgreSQL'
2023-02-24 00:19:55,124 [110] barman.command_wrappers DEBUG: Command: ['/usr/bin/pg_receivewal', '--version']
2023-02-24 00:19:55,143 [110] Command DEBUG: pg_receivewal (PostgreSQL) 15.2 (Debian 15.2-1.pgdg100+1)
2023-02-24 00:19:55,143 [110] barman.command_wrappers DEBUG: Command return code: 0
2023-02-24 00:19:55,144 [110] barman.command_wrappers DEBUG: Command stdout: pg_receivewal (PostgreSQL) 15.2 (Debian 15.2-1.pgdg100+1)

2023-02-24 00:19:55,144 [110] barman.command_wrappers DEBUG: Command stderr:
2023-02-24 00:19:55,145 [110] barman.wal_archiver DEBUG: Look for 'barman_receive_wal' in 'synchronous_standby_names': ['']
2023-02-24 00:19:55,145 [110] barman.wal_archiver DEBUG: Synchronous WAL streaming for barman_receive_wal: False
2023-02-24 00:19:55,145 [110] barman.command_wrappers DEBUG: Command: ['/usr/bin/pg_basebackup', '--version']
2023-02-24 00:19:55,163 [110] Command DEBUG: pg_basebackup (PostgreSQL) 15.2 (Debian 15.2-1.pgdg100+1)
2023-02-24 00:19:55,164 [110] barman.command_wrappers DEBUG: Command return code: 0
2023-02-24 00:19:55,164 [110] barman.command_wrappers DEBUG: Command stdout: pg_basebackup (PostgreSQL) 15.2 (Debian 15.2-1.pgdg100+1)

2023-02-24 00:19:55,164 [110] barman.command_wrappers DEBUG: Command stderr:
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Check 'PostgreSQL' succeeded for server 'client0001'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Starting check: 'superuser or standard user with backup privileges'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Check 'superuser or standard user with backup privileges' succeeded for server 'client0001'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Starting check: 'PostgreSQL streaming'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Check 'PostgreSQL streaming' succeeded for server 'client0001'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Starting check: 'wal_level'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Check 'wal_level' succeeded for server 'client0001'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Starting check: 'replication slot'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Check 'replication slot' succeeded for server 'client0001'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Starting check: 'directories'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Check 'directories' succeeded for server 'client0001'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Starting check: 'retention policy settings'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Check 'retention policy settings' succeeded for server 'client0001'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Starting check: 'backup maximum age'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Check 'backup maximum age' succeeded for server 'client0001'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Starting check: 'backup minimum size'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Check 'backup minimum size' succeeded for server 'client0001'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Starting check: 'wal maximum age'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Check 'wal maximum age' succeeded for server 'client0001'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Starting check: 'wal size'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Check 'wal size' succeeded for server 'client0001'
2023-02-24 00:19:55,164 [110] barman.server DEBUG: Starting check: 'compression settings'
2023-02-24 00:19:55,165 [110] barman.server DEBUG: Check 'compression settings' succeeded for server 'client0001'
2023-02-24 00:19:55,165 [110] barman.server DEBUG: Starting check: 'failed backups'
2023-02-24 00:19:55,165 [110] barman.server DEBUG: Check 'failed backups' succeeded for server 'client0001'
2023-02-24 00:19:55,165 [110] barman.server DEBUG: Starting check: 'minimum redundancy requirements'
2023-02-24 00:19:55,165 [110] barman.server DEBUG: Check 'minimum redundancy requirements' succeeded for server 'client0001'
2023-02-24 00:19:55,165 [110] barman.server DEBUG: Starting check: 'pg_basebackup'
2023-02-24 00:19:55,165 [110] barman.server DEBUG: Check 'pg_basebackup' succeeded for server 'client0001'
2023-02-24 00:19:55,165 [110] barman.server DEBUG: Starting check: 'pg_basebackup compatible'
2023-02-24 00:19:55,165 [110] barman.server DEBUG: Check 'pg_basebackup compatible' succeeded for server 'client0001'
2023-02-24 00:19:55,165 [110] barman.server DEBUG: Starting check: 'pg_basebackup supports tablespaces mapping'
2023-02-24 00:19:55,166 [110] barman.server DEBUG: Check 'pg_basebackup supports tablespaces mapping' succeeded for server 'client0001'
2023-02-24 00:19:55,166 [110] barman.server DEBUG: Starting check: 'configuration'
2023-02-24 00:19:55,166 [110] barman.server DEBUG: Starting check: 'systemid coherence'
2023-02-24 00:19:55,166 [110] barman.server DEBUG: Check 'systemid coherence' succeeded for server 'client0001'
2023-02-24 00:19:55,166 [110] barman.server DEBUG: Starting check: 'pg_receivexlog'
2023-02-24 00:19:55,166 [110] barman.server DEBUG: Check 'pg_receivexlog' succeeded for server 'client0001'
2023-02-24 00:19:55,166 [110] barman.server DEBUG: Starting check: 'pg_receivexlog compatible'
2023-02-24 00:19:55,166 [110] barman.server DEBUG: Check 'pg_receivexlog compatible' succeeded for server 'client0001'
2023-02-24 00:19:55,166 [110] barman.server DEBUG: Starting check: 'receive-wal running'
2023-02-24 00:19:55,166 [110] barman.server DEBUG: Check 'receive-wal running' succeeded for server 'client0001'
2023-02-24 00:19:55,166 [110] barman.server DEBUG: Starting check: 'archiver errors'
2023-02-24 00:19:55,166 [110] barman.server DEBUG: Check 'archiver errors' succeeded for server 'client0001'
2023-02-24 00:19:55,167 [110] barman.backup DEBUG: initialising backup information
2023-02-24 00:19:55,206 [110] barman.backup INFO: Starting backup using postgres method for server client0001 in /var/lib/barman/client0001/base/20230224T001955
2023-02-24 00:19:55,207 [110] barman.backup_executor DEBUG: detecting data directory
2023-02-24 00:19:55,209 [110] barman.backup_executor DEBUG: detecting tablespaces
2023-02-24 00:19:55,209 [110] barman.backup_executor DEBUG: issuing start backup command
2023-02-24 00:19:55,212 [110] barman.backup_executor INFO: Backup start at LSN: 0/3000060 (000000010000000000000003, 00000060)
2023-02-24 00:19:55,212 [110] barman.backup_executor INFO: Starting backup copy via pg_basebackup for 20230224T001955
2023-02-24 00:19:55,213 [110] barman.command_wrappers DEBUG: Command: ['/usr/bin/pg_basebackup', '--dbname=dbname=replication host=client0001 options=-cdatestyle=iso password=123456 replication=true user=streaming_barman application_name=barman_streaming_backup', '-v', '--no-password', '--pgdata=/var/lib/barman/client0001/base/20230224T001955/data', '--no-slot', '--wal-method=none']
2023-02-24 00:19:55,237 [110] barman.backup_executor INFO: pg_basebackup: initiating base backup, waiting for checkpoint to complete
2023-02-24 00:19:55,277 [70] barman.command_wrappers INFO: client0001: pg_receivewal: finished segment at 0/4000000 (timeline 1)
2023-02-24 00:19:55,286 [110] barman.backup_executor INFO: pg_basebackup: checkpoint completed
2023-02-24 00:19:55,339 [70] barman.command_wrappers INFO: client0001: pg_receivewal: finished segment at 0/5000000 (timeline 1)
2023-02-24 00:20:01,330 [110] barman.backup_executor INFO: NOTICE:  base backup done, waiting for required WAL segments to be archived
2023-02-24 00:20:55,236 [110] barman.backup_executor INFO: WARNING:  still waiting for all required WAL segments to be archived (60 seconds elapsed)
2023-02-24 00:20:55,236 [110] barman.backup_executor INFO: HINT:  Check that your archive_command is executing properly.  You can safely cancel this backup, but the database backup will not be usable without all the WAL segments.
2023-02-24 00:21:55,302 [110] barman.backup_executor INFO: WARNING:  still waiting for all required WAL segments to be archived (120 seconds elapsed)
2023-02-24 00:21:55,303 [110] barman.backup_executor INFO: HINT:  Check that your archive_command is executing properly.  You can safely cancel this backup, but the database backup will not be usable without all the WAL segments.

Mike Wallace

unread,
Feb 24, 2023, 4:48:22 AM2/24/23
to pgba...@googlegroups.com
Hi,

The following two lines in the log are telling us that Barman pg_basebackup is waiting for PostgreSQL to execute its archive_command:

2023-02-24 00:21:55,302 [110] barman.backup_executor INFO: WARNING:  still waiting for all required WAL segments to be archived (120 seconds elapsed)
2023-02-24 00:21:55,303 [110] barman.backup_executor INFO: HINT:  Check that your archive_command is executing properly.  You can safely cancel this backup, but the database backup will not be usable without all the WAL segments.

Although you have WAL streaming configured for Barman, if PostgreSQL has a command configured for `archive_command` then it will not complete a backup until that command has executed successfully for all WALs required by the backup.

Check your PostgreSQL server logs for any errors relating to the execution of archive_command and that should provide some clues as to what could be going wrong.

Hope this helps,

Mike


--
--
You received this message because you are subscribed to the "Barman for PostgreSQL" group.
To post to this group, send email to pgba...@googlegroups.com
To unsubscribe from this group, send email to
pgbarman+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/pgbarman?hl=en?hl=en-GB

---
You received this message because you are subscribed to the Google Groups "Barman, Backup and Recovery Manager for PostgreSQL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pgbarman+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pgbarman/0c186d81-6ba0-463d-bef5-75f96fa976c2n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages