postgres-operator icon indicating copy to clipboard operation
postgres-operator copied to clipboard

how to initiate a pgbackrest stanza-create?

Open mzwettler2 opened this issue 1 year ago • 10 comments

we are using s3 storage.

we have to change the whole s3 bucket and repo1-path for some reasons sometimes.

how can we get PGO to initiate a pgbackrest stanza-create if it does not find an existing repo?

it seems that PGO only triggers a pgbackrest stanza-create if there is a completely new configured pgbackrest.repo definition.

mzwettler2 avatar Aug 23 '23 09:08 mzwettler2

Hi @mzwettler2

Sorry you are running into issues. Would you be able to provide me with your manifest and steps? I did some simple testing where I changed buckets and I'm not seeing the same issue.

ValClarkson avatar Aug 29 '23 16:08 ValClarkson

Hi @ValClarkson

Sorry for being unclear.

When I change (reconfigure) the whole s3 bucket to a new one it works.

If I only change (reconfgure) the repo1-path within the same s3 bucket to a new path it does not work ==>> ERROR: [103]: unable to find a valid repository

Thanks

mzwettler2 avatar Aug 30 '23 08:08 mzwettler2

i changed repo1-path too, and then i got the following error when running scheduled backup,

time="2023-09-24T15:35:12Z" level=info msg="stderr=[ERROR: [055]: unable to load info file '/pgbackrest/kubernetes/awx/backup/db/backup.info' or '/pgbackrest/kubernetes/awx/backup/db/backup.info.copy':\n       FileMissingError: unable to open missing file '/pgbackrest/kubernetes/awx/backup/db/backup.info' for read\n       FileMissingError: unable to open missing file '/pgbackrest/kubernetes/awx/backup/db/backup.info.copy' for read\n       HINT: backup.info cannot be opened and is required to perform a backup.\n       HINT: has a stanza-create been performed?\n]"
time="2023-09-24T15:35:12Z" level=fatal msg="command terminated with exit code 55"

maksonlee avatar Sep 24 '23 15:09 maksonlee

Sorry for the delay on this.

I would think that if you are changing the path in the bucket you would want to set it up as a new repo. But the repo-path configuration isn't in the repo-host definition :thinking:

@mzwettler2 How are you updating the repo path? Would you be able to provide a before and after spec where you are changing it?

jmckulk avatar Nov 30 '23 16:11 jmckulk

I define my S3 backup location using these CRDs:

PostgresCluster.spec.backups.pgbackrest.repos[index].s3

  • bucket
  • endpoint
  • region

PostgresCluster.spec.backups.pgbackrest

  • global.repo[index]-path

If I change the repo-path afterwards, the backup terminates incorrectly. I would have to do a stanza-create first - but that is not possible at the moment.

pgo currently only does a stanza-create when you define a new repo or a new bucket. pgo should also do a stanza-create when the repo-path is changed. At the very least, however, there should be the option of triggering the execution of a new stanza-create with an annotation, for example.

mzwettler2 avatar Nov 30 '23 16:11 mzwettler2

I would need an option to trigger the execution of a new stanza-create.

Anything planned?

mzwettler2 avatar Jan 29 '24 09:01 mzwettler2

Hi @mzwettler2. Thank you for the additional information. Just to verify what you are suggesting, you are effectively just looking for an imperative way to trigger a stanza-create using the configuration already set on the PostgresCluster spec? Have you tried exec-ing into your Pod and running the stanza create command directly? I'm curious if that method solved your described scenario.

tjmoore4 avatar Feb 06 '24 19:02 tjmoore4

@tjmoore4

you are effectively just looking for an imperative way to trigger a stanza-create using the configuration already set on the PostgresCluster spec?

Yes.

Have you tried exec-ing into your Pod and running the stanza create command directly?

Yes, that should work. The problem is that you would have to find out a lot of specific parameter values beforehand in order to be able to carry out the stanza-create suitable for PGO. this is not practicable for our customers.

mzwettler2 avatar Feb 07 '24 08:02 mzwettler2

@mzwettler2 Understood. I can get something in our backlog for evaluation. In the meantime, I am curious if a command like

kubectl exec -it -n postgres-operator -c database $(kubectl get pods -n postgres-operator --selector='postgres-operator.crunchydata.com/cluster=hippo,postgres-operator.crunchydata.com/role=master' -o name) -- pgbackrest stanza-create --stanza=db

might be useful for this case. This assumes a cluster name of hippo and a namespace named postgres-operator but is otherwise fairly standard in terms of labels and values for lookup.

tjmoore4 avatar Feb 07 '24 19:02 tjmoore4

@tjmoore4

Thanks for adding something to your backlog. Sorry for beeing unclear. Our customers are not allowed to use kubectl. They must trigger such an action by an annotation.

mzwettler2 avatar Feb 08 '24 08:02 mzwettler2