Documentation

Support

Set up backups for Percona Server for MongoDB

Set up backups for your database infrastructure in your own Kubernetes cluster
Read time 2 minutesLast updated 4 hours ago

If you have deployed Virtual Private Cloud in your own cluster through the Bring Your Own Elastic Kubernetes Service (BYO EKS) mode, complete the procedure in this section to set up backups for your database infrastructure using Percona Server for MongoDB (PSMDB). For backups, PSMDB uses EKS Pod Identity to access the AWS S3 bucket. The procedure sets up these components:
  • The necessary AWS resources
  • EKS Pod Identity

Requirements

Before you begin, ensure that this setup is complete:
  • You have performed this installation:
    • You have deployed Virtual Private Cloud in the BYO EKS mode.
    • Your installed Unity products, such as Asset Manager, run on your Kubernetes cluster.
    • During deployment, you have enabled PSMDB to monitor your database infrastructure, that is, you have set the
      enable_percona_mongo
      setting to true in the Terraform variables file.
  • These resources are available:
    • An EKS cluster with the necessary permissions to create the Identity and Access Management (IAM) roles and policies
    • An Amazon S3 bucket for backups

1. Configure EKS Pod Identity to access the S3 bucket

To configure EKS Pod Identity to access the S3 bucket, complete these steps:
  1. Complete the configuration procedure in the Percona Operator for MongoDB documentation.
  2. Authorize the Kubernetes service account
    psmdb-operator
    to access the Asset Manager namespace.

2. Test the backup configuration

After you have set up the IAM policy, verify that PSMDB can access the S3 bucket for backups:
  1. To create a test backup operation, apply this YAML file:
    apiVersion: psmdb.percona.com/v1
    kind: PerconaServerMongoDBBackup
    metadata:
      finalizers:
      - percona.com/delete-backup
      name: test-psmdb-backup
    spec:
      clusterName: psmdb-db
      storageName: s3-primary
      type: logical
  2. Check the custom resource PerconaServerMongoDBBackup to ensure that the backup is created. To get the status of the backup, run this command:
    kubectl get perconaservermongodbbackup test-psmdb-backup -n psmdb-db
    The status must be ready.
  3. Verify that there are no access errors. To check the PSMDB pod logs, run this command:
    kubectl logs psmdb-db-rs0-0 -c backup-client
  4. Verify that the backup is stored in the S3 bucket.

3. Verify backup storage

To confirm that backups are working correctly, complete these steps:
  1. Check the backup status using the kubectl command that you used to test the backup configuration.
  2. Go to your S3 bucket and verify that backup files are being created.
  3. Verify that the backup process works from end to end. To test restoring from a backup, apply this .yaml file:
    apiVersion: psmdb.percona.com/v1
    kind: PerconaServerMongoDBRestore
    metadata:
      name: test-psmdb-restore
    spec:
      clusterName: psmdb-db
      backupName: test-psmdb-backup
  4. To ensure that the backup copy is restored, check the custom resource
    PerconaServerMongoDBRestore
    . To get the restore status, run this command:
    kubectl get perconaservermongodbrestore test-psmdb-restore -n psmdb-db