You are looking at the documentation of a prior release. To read the documentation of the latest release, please visit here.

Install MongoDB Addon for Stash

Stash uses Function-Task model to backup databases. This Function-Task model enables Stash to extend its capability via addons. In order to backup MongoDB databases, you have to install MongoDB addon (stash-mongodb) for Stash. This addon creates necessary Function and Task definitions to backup/restore MongoDB database.

You can install the addon either as a helm chart or you can create only the YAMLs of the respective resources.

Using Helm 3

Run the following script to install stash-mongodb addon as a Helm chart using Helm 3.

curl -fsSL https://github.com/stashed/catalog/raw/v2020.09.16/deploy/helm3.sh | bash -s -- --catalog=stash-mongodb

Using Helm 2

Run the following script to install stash-mongodb addon as a Helm chart using Helm 2.

curl -fsSL https://github.com/stashed/catalog/raw/v2020.09.16/deploy/helm2.sh | bash -s -- --catalog=stash-mongodb

Using YAML

Run the following script to install stash-mongodb addon as Kubernetes YAMLs.

curl -fsSL https://github.com/stashed/catalog/raw/v2020.09.16/deploy/script.sh | bash -s -- --catalog=stash-mongodb

The above script uses Helm 3 for rendering the charts to generate the YAMLs.

Verify Installation

After installation is completed, this addon will create mongodb-backup-* and mongodb-restore-* Functions and Tasks for all supported MongoDB versions. To verify, run the following command:

$ kubectl get functions.stash.appscode.com
NAME                    AGE
mongodb-backup-4.1      20s
mongodb-backup-4.0      20s
mongodb-backup-3.6      19s
mongodb-backup-3.4      20s
mongodb-restore-4.1     20s
mongodb-restore-4.0     20s
mongodb-restore-3.6     19s
mongodb-restore-3.4     20s
pvc-backup              7h6m
pvc-restore             7h6m
update-status           7h6m

Also, verify that the Task have been created.

$ kubectl get tasks.stash.appscode.com
NAME                    AGE
mongodb-backup-4.1      2m7s
mongodb-backup-4.0      2m7s
mongodb-backup-3.6      2m6s
mongodb-backup-3.4      2m7s
mongodb-restore-4.1     2m7s
mongodb-restore-4.0     2m7s
mongodb-restore-3.6     2m6s
mongodb-restore-3.4     2m7s
pvc-backup              7h7m
pvc-restore             7h7m

Now, Stash is ready to backup MongoDB databases.

Customizing Installation

In order to install Function and Task only for a specific MongoDB version, use --version flag to specify the desired database version.

curl -fsSL https://github.com/stashed/catalog/raw/v2020.09.16/deploy/helm3.sh | bash -s -- --catalog=stash-mongodb --version=3.6

The flowing flags are available for customizing MongoDB addon installation:

FlagUsage
--versionSpecify a specific version of a specific addon to install. Use it along with --catalog flag.
--docker-registrySpecify the docker registry to use to pull respective addon images. Default Value: stashed.
--imageSpecify the name of the docker image to use for respective addons.
--image-tagSpecify the tag of the docker image to use for respective addon.
--mg-backup-argsSpecify optional arguments to pass to mongodump command during backup. These arguments apply to all MongoDB instances in this cluster. To set arguments for a specific MongoDB database instance, set mgArgs parameter in spec.task.params field of the respective BackupConfiguration.
--mg-restore-argsSpecify optional arguments to pass to mongorestore command during restore. These arguments apply to all MongoDB instances in this cluster. To set arguments for a specific MongoDB database instance, set mgArgs parameter in spec.task.params field of the respective RestoreSession.