-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbandr-backup-manual.html.md.erb
239 lines (168 loc) · 7.73 KB
/
bandr-backup-manual.html.md.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
---
title: Backing Up <%= vars.app_runtime_full %> Manually
owner: Tanzu Application Service Release Engineering
---
<% current_page.data.title = "Backing Up #{vars.app_runtime_full}" %>
This topic provides an overview of how to manually back up
<%= vars.app_runtime_full %> (<%= vars.app_runtime_short %>).
To back up <%= vars.app_runtime_short %> automatically, see
[Backing Up <%= vars.app_runtime_short %> Using Automation](bandr-backup-auto.html).
<%= partial 'evaluation_only' %>
<%= partial 'limitation_notes' %>
## <a id='overview'></a> Overview
To back up <%= vars.app_runtime_short %>:
* [Back Up <%= vars.app_runtime_short %>](#backup-tas4k8s)
* [Monitor Backup Progress](#backup-progress)
* [Review a Completed Backup](#backup-review)
## <a id='prerequisites'></a> Prerequisites
Before you back up <%= vars.app_runtime_short %>,
you must have configured back up and restore.
See [Configuring Back Up and Restore for <%= vars.app_runtime_short %>](bandr-configuration.html).
## <a id='backup-tas4k8s'></a> Back Up <%= vars.app_runtime_short %>
To back up <%= vars.app_runtime_short %> Tanzu Postgres Instances:
1. Start a Velero back up:
```
velero create backup BACKUP-NAME \
--include-namespaces NAMESPACES \
--selector 'app in (RESOURCE-LIST)' \
--storage-location STORAGE-LOCATION \
--ttl TTL-LENGTH \
--wait
```
Where:
* `BACKUP-NAME` is the name to apply to the generated backup.
VMware recommends using a backup name that includes a timestamp for ease of discoverability.
For example: `TAS4K8s_$(date -u +"%Y-%m-%dT%H:%M:%SZ")`.
<br>
* `NAMESPACES` is the comma-delimited list of namespaces for the selected resources to back up.
<br>
The namespace list for backing up the default <%= vars.app_runtime_short %> configuration is `postgres-dbs,cf-system`,
where `postgres-dbs` is the default <%= vars.app_runtime_short %> database namespace.
<br>
* `RESOURCE-LIST` is the comma-delimited list of selected resources to back up.
<br>
The resource list for backing up the default <%= vars.app_runtime_short %> configuration is `postgres, cf-metadata`,
where `cf-metadata` is specified for backing up the CF Metadata app,
and `postgres` for backing up the <%= vars.app_runtime_short %> Postgres instances.
<br>
* `STORAGE-LOCATION` is the location where Velero should store the generated backup artifacts.
<br>
* (Optional) `TTL-LENGTH` is the time to live (TTL) duration until the backup is deleted.
The TTL should be formatted as hours, minutes, seconds: `000H00M00S`.
If you do not specify the TTL duration, the default duration length is `720h0m0s`.
<br>
* (Optional) Include the `--wait` parameter to follow the backup procedure progress.
<br>
The recommended command line is:
```
velero create backup BACKUP-NAME \
--include-namespaces postgres-dbs,cf-system \
--selector 'app in (postgres, cf-metadata)' \
--ttl 35040h0m0s \
--wait
```
## <a id='backup-progress'></a> Monitor Backup Progress
To monitor the progress of a running backup:
1. To determine the name of your backup:
```
velero get backups
```
For example:
<pre class="terminal">
$ velero get backups
NAME STATUS CREATED EXPIRES STORAGE LOCATION SELECTOR
backup_1 Completed 2020-03-24 14:12:29 +0000 UTC 21d default (app in (cf-metadata,postgres)
</pre>
1. To inspect a backup:
```
velero describe backup BACKUP-NAME
````
Where:
* `BACKUP-NAME` is the name you applied to your backup.
<br>
* (Optional) Include the `--details` parameter to display a highly verbose output.
## <a id='backup-review'></a> Review a Completed Backup
To review a completed backup:
* [Review Backup Logs](#backup-monitor-logs)
* [Validate the Backup](#backup-validate)
* [Troubleshoot a Failed Backup](#backup-troubleshoot)
### <a id='backup-monitor-logs'></a> Review Backup Logs
After a backup has completed, the backup logs can be reviewed for a detailed inspection
of the root cause of potential failures.
To review the backup logs of a completed backup:
1. Run:
```
velero backup logs BACKUP-NAME
````
Where `BACKUP-NAME` is the name you applied to your backup.
### <a id='backup-validate'></a> Validate the Backup
To validate a completed backup by reviewing the Cloud Foundry data that was backed up:
1. If you do not have the <%= vars.app_runtime_short %> installation resources:
1. Download and extract the resources from [VMware Tanzu Network](https://network.pivotal.io/products/tas-for-kubernetes).
For more information, see [Preparing Installation Resources](preparing-to-install-tas-for-kubernetes.html#preparing-installation-resources).
1. Inspect the <%= vars.app_runtime_short %> artifact.
Confirm the `get-backup-metadata.sh` script is present in the following directory: `tanzu-application-service/config/_ytt_lib/github.com/pivotal/cf-for-k8s-disaster-recovery/backup-metadata/bin`.
1. To confirm the name of the backup to validate:
```
velero get backups
```
For example:
<pre class="terminal">
$ velero get backups
NAME STATUS CREATED EXPIRES STORAGE LOCATION SELECTOR
backup_1 Completed 2020-03-24 14:12:29 +0000 UTC 21d default (app in (cf-metadata,postgres)
1. To display a detailed inspection of the backup:
```
velero describe backup BACKUP-NAME
```
Where:
* `BACKUP-NAME` is the name you applied to your backup.
* (Optional) Include the `--details` parameter to display a highly verbose output.
For example:
<pre class="terminal">
$ velero describe backup MY_BACKUP_NAME
Name: tas4k8s-2020-10-13-09h17m49s
Namespace: velero
Labels: velero.io/storage-location=default
Annotations: velero.io/source-cluster-k8s-gitversion=v1.17.9-gke.1504
velero.io/source-cluster-k8s-major-version=1
velero.io/source-cluster-k8s-minor-version=17+
Phase: Completed
Errors: 0
Warnings: 0
Namespaces:
Included: postgres-dbs, cf-system
Excluded: <none>
Resources:
Included: *
Excluded: <none>
Cluster-scoped: auto
Label selector: app in (cf-metadata,postgres)
Storage Location: default
Velero-Native Snapshot PVs: auto
TTL: 35040h0m0s
Hooks: <none>
Backup Format Version: 1.1.0
Started: 2020-10-13 09:17:49 +0000 UTC
Completed: 2020-10-13 09:18:46 +0000 UTC
Expiration: 2024-10-12 09:17:49 +0000 UTC
Total items to be backed up: 31
Items backed up: 31
Velero-Native Snapshots: 3 of 3 snapshots completed successfully (specify --details for more information)
</pre>
1. To generate a JSON file which contains the snapshot of Cloud Foundry at the time of the backup:
```
tanzu-application-service/config/_ytt_lib/github.com/pivotal/cf-for-k8s-disaster-recovery/backup-metadata/bin/get-backup-metadata.sh BACKUP-NAME OUTPUT-FILENAME
```
Where
* `BACKUP-NAME` is the name you applied to your backup.
* `OUTPUT-FILENAME` is the name of the Cloud Foundry state file to create for the backup.
The created state file is a JSON formatted file.
For example:
<pre class="terminal">
tanzu-application-service/config/_ytt_lib/github.com/pivotal/cf-for-k8s-disaster-recovery/backup-metadata/bin/get-backup-metadata.sh backup_1 cf-metadata.json
</pre>
1. To review the created Cloud Foundry outline, open the generated JSON file in your IDE of choice.
### <a id='backup-troubleshoot'></a> Troubleshoot a Failed Backup
To troubleshoot a failed backup,
complete [Review Backup Logs](#backup-monitor-logs), and proceed accordingly.