Skip to content

Latest commit

Β 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 

Repository files navigation

MongoDB Backup & Restore Helm Chart

This Helm chart automates the process of MongoDB backup (using mongodump) and restore (using mongorestore) between two MongoDB instances.

πŸ“ Project Structure

mongo-backup-restore/
β”œβ”€β”€ templates/
β”‚   β”œβ”€β”€ mongo-dump-pod.yaml       # Pod that performs mongodump
β”‚   └── mongo-restore-pod.yaml    # Pod used for restoring data
β”œβ”€β”€ values.yaml                   # Source and destination MongoDB URIs
β”œβ”€β”€ Chart.yaml                    # Helm chart definition
β”œβ”€β”€ deploy-mongo-backup-restore.sh # Bash script to automate the process

πŸ”§ Configuration

Edit the values.yaml file to specify the source and destination MongoDB connection strings:

source:
  uri: "mongodb://<user>:<password>@<source-host>:27017/"

restore:
  namespace: "ferretdb"
  uri: "mongodb://<user>:<password>@<target-host>:27017/?socketTimeoutMS=300000&connectTimeoutMS=300000"

πŸš€ Usage

  1. Make sure helm, kubectl, and yq are installed.
  2. Deploy and run the backup/restore process:
chmod +x deploy-mongo-backup-restore.sh
./deploy-mongo-backup-restore.sh

πŸ“ Notes

  • The dump pod writes data to /dump and keeps running so you can copy files.
  • The restore pod just runs with mongodb client to connect to target database later and dump the data.
  • You can extend this with Kubernetes Jobs for fully automated lifecycle.

πŸ“¦ Requirements

  • Helm 3+
  • Kubernetes cluster
  • MongoDB access
  • yq installed (brew install yq or apt install yq)

About

Mongodb-client for kubernetes

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages