mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-28 05:59:03 +00:00
Add s3 backup option to rancher/ha-backups; correct wording of titles and mention the versions
This commit is contained in:
@@ -44,37 +44,54 @@ To take recurring snapshots, enable the `etcd-snapshot` service, which is a serv
|
|||||||
**To Enable Recurring Snapshots:**
|
**To Enable Recurring Snapshots:**
|
||||||
|
|
||||||
1. Open `rancher-cluster.yml` with your favorite text editor.
|
1. Open `rancher-cluster.yml` with your favorite text editor.
|
||||||
|
|
||||||
2. Add the following code block to the bottom of the file:
|
2. Add the following code block to the bottom of the file:
|
||||||
|
|
||||||
```
|
_Pre 0.2.0_
|
||||||
services:
|
|
||||||
etcd:
|
~~~yaml
|
||||||
snapshot: true # enables recurring etcd snapshots
|
```
|
||||||
creation: 6h0s # time increment between snapshots
|
services:
|
||||||
retention: 24h # time increment before snapshot purge
|
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.
|
3. Edit the code according to your requirements.
|
||||||
|
|
||||||
4. Save and close `rancher-cluster.yml`.
|
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.
|
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:
|
6. Run the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
rke up --config rancher-cluster.yml
|
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/`.
|
**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
|
#### 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.
|
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.
|
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`.
|
**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.
|
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 mb s3://rke-etcd-snapshots
|
||||||
root@node:~# s3cmd put /opt/rke/etcd-snapshots/snapshot.db s3://rke-etcd-snapshots/
|
root@node:~# s3cmd put /opt/rke/etcd-snapshots/snapshot.db s3://rke-etcd-snapshots/
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user