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 PostgreSQL database using Stash
@@ -19,21 +19,18 @@ Stash 0.9.0+ supports backup and restoration of PostgreSQL databases. This guide
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/latest/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 PostgreSQL addon for Stash following the steps [here](/docs/addons/postgres/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 PostgreSQL databases, please check the following guide [here](/docs/addons/postgres/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
@@ -44,91 +41,6 @@ namespace/demo created
44
41
45
42
> Note: YAML files used in this tutorial are stored [here](https://github.com/stashed/postgres/tree/master/docs/examples).
46
43
47
-
## Install Postgres Catalog for Stash
48
-
49
-
Stash uses a `Function-Task` model to backup databases. We have to install Postgres catalogs (`stash-postgres`) for Stash. This catalog creates necessary `Function` and `Task` definitions to backup/restore PostgreSQL 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 `postgres-backup-*` and `postgres-restore-*` Functions for all supported PostgreSQL versions. To verify, run the following command:
92
-
93
-
```console
94
-
$ kubectl get functions.stash.appscode.com
95
-
NAME AGE
96
-
postgres-backup-10.2 20s
97
-
postgres-backup-10.6 20s
98
-
postgres-backup-11.1 19s
99
-
postgres-backup-9.6 20s
100
-
postgres-restore-10.2 20s
101
-
postgres-restore-10.6 20s
102
-
postgres-restore-11.1 19s
103
-
postgres-restore-9.6 20s
104
-
postgres-backup-11.2 19s
105
-
postgres-restore-11.2 19s
106
-
pvc-backup 7h6m
107
-
pvc-restore 7h6m
108
-
update-status 7h6m
109
-
```
110
-
111
-
Also, verify that the necessary `Task` have been created.
112
-
113
-
```console
114
-
$ kubectl get tasks.stash.appscode.com
115
-
NAME AGE
116
-
postgres-backup-10.2 2m7s
117
-
postgres-backup-10.6 2m7s
118
-
postgres-backup-11.1 2m6s
119
-
postgres-backup-9.6 2m7s
120
-
postgres-restore-10.2 2m7s
121
-
postgres-restore-10.6 2m7s
122
-
postgres-restore-11.1 2m6s
123
-
postgres-restore-9.6 m7s
124
-
postgres-backup-11.2 2m6s
125
-
postgres-restore-11.2 2m6s
126
-
pvc-backup 7h7m
127
-
pvc-restore 7h7m
128
-
```
129
-
130
-
Now, Stash is ready to backup PostgreSQL database.
131
-
132
44
## Backup PostgreSQL
133
45
134
46
This section will demonstrate how to backup PostgreSQL database. Here, we are going to deploy a PostgreSQL database using KubeDB. Then, we are going to backup this database into a GCS bucket. Finally, we are going to restore the backed up data into another PostgreSQL database.
Here, we have to use service `sample-postgres` and secret `sample-postgres-auth` to connect with the database. 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.
105
+
Here, we have to use service `sample-postgres` and secret `sample-postgres-auth` to connect with the database. KubeDB creates an [AppBinding](/docs/concepts/crds/appbinding.md) crd that holds the necessary information to connect with the database.
194
106
195
107
**Verify AppBinding:**
196
108
@@ -331,7 +243,7 @@ Now, we are ready to backup this sample database.
331
243
332
244
### Prepare Backend
333
245
334
-
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/).
246
+
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).
335
247
336
248
**Create Storage Secret:**
337
249
@@ -369,7 +281,7 @@ spec:
369
281
Let's create the `Repository` we have shown above,
Now, if we navigate to the GCS bucket, we are going to see backed up data has been stored in `demo/postgres/sample-postgres` directory as specified by `spec.backend.gcs.prefix` field of Repository crd.
464
376
465
377
<figure align="center">
466
-
<img alt="Backup data in GCS Bucket" src="/docs/images/sample-postgres-backup.png">
378
+
<img alt="Backup data in GCS Bucket" src="../images/sample-postgres-backup.png">
467
379
<figcaption align="center">Fig: Backup data in GCS Bucket</figcaption>
0 commit comments