Percona postgresql | Backup and Restore |

I am using to deploy postgres via Helm charts(v1.4.0) I am Having two issues

  1. I’m not able to take a backup as per the schedule daily wise my backrest-job is not running as well,how to debug the issue
  2. I’m not able to restore my backup also,how to take the backup and restore from s3 bucket,my backrest job is not running exactly what I expect.

Above Image showing the repository may run out of space,But sure its not a issue in space because i have a space of 98%

@Edith_Puclla1 @Sergey_Pronin

1 Like

Hi,

It’s better if you post those outputs into text format, since they seem to be trimmed.

We have a tool that will collect logs and other outputs that you may want to check:

Did you already check the online documentation on it? You can check it here:

And in particular for S3, in this section:

1 Like

Yes,I already checked the Documentation of postgres (backup &restore)
That’s CronJob is not working as per the schedule.

2023-07-03 05:33:43,098 INFO: no action. I am (pgdb-pg-db-repl2-5ff574665b-hfzc8), a secondary, and following a leader (pgdb-pg-db-7f78f9dfd8-qqw8t)



NWRAP_ERROR(1) - nwrap_files_cache_reload: Unable to open '/tmp/nss_wrapper/pgbackrest-repo/passwd' readonly -1:No such file or directory
NWRAP_ERROR(1) - nwrap_files_getpwuid: Error loading passwd file
nss_wrapper: user exists
nss_wrapper: group exists
nss_wrapper: environment configured
Starting the pgBackRest repo
nss_wrapper: ssh configured
creating  /backrestrepo/pgdb-pg-db-backrest-shared-repo
The pgBackRest repo has been started
WARNING: 'UsePAM no' is not supported in Fedora and may cause several problems.
nss_wrapper: user exists
nss_wrapper: group exists
nss_wrapper: environment configured
Fri Jun 30 07:46:56 UTC 2023 INFO: Image mode found: pgbackrest
Fri Jun 30 07:46:56 UTC 2023 INFO: Starting in 'pgbackrest' mode
time="2023-06-30T07:46:56Z" level=info msg="crunchy-pgbackrest starts"
time="2023-06-30T07:46:56Z" level=info msg="debug flag set to false"
time="2023-06-30T07:46:56Z" level=info msg="backrest backup command requested"
time="2023-06-30T07:46:56Z" level=info msg="backrest command will be executed for both local and s3 storage"
time="2023-06-30T07:46:56Z" level=info msg="command to execute is [pgbackrest backup --type=full --db-host=10.4.1.137 --db-path=/pgdata/pgdb-pg-db ; pgbackrest backup --type=full --db-host=10.4.1.137 --db-path=/pgdata/pgdb-pg-db --repo1-type=s3 --no-repo1-s3-verify-tls]"
time="2023-06-30T07:48:12Z" level=info msg="output=[]"
time="2023-06-30T07:48:12Z" level=info msg="stderr=[WARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space\n      HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.\nWARN: option 'repo1-retention-full' is not set for 'repo1-retention-full-type=count', the repository may run out of space\n      HINT: to retain full backups indefinitely (without warning), set option 'repo1-retention-full' to the maximum.\n]"
time="2023-06-30T07:48:12Z" level=info msg="crunchy-pgbackrest ends"

I could not make scheduling work also. If you run as job you should add

backrest-opts: --type=full --repo1-retention-full=20

that is why you get that warning.

# backup type can be:
# Differential: Create a backup of everything since the last full backup was taken
# --type=diff
# Full: Back up the entire database
# --type=full
# Incremental: Back up everything since the last backup was taken, whether it was full, differential, or incremental
# --type=incr
# backup retention can be:
# --repo1-retention-full=2 how many full backups to retain
# --repo1-retention-diff=4 how many differential backups to retain
# --repo1-retention-archive=6 how many sets of WAL archives to retain alongside
# the full and differential backups that are retained

Since the job Not yet trigger,Can u please Give me the complete inputs here.

apiVersion: pg.percona.com/v1
kind: Pgtask
metadata:
  labels:
    pg-cluster: pg-db
    pgouser: admin
  name: pg-db-backrest-full-backup
spec:
  name: pg-db-backrest-full-backup
  parameters:
    backrest-command: backup
# backup type can be:
# Differential: Create a backup of everything since the last full backup was taken
# --type=diff
# Full: Back up the entire database
# --type=full
# Incremental: Back up everything since the last backup was taken, whether it was full, differential, or incremental
# --type=incr
# backup retention can be:
# --repo1-retention-full=2 how many full backups to retain
# --repo1-retention-diff=4 how many differential backups to retain
# --repo1-retention-archive=6 how many sets of WAL archives to retain alongside
# the full and differential backups that are retained
    backrest-opts: --type=full --repo1-retention-full=20
    backrest-s3-verify-tls: "false"
    backrest-storage-type: "s3"
    job-name: pg-db-backrest-full-backup
    pg-cluster: pg-db
  tasktype: backrest

@Slavisa_Milojkovic I’m already Try this one this is not working exactly,any other suggestion??

Please give us more info on what is wrong with your setup? Your backup logs are showing the backup was done, do you have files in s3 bucket?
Warning about disk space is not important and will go away if you add args --type=full --repo1-retention-full=20 to the backup job.
You can save my previous post code to backup.yml and deploy it to kubernetes (adjust the parameters)

kubectl apply -f backup.yml