Unable to restore db backup on local machine
I am using CNPG 1.26 with Barman Plugin 0.11.0 on ak8s.
I taken the backup of one of DB cluster on azure blob storage.
I am able to restore db backup on same ak8s cluster .
Is there any way to restore that backup on local machine by downloading that backupfiles from blob storage.
And if possible which file required only backup.info and base folder files that is zip file or wal files also required?
@dosu please help
Yes, you can restore a Barman Cloud backup on a local machine using the Barman CLI tools directly. Here's what you need:
Required Files:
- Base backup (tarball in the
base/folder) — required - WAL files (in the
wals/folder) — required, even for a full restore without PITR. There is no supported way to restore from a base backup alone - backup.info — contains metadata (BackupID, WAL ranges, LSN info)
Local Restoration Steps:
-
Install Barman CLI tools and ensure you have Azure credentials configured
-
List available backups:
barman-cloud-backup-list --cloud-provider azure-blob-storage \ https://<storage-account>.blob.core.windows.net/<container> <server-name> -
Restore the base backup:
barman-cloud-restore --cloud-provider azure-blob-storage \ https://<storage-account>.blob.core.windows.net/<container> \ <server-name> <backup-id> /path/to/pgdata -
Configure WAL recovery — create
recovery.signaland add topostgresql.conf:restore_command = 'barman-cloud-wal-restore --cloud-provider azure-blob-storage https://<storage-account>.blob.core.windows.net/<container> <server-name> %f %p' recovery_target_action = promote -
Start PostgreSQL — it will replay WALs and promote automatically
You can also use the CNPG PostgreSQL container image which has the Barman tools pre-installed:
docker run --rm -it -v $(pwd)/credentials:/var/lib/postgresql/.azure/credentials \
ghcr.io/cloudnative-pg/postgresql:18.0 bash
Note: Local restoration outside Kubernetes is not officially supported but is technically possible using these standard Barman tools.
To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.
I don’t have credentials or access to direct blob storage . I will get the downloaded all files base as well as wal files. So can we restore it on local
@dosu
Yes, you can restore locally from downloaded files, but you'll need to do it manually using standard PostgreSQL recovery — not through the Barman Cloud tools (which expect object storage access).
Manual Restore Process:
-
Extract the base backup tarball to a local directory (this will be your PGDATA):
mkdir /path/to/pgdata tar -xvf base/<backup-tarball>.tar -C /path/to/pgdata -
Create a WAL archive directory and copy all your downloaded WAL files there:
mkdir /path/to/wal_archive cp /downloaded/wals/* /path/to/wal_archive/ -
Configure PostgreSQL for recovery — create a
recovery.signalfile in PGDATA and add topostgresql.conf:restore_command = 'cp /path/to/wal_archive/%f %p' recovery_target_action = promote -
Fix permissions (PostgreSQL requires specific ownership):
chown -R postgres:postgres /path/to/pgdata chmod 700 /path/to/pgdata -
Start PostgreSQL:
pg_ctl -D /path/to/pgdata start
PostgreSQL will replay the WAL files and then promote itself to a primary.
Important: Make sure you have all necessary WAL files — PostgreSQL recovery will fail if any required WAL segment is missing. The backup needs WALs from BeginWal to EndWal at minimum for a consistent restore.
This is a standard PostgreSQL restore procedure and works independently of CloudNativePG/Barman.
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
@dosu, I downloaded manually wals and base backup zip file. Extracted it and done some changes in postgres.config and custom.config as i am using windows not linux os. My backup restored successfully. I can connect to that server using superuser and app user as well with respective password.
But when i edit pg_hba.config And done some changes such as host all all 127.0.0.1/32 trust then i am able to connect to server even without password. How ? If i can connect to db server even without password just by small line change in phg_hba.config then it is not secure.
Great to hear your restore worked!
The behavior you're seeing is expected and by design in PostgreSQL — it's not a security flaw, but rather how PostgreSQL's authentication system works.
Why this happens:
pg_hba.conf is PostgreSQL's Host-Based Authentication file. When you set trust as the authentication method:
host all all 127.0.0.1/32 trust
You're explicitly telling PostgreSQL: "Trust anyone connecting from 127.0.0.1 — don't require a password." This is intentional behavior.
Why it's still secure in practice:
-
File system access = full control — If someone can edit
pg_hba.conf, they already have OS-level access to your server. At that point, they could also access the data files directly, so password authentication wouldn't stop them anyway. -
In Kubernetes/production,
pg_hba.confis managed by the operator and users don't have direct file system access to the pods. -
The real security boundary is protecting access to the server/container itself, not the config files inside it.
For your local setup, if you want password authentication, use:
host all all 127.0.0.1/32 scram-sha-256
or
host all all 127.0.0.1/32 md5
This is standard PostgreSQL behavior — CloudNativePG/Barman doesn't change this. The security model assumes whoever controls the config files controls the database.
To reply, just mention @dosu.
Share context across your team and agents. Try Dosu.