Backup restore recommendations of mongodb


#1

Hi Sebastian

I’m trying to replicate your kubernettes setup with mongodb and squidex in our local azure cloud.

I’m lacking some best practice input on terms of mongodb backup and restore procedure when not using on mongodb as PaaS.

Do you have any experience or input from your current setup that you could share?


#2

I have created my own backup application: https://github.com/SebastianStehle/MongoBackup/blob/master/MongoBackup/Program.cs

And then I use the following job

apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: mongodb-backup
spec:
  schedule: "0 1 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          volumes:
          - name: k8user-key
            secret:
              secretName: k8user-key
          containers:
            - name: mongodb-backup
              image: sebastianstehle/mongodb-backup
              imagePullPolicy: Always
              env:
                - name: MONGODB__URI
                  value: "mongodb://mongo-0.mongo,mongo-1.mongo,mongo-2.mongo:27017/"
                - name: GOOGLESTORAGE__BUCKETNAME
                  value: squidex-backups
                - name: GOOGLE_APPLICATION_CREDENTIALS
                  value: /var/secrets/google/key.json
              volumeMounts:
              - name: k8user-key
                mountPath: /var/secrets/google
          restartPolicy: Never
      backoffLimit: 4

You could create a PR to also support azure storage as a target.


#3

Thanks a lot ! :slight_smile: