Add s3 backup option to rancher/ha-backups; correct wording of titles and mention the versions

This commit is contained in:
Chris McKee
2019-04-29 11:39:00 +01:00
parent 8648893d15
commit 18c2cfcaff
@@ -44,37 +44,54 @@ To take recurring snapshots, enable the `etcd-snapshot` service, which is a serv
**To Enable Recurring Snapshots:**
1. Open `rancher-cluster.yml` with your favorite text editor.
2. Add the following code block to the bottom of the file:
```
services:
etcd:
snapshot: true # enables recurring etcd snapshots
creation: 6h0s # time increment between snapshots
retention: 24h # time increment before snapshot purge
```
_Pre 0.2.0_
~~~yaml
```
services:
etcd:
snapshot: true # enables recurring etcd snapshots
creation: 6h0s # time increment between snapshots
retention: 24h # time increment before snapshot purge
```
~~~
_Post 0.2.0: Note: S3 backup is optional_
~~~yaml
```
services:
etcd:
backup_config:
enabled: true # enables recurring etcd snapshots
interval_hours: 6 # time increment between snapshots
retention: 60 # time in days before snapshot purge
s3_backup_config: # optional
access_key: "myaccesskey"
secret_key: "myaccesssecret"
bucket_name: "my-backup-bucket"
endpoint: "s3.eu-west-1.amazonaws.com"
region: "eu-west-1"
```
~~~
3. Edit the code according to your requirements.
4. Save and close `rancher-cluster.yml`.
5. Open **Terminal** and change directory to the location of the RKE binary. Your `rancher-cluster.yml` file must reside in the same directory.
6. Run the following command:
```
rke up --config rancher-cluster.yml
```
**Result:** RKE is configured to take recurring snapshots of `etcd` on all nodes running the `etcd` role. Snapshots are saved to the following directory: `/opt/rke/etcd-snapshots/`.
#### Option B: One-Time Snapshots
When you're about to upgrade Rancher or restore it to a previous snapshot, you should snapshot your live image so that you have a backup of `etcd` in its last known state.
**To Take a One-Time Snapshot:**
**To Take a One-Time Local Snapshot:**
1. Open **Terminal** and change directory to the location of the RKE binary. Your `rancher-cluster.yml` file must reside in the same directory.
@@ -86,7 +103,23 @@ When you're about to upgrade Rancher or restore it to a previous snapshot, you s
**Result:** RKE takes a snapshot of `etcd` running on each `etcd` node. The file is saved to `/opt/rke/etcd-snapshots`.
### 2. Backup Snapshots to a Safe Location
**To Take a One-Time S3 Snapshot:**
1. Open **Terminal** and change directory to the location of the RKE binary. Your `rancher-cluster.yml` file must reside in the same directory.
2. Enter the following command. Replace `<SNAPSHOT.db>` with any name that you want to use for the snapshot (e.g. `upgrade.db`).
```shell
rke etcd snapshot-save --config rancher-cluster.yml --name snapshot-name \
--s3 --access-key S3_ACCESS_KEY --secret-key S3_SECRET_KEY \
--bucket-name s3-bucket-name --s3-endpoint s3.amazonaws.com
```
*The snapshot is saved in `/opt/rke/etcd-snapshots` as well as uploaded to the S3 backend.*
### 2. Backup Local Snapshots to a Safe Location
> Note: This step is done for you where S3 backups are enabled
After taking the `etcd` snapshots, save them to a safe location so that they're unaffected if your cluster experiences a disaster scenario. This location should be persistent.
@@ -98,3 +131,6 @@ In this documentation, as an example, we're using Amazon S3 as our safe location
root@node:~# s3cmd mb s3://rke-etcd-snapshots
root@node:~# s3cmd put /opt/rke/etcd-snapshots/snapshot.db s3://rke-etcd-snapshots/
```