backup error: permission denied

727 views
Skip to first unread message

David

unread,
May 21, 2015, 3:37:27 PM5/21/15
to pgba...@googlegroups.com
Please help me diagnose the problem here.  

I setup barman 1.4.1 to backup postgres 9.2 locally on a RHEL server.

After executing the "barman backup" command, I get the following error in the barman.log file:

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/barman/cli.py", line 601, in main
    p.dispatch(pre_call=global_config)
  File "/usr/lib/python2.6/site-packages/argh/helpers.py", line 53, in dispatch
    return dispatch(self, *args, **kwargs)
  File "/usr/lib/python2.6/site-packages/argh/dispatching.py", line 123, in dispatch
    for line in lines:
  File "/usr/lib/python2.6/site-packages/argh/dispatching.py", line 199, in _execute_command
    for line in result:
  File "/usr/lib/python2.6/site-packages/argh/dispatching.py", line 155, in _call
    result = args.function(args)
  File "/usr/lib/python2.6/site-packages/barman/cli.py", line 169, in backup
    server.backup()
  File "/usr/lib/python2.6/site-packages/barman/server.py", line 865, in backup
    self.cron(verbose=False, retention_policies=False)
  File "/usr/lib/python2.6/site-packages/barman/server.py", line 1133, in cron
    self.backup_manager.cron(verbose=verbose)
  File "/usr/lib/python2.6/site-packages/barman/backup.py", line 778, in cron
    self.cron_wal_archival(compressor, wal_info)
  File "/usr/lib/python2.6/site-packages/barman/backup.py", line 1304, in cron_wal_archival
    compressor.compress(srcfile, destfile)
  File "/usr/lib/python2.6/site-packages/barman/command_wrappers.py", line 95, in __call__
    self.getoutput(*args, **kwargs)
  File "/usr/lib/python2.6/site-packages/barman/command_wrappers.py", line 135, in getoutput
    ret=self.ret, out=self.out, err=self.err))
CommandFailedException: {'err': u'/bin/sh: /sso/data/postgres/backup/barman/vacld06au/incoming/0000000100000007000000C8: Permission denied\n', 'ret': 1, 'out': u
''}

David

unread,
May 21, 2015, 4:05:59 PM5/21/15
to pgba...@googlegroups.com
Here is the output of "barman diagnose", in case that helps.

