postgresql_cluster
postgresql_cluster copied to clipboard
Wal-g backup and restore command doenst work Ubuntu 22.04 due syntax issue
It is not clear why it doesnt work. Problem seems like here '%{http_code}'
. I see that it marked was tested in Ubuntu 22.04.
Was wal-g also tested?
https://github.com/vitabaks/postgresql_cluster/blob/f59badf3513b3b7eac2ec4edfa11ff1ef72ac4ed/vars/main.yml#L483-L488
Tried with :
/bin/bash
/bin/sh
No reason, same issue.
syslog output CMD (sh -c 'curl -o /dev/null -s -w ")
Hi @garry-t
I will be grateful for PR if there is a mistake here and you manage to solve it.
I usually use pgbackrest and a simple check, for example:
if [ $(psql -tAXc 'select pg_is_in_recovery()') = 'f' ]; then pgbackrest --type=full --stanza={{ pgbackrest_stanza }} backup; fi
please attach the cron job file located in /etc/cron.d/walg
Ok, understood.
cat /etc/cron.d/walg
#Ansible: WAL-G: Create daily backup
30 3 * * * postgres [ $(curl -s -o /dev/null -w '%{http_code}' http://IP:8008) = '200' ] && wal-g --config /var/lib/postgresql/.walg.json backup-push /var/lib/postgresql/15/main > /var/log/postgresql/walg_backup.log 2>&1
#Ansible: WAL-G: Delete old backups
30 6 * * * postgres [ $(curl -s -o /dev/null -w '%{http_code}' http://IP:8008) = '200' ] && wal-g --config /var/lib/postgresql/.walg.json delete retain FULL 4 --confirm > /var/log/postgresql/walg_delete.log 2>&1
So I'll think how to solve it.