vertica / vertica-kubernetes

Operator, container and Helm chart to deploy Vertica in Kubernetes
Apache License 2.0
44 stars 24 forks source link

How to create the Backup and Restore the verticadb? #887

Open saibattula93 opened 1 month ago

saibattula93 commented 1 month ago

I am trying to find the backup files inside the vertica operator CRD files, But it is not presented the backup parameter in the CRD, How can i create the backup and restore and give the process, I have already read the documentation of the vertica backup and i don't understood clearly?

qindotguan commented 1 month ago

Are you looking for the in-database backup and restore operations? You can create archives inside the db first, and then

Refer to this doc for detailed steps: https://docs.vertica.com/latest/en/containerized/custom-resource-definitions/vertica-restorepoints-query/

Note that versions 24.1.0-0 and higher do not support backup and restore with vbr as it's removed from the image. https://docs.vertica.com/latest/en/containerized/backup-restore/

saibattula93 commented 1 month ago

Hi Qin, Firstly, i am created the vericadb operator, and then created the vertica cluster with 3 subcluster using the CRD files, I want the backup and restore process and how to create the YAML file, for the Vertica Database?

On Tue, Aug 6, 2024 at 4:11 PM Qin Guan @.***> wrote:

Are you looking for the in-database backup and restore operations? You can create archives inside the db first, and then

  • retrieve the saved restore points with VerticaRestorePointsQuery CR, and
  • revive to a specific restore point with restorePoint related parameters in the VerticaDB CR

Refer to this doc for detailed steps:

https://docs.vertica.com/latest/en/containerized/custom-resource-definitions/vertica-restorepoints-query/

Note that versions 24.1.0-0 and higher do not support backup and restore with vbr as it's removed from the image. https://docs.vertica.com/latest/en/containerized/backup-restore/

— Reply to this email directly, view it on GitHub https://github.com/vertica/vertica-kubernetes/issues/887#issuecomment-2270965455, or unsubscribe https://github.com/notifications/unsubscribe-auth/A3YHVBPBWWHC7WLNKCQPM73ZQCR5BAVCNFSM6AAAAABL2GLDUSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZQHE3DKNBVGU . You are receiving this because you authored the thread.Message ID: @.***>

qindotguan commented 1 month ago

What are your operator and Vertica versions? You can use YAML file to restore/revive the DB, but backup is supported only with in-database SQL.

Here is an example: Steps 1: backup with in-database SQL statements (replace restorepoints-primary1-0 and password accordingly):

kubectl exec -it restorepoints-primary1-0 -c server -- vsql -w password -c "CREATE ARCHIVE nightly;" 
kubectl exec -it restorepoints-primary1-0 -c server -- vsql -w password -c "SAVE RESTORE POINT TO ARCHIVE nightly";

Step 2: query the restore point with VerticaRestorePointsQuery CR (set verticaDBName to your vertica DB name):

$ cat vrpq.yaml
apiVersion: vertica.com/v1beta1
kind: VerticaRestorePointsQuery
metadata:
  name: restorepoints-query
spec:
  verticaDBName: restorepoints
  filterOptions:
    archiveName: "nightly"

You should be able to view the saved restore points

kubectl apply -f vrpq.yaml
kubectl describe vrpq restorepoints-query

Step 3: revive from the saved restore point with initPolicy: Revive and restorePoint.archive: "nightly":

$ cat vdb-demo-revive.yaml
apiVersion: vertica.com/v1
kind: VerticaDB
metadata:
  name: vdb-revive
spec:
  initPolicy: Revive
  restorePoint:
    archive: "nightly"
    index: 1
  communal:
    path: "s3://bucket-name/path/to/communal/storage/location"
    endpoint: http://path/to/endpoint
    credentialSecret: s3-creds   
  subclusters:
  - name: primary
    size: 3

Most of the steps can be found on this page: https://docs.vertica.com/latest/en/containerized/custom-resource-definitions/vertica-restorepoints-query/

qindotguan commented 1 week ago

@ saibattula93, could you let me know if your problem has been resolved?