{
    "global": {
        "config": {
            "barman_home": "/sso/data/postgres/backup/barman",
            "barman_user": "barman",
            "compression": "gzip",
            "last_backup_maximum_age": "2 DAYS",
            "log_file": "/var/log/barman/barman.log",
            "minimum_redundancy": "2",
            "retention_policy": "RECOVERY WINDOW OF 7 DAYS"
        },
        "system_info": {
            "barman_ver": "1.4.1",
            "kernel_ver": "Linux vacld06au 2.6.32-504.8.1.el6.x86_64 #1 SMP Fri Dec 19 12:09:25 EST 2014 x86_64 x86_64 x86_64 GNU/Linux",
            "python_ver": "Python 2.6.6",
            "release": "LSB Version:\t:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch\nDistributor ID:\tRedHatEnterpriseServer\nDescription:\tRed Hat Enterprise Linux Server release 6.6 (Santiago)\nRelease:\t6.6\nCodename:\tSantiago",
            "rsync_ver": "rsync  version 3.0.6  protocol version 30",
            "ssh_ver": "OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013"
        }
    },
    "servers": {
        "vacld06au": {
            "backups": {
                "20150521T145952": {
                    "backup_id": "20150521T145952",
                    "backup_label": "None",
                    "begin_offset": "32",
                    "begin_time": "Thu May 21 14:59:52 2015",
                    "begin_wal": "0000000100000007000000C6",
                    "begin_xlog": "7/C6000020",
                    "config_file": "/sso/data/postgres/data/9.2AS/data/postgresql.conf",
                    "deduplicated_size": 42859634,
                    "end_offset": "168",
                    "end_time": "Thu May 21 14:59:58 2015",
                    "end_wal": "0000000100000007000000C6",
                    "end_xlog": "7/C60000A8",
                    "error": null,
                    "hba_file": "/sso/data/postgres/data/9.2AS/data/pg_hba.conf",
                    "ident_file": "/sso/data/postgres/data/9.2AS/data/pg_ident.conf",
                    "mode": "default",
                    "pgdata": "/sso/data/postgres/data/9.2AS/data",
                    "server_name": "vacld06au",
                    "size": 42859634,
                    "status": "DONE",
                    "tablespaces": null,
                    "timeline": 1,
                    "version": 90201
                },
                "20150521T152909": {
                    "backup_id": "20150521T152909",
                    "backup_label": "None",
                    "begin_offset": "32",
                    "begin_time": "Thu May 21 15:29:09 2015",
                    "begin_wal": "0000000100000007000000CF",
                    "begin_xlog": "7/CF000020",
                    "config_file": "/sso/data/postgres/data/9.2AS/data/postgresql.conf",
                    "deduplicated_size": 42966150,
                    "end_offset": "168",
                    "end_time": "Thu May 21 15:29:13 2015",
                    "end_wal": "0000000100000007000000CF",
                    "end_xlog": "7/CF0000A8",
                    "error": null,
                    "hba_file": "/sso/data/postgres/data/9.2AS/data/pg_hba.conf",
                    "ident_file": "/sso/data/postgres/data/9.2AS/data/pg_ident.conf",
                    "mode": "default",
                    "pgdata": "/sso/data/postgres/data/9.2AS/data",
                    "server_name": "vacld06au",
                    "size": 42966150,
                    "status": "DONE",
                    "tablespaces": null,
                    "timeline": 1,
                    "version": 90201
                }
            },
            "config": {
                "active": true,
                "backup_directory": "/sso/data/postgres/backup/barman/vacld06au",
                "backup_options": "exclusive_backup",
                "bandwidth_limit": null,
                "barman_home": "/sso/data/postgres/backup/barman",
                "basebackup_retry_sleep": 30,
                "basebackup_retry_times": 0,
                "basebackups_directory": "/sso/data/postgres/backup/barman/vacld06au/base",
                "compression": "gzip",
                "conninfo": "host=vacld06au.mydomain.com port=5454 user=postgres",
                "custom_compression_filter": null,
                "custom_decompression_filter": null,
                "description": "TEST PostgreSQL Database",
                "immediate_checkpoint": false,
                "incoming_wals_directory": "/sso/data/postgres/backup/barman/vacld06au/incoming",
                "last_backup_maximum_age": "2 days",
                "lock_file": "/sso/data/postgres/backup/barman/vacld06au/vacld06au.lock",
                "minimum_redundancy": 2,
                "name": "vacld06au",
                "network_compression": false,
                "post_archive_script": null,
                "post_backup_script": null,
                "pre_archive_script": null,
                "pre_backup_script": null,
                "retention_policy": "window 4 w",
                "retention_policy_mode": "auto",
                "reuse_backup": null,
                "ssh_command": "ssh post...@vacld06au.mydomain.com",
                "tablespace_bandwidth_limit": null,
                "wal_retention_policy": "simple-wal 4 w",
                "wals_directory": "/sso/data/postgres/backup/barman/vacld06au/wals"
            },
            "status": {
                "archive_command": "cp %p /sso/data/postgres/backup/archived_xlog/%f",
                "archive_mode": "on",
                "config_file": "/sso/data/postgres/data/9.2AS/data/postgresql.conf",
                "current_xlog": "0000000100000007000000D0",
                "data_directory": "/sso/data/postgres/data/9.2AS/data",
                "hba_file": "/sso/data/postgres/data/9.2AS/data/pg_hba.conf",
                "ident_file": "/sso/data/postgres/data/9.2AS/data/pg_ident.conf",
                "last_archived_wal": "0000000100000007000000CF.00000020.backup",
                "pgespresso_installed": false,
                "server_txt_version": "9.2.1.3"
            },
            "system_info": {
                "kernel_ver": "Linux vacld06au 2.6.32-504.8.1.el6.x86_64 #1 SMP Fri Dec 19 12:09:25 EST 2014 x86_64 x86_64 x86_64 GNU/Linux",
                "python_ver": "Python 2.6.6",
                "release": "LSB Version:\t:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch\nDistributor ID:\tRedHatEnterpriseServer\nDescription:\tRed Hat Enterprise Linux Server release 6.6 (Santiago)\nRelease:\t6.6\nCodename:\tSantiago",
                "rsync_ver": "rsync  version 3.0.6  protocol version 30",
                "ssh_ver": "OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013"
            }
        }
    }
}

Gabriele Bartolini

unread,
Jun 3, 2015, 4:10:05 AM6/3/15
to pgba...@googlegroups.com
Hi David,

  It is a permission issue. How come the archive_command does not ship WAL files inside the incoming directory of Barman, rather locally copies WAL files using cp?

  Can you please explain the architecture you have implemented for this Postgres server?

Thanks,
Gabriele

--
 Gabriele Bartolini - 2ndQuadrant Italia - Managing Director
 PostgreSQL Training, Services and Support
 gabriele....@2ndQuadrant.it | www.2ndQuadrant.it

--
--
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.
For more options, visit https://groups.google.com/d/optout.

David Wagoner

unread,
Jun 9, 2015, 4:03:17 PM6/9/15
to pgba...@googlegroups.com
Gabriele,

The reason that the archive_command does not ship archived WAL files to the barman incoming directory is that this server uses an NFS mount to a ZFS disk appliance to store large backups.  The ZFS is intended for backups only and not archive logs, so I was attempting to split the backups and archive logs, with the archive logs going to locally mounted SAN LUNs.  In retrospect, I believe barman may not support this arrangement - correct?

Ideally for this setup, barman would allow the archive log path to be different than the backup path.  I've used other postgres backup utilities that support this, like pitrery, but I prefer to use barman.  If barman cannot support this split (at least not yet), then would you advise configuring my archive_command to copy archive logs to multiple locations (one local disk and one ZFS) to allow barman to function but ensure I have archive logs if the ZFS is unreachable for a period of time?  Or perhaps use an archive log utility like WAL-E?

Thank you,

David

Joseph Kregloh

unread,
Jun 9, 2015, 4:13:03 PM6/9/15
to pgba...@googlegroups.com
Best solution for you is to create a script to ship the logs. This works very well and when written correctly it will help prevent data loss. Create a simple bash script that will rsync the logs to both the locations you want. Can be local filesystems or a different server. The beauty of this is that you can make it return false whenever any of those internal rsync or cp commands fail, this will tell PostgreSQL to hold the WAL file and not delete it. So in case you need to restart the slave it will start shipping WAL files that were not shipped when the slave was down.

-Joseph Kregloh
Reply all
Reply to author
Forward
0 new messages