barman icon indicating copy to clipboard operation
barman copied to clipboard

missing data files in S3 when running barman-cloud-backup against same dbserver/database from different locations

Open pguser4ever opened this issue 3 years ago • 3 comments

Hello About barman-cloud-backup (version 2.13) Have a problem i can't really understand, maybe i missed something? please notify me in that case

When we do a backup (with barman-cloud-backup) from dbserver for a database called whdb to Aws S3, it works and can be used for restore great! Command on local db server: barman-cloud-backup -e AES256 -j --immediate-checkpoint -v -h mydbservername -d whdb -p 50047 -J 4 s3://barman-s3-backup/ whdb

(we still get problems with recovery of transactions when the files are zipped but understand you working on that for 2.14 "Barman cloud WAL restore exception: coercing to Unicode: need string or buffer, StreamingBody found" )

When we try to do a backup of the same database whdb at the same server but from our barman backup server
when backup finished some data files are missing in Aws S3? Command: from barman backup server against same database
barman-cloud-backup -e AES256 -j --immediate-checkpoint -v -h mydbservername -d whdb -p 50047 -J 4 s3://barman-s3-backup/ whdb

tried several times with same result, watch the appended log missing_data_20210817.txt

pguser4ever avatar Aug 17 '21 11:08 pguser4ever

@pguser4ever barman-cloud-backup needs to run directly on the PostgreSQL server as it needs access to the filesystem so it can stream the files - that's why the same command works when running on the DB server and fails when running on the barman server.

If you want to upload a backup from the barman server to S3 then you can use barman-cloud-backup as a post-backup hook script - when running as a hook script barman-cloud-backup will use the local barman configuration to find the backup files rather than trying to find them using their location on the PostgreSQL server. There is more general information about barman hook scripts here.

That said, the failure mode in your logs is still concerning as barman-cloud-backup appears to be failing silently when trying to upload the tablespaces. I reproduced a similar scenario by creating a minimal PostgreSQL install on a test barman server but not creating the tablespaces directories - the log output is quite similar to the one you posted, where we can see for example: 2021-08-17 16:06:24,197 [748] INFO: Uploading 'tbs1' directory '/tbs_tbs1_12_test1' as '16385.tar.bz2' - however in S3 the only files are data.tar.bz2 and backup.info: barman-cloud-no-tablespaces.txt. There are no errors in the logs and the exit status was 0.

So I think there's some work to do for 2.14 in improving how barman-cloud-backup handles this particular case.

mikewallace1979 avatar Aug 17 '21 16:08 mikewallace1979

Great! thanks

pguser4ever avatar Aug 17 '21 17:08 pguser4ever

It works great as a post_backup_retry_script
perfect! have been running several testcases and with -> post_backup_retry_script= 'barman-cloud-backup
and -> pre_archive_retry_script='barman-cloud-wal-archive (uncompressed wal) and -> restore conf (restore_command = 'barman-cloud-wal-restore s3://barman-s3-backup DBname %f %p' ) and -> barman-cloud-restore -v --cloud-provider aws-s3 s3://barman-s3-backup DBname backupID /pg/pgcluster/DBname /data we have a nice working solution, very helpful info thank you

pguser4ever avatar Aug 20 '21 10:08 pguser4ever