You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Backup and Restore MongoDB ReplicaSet Clusters using Stash
@@ -19,21 +19,18 @@ Stash supports taking [backup and restores MongoDB ReplicaSet clusters in "idiom
19
19
## Before You Begin
20
20
21
21
- At first, you need to have a Kubernetes cluster, and the `kubectl` command-line tool must be configured to communicate with your cluster. If you do not already have a cluster, you can create one by using Minikube.
22
-
23
-
- Install Stash in your cluster following the steps [here](https://appscode.com/products/stash/0.8.3/setup/install/).
24
-
25
-
- Install [KubeDB](https://kubedb.com) in your cluster following the steps [here](https://kubedb.com/docs/0.12.0/setup/install/). This step is optional. You can deploy your database using any method you want. We are using KubeDB because it automates some tasks that you have to do manually otherwise.
26
-
27
-
- If you are not familiar with how Stash backup and restore databases, please check the following guide:
28
-
-[How Stash backup and restore databases](https://appscode.com/products/stash/0.8.3/guides/databases/overview/).
22
+
- Install Stash in your cluster following the steps [here](/docs/setup/install.md).
23
+
- Install MongoDB addon for Stash following the steps [here](/docs/addons/mongodb/setup/install.md)
24
+
- Install [KubeDB](https://kubedb.com) in your cluster following the steps [here](https://kubedb.com/docs/setup/install/). This step is optional. You can deploy your database using any method you want. We are using KubeDB because KubeDB simplifies many of the difficult or tedious management tasks of running a production grade databases on private and public clouds.
25
+
- If you are not familiar with how Stash backup and restore MongoDB databases, please check the following guide [here](/docs/addons/mongodb/overview.md).
29
26
30
27
You have to be familiar with following custom resources:
To keep things isolated, we are going to use a separate namespace called `demo` throughout this tutorial. Create `demo` namespace if you haven't created yet.
39
36
@@ -42,88 +39,7 @@ $ kubectl create ns demo
42
39
namespace/demo created
43
40
```
44
41
45
-
> Note: YAML files used in this tutorial are stored [here](https://github.com/stashed/mongodb/tree/master/docs/examples).
46
-
47
-
## Install MongoDB Catalog for Stash
48
-
49
-
Stash uses a `Function-Task` model to backup databases. We have to install MongoDB catalogs (`stash-mongodb`) for Stash. This catalog creates necessary `Function` and `Task` definitions to backup/restore MongoDB databases.
50
-
51
-
You can install the catalog either as a helm chart or you can create only the YAMLs of the respective resources.
Once installed, this will create `mongodb-backup-*` and `mongodb-restore-*` Functions for all supported MongoDB versions. To verify, run the following command:
92
-
93
-
```console
94
-
$ kubectl get functions.stash.appscode.com
95
-
NAME AGE
96
-
mongodb-backup-4.1 20s
97
-
mongodb-backup-4.0 20s
98
-
mongodb-backup-3.6 19s
99
-
mongodb-backup-3.4 20s
100
-
mongodb-restore-4.1 20s
101
-
mongodb-restore-4.0 20s
102
-
mongodb-restore-3.6 19s
103
-
mongodb-restore-3.4 20s
104
-
pvc-backup 7h6m
105
-
pvc-restore 7h6m
106
-
update-status 7h6m
107
-
```
108
-
109
-
Also, verify that the necessary `Task` have been created.
110
-
111
-
```console
112
-
$ kubectl get tasks.stash.appscode.com
113
-
NAME AGE
114
-
mongodb-backup-4.1 2m7s
115
-
mongodb-backup-4.0 2m7s
116
-
mongodb-backup-3.6 2m6s
117
-
mongodb-backup-3.4 2m7s
118
-
mongodb-restore-4.1 2m7s
119
-
mongodb-restore-4.0 2m7s
120
-
mongodb-restore-3.6 2m6s
121
-
mongodb-restore-3.4 2m7s
122
-
pvc-backup 7h7m
123
-
pvc-restore 7h7m
124
-
```
125
-
126
-
Now, Stash is ready to backup MongoDB database.
42
+
> Note: YAML files used in this tutorial are stored [here](https://github.com/stashed/mongodb/tree/{{< param "info.subproject_version" >}}/docs/examples).
KubeDB creates an [AppBinding](https://appscode.com/products/stash/0.8.3/concepts/crds/appbinding/) crd that holds the necessary information to connect with the database.
107
+
KubeDB creates an [AppBinding](/docs/concepts/crds/appbinding.md) crd that holds the necessary information to connect with the database.
192
108
193
109
**Verify AppBinding:**
194
110
@@ -254,7 +170,7 @@ Stash uses the `AppBinding` crd to connect with the target database. It requires
254
170
255
171
### AppBinding for SSL
256
172
257
-
If `SSLMode` of the MongoDB server is either of `requireSSL` or `preferSSL`, you can provide ssl connection informatin through AppBinding Spces.
173
+
If `SSLMode` of the MongoDB server is either of `requireSSL` or `preferSSL`, you can provide ssl connection information through AppBinding Specs.
258
174
259
175
User need to provide the following fields in case of SSL is enabled,
260
176
@@ -263,7 +179,7 @@ User need to provide the following fields in case of SSL is enabled,
263
179
264
180
**KubeDB does these automatically**. It has added the subject of `client.pem` in the mongodb server with `root` role. So, user can just use the appbinding that is created by KubeDB without doing any hurdle! See the [MongoDB with TLS/SSL (Transport Encryption)](https://github.com/kubedb/docs/blob/master/docs/guides/mongodb/tls-ssl-encryption/tls-ssl-encryption.md) guide to learn about the ssl options in mongodb in details.
265
181
266
-
So, in KubeDB, the following `CRD` deployes a mongodb replicaset where ssl is enabled (`requireSSL` sslmode),
182
+
So, in KubeDB, the following `CRD` deploys a mongodb replicaset where ssl is enabled (`requireSSL` sslmode),
267
183
268
184
```yaml
269
185
apiVersion: kubedb.com/v1alpha1
@@ -400,7 +316,7 @@ Now, we are ready to backup this sample database.
400
316
401
317
### Prepare Backend
402
318
403
-
We are going to store our backed up data into a GCS bucket. At first, we need to create a secret with GCS credentials then we need to create a `Repository` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](https://appscode.com/products/stash/0.8.3/guides/backends/overview/).
319
+
We are going to store our backed up data into a GCS bucket. At first, we need to create a secret with GCS credentials then we need to create a `Repository` crd. If you want to use a different backend, please read the respective backend configuration doc from [here](/docs/guides/latest/backends/overview.md).
404
320
405
321
**Create Storage Secret:**
406
322
@@ -438,7 +354,7 @@ spec:
438
354
Let's create the `Repository` we have shown above,
- `spec.target.ref`refers to the AppBinding crd for the `restored-mgo-rs` database.
656
572
- `spec.rules`specifies that we are restoring from the latest backup snapshot of the database.
657
573
658
-
> **Warning:** Label `kubedb.com/kind: MongoDB` is mandatory if you are uisng KubeDB to deploy the database. Otherwise, the database will be stuck in `Initializing` state.
574
+
> **Warning:** Label `kubedb.com/kind: MongoDB` is mandatory if you are using KubeDB to deploy the database. Otherwise, the database will be stuck in `Initializing` state.
659
575
660
576
Let's create the `RestoreSession` crd we have shown above,
0 commit comments