updating backup procs

This commit is contained in:
Mark Bishop
2018-08-28 14:44:38 -07:00
committed by Denise Schannon
parent 80a40a4293
commit 7cab5c74d0
4 changed files with 27 additions and 24 deletions
@@ -6,41 +6,44 @@ aliases:
- /rancher/v2.x/en/installation/backups-and-restoration/single-node-backup-and-restoration/
---
After completing your single node installation of Rancher, you can create a backup of your current installation at any time. We recommend making a backup before [upgrading]({{< baseurl >}}/rancher/v2.x/en/upgrades/single-node-upgrade/). Use this backup as a restoration point in disaster scenarios or when you need to [rollback]({{< baseurl >}}/rancher/v2.x/en/backups/rollbacks/single-node-rollbacks/) to an older version.
After completing your single node installation of Rancher, we recommend creating backups of it on a regular basis. Use these backups as a restoration point in a disaster scenario.
>**Prerequisite:** Open Rancher and write down the version number displayed in the lower-left of the browser (example: `v2.0.0`). You'll need this number during the backup process.
<a id="prereq"></a>
1. Stop the container currently running Rancher Server. Replace `<RANCHER_CONTAINER_ID>` with the ID of your Rancher container.
>**Prerequisite:** Open Rancher and write down the version number displayed in the lower-left of the browser (example: `v2.0.5`). You'll need this number during the backup process.
>
>![Version Number]({{< baseurl >}}/img/rancher/rancher-version.png)
1. Using a remote Terminal connection, log into your Rancher Server.
1. Stop the container currently running Rancher Server. Replace `<RANCHER_CONTAINER_NAME>` with the name of your Rancher container.
```
docker stop <RANCHER_CONTAINER_ID>
docker stop <RANCHER_CONTAINER_NAME>
```
You can obtain the name for your Rancher container by entering `docker ps`.
![Stop Rancher Container]({{< baseurl >}}/img/rancher/docker-container-ps-output.png)
1. <a id="backup"></a>Using the command below, create a data container from the Rancher container you just stopped.
- Replace `<RANCHER_CONTAINER_NAME>` with the name from the previous step (our example uses `festive_mestorf`).
- Replace `<RANCHER_VERSION>` with the version of Rancher that you are currently running, as mentioned in the [Prerequisite](#prereq) (`v2.0.5` in our example).
- Replace `<RANCHER_CONTAINER_TAG>` with tag of your Rancher image (`v2.0.5` in our example).
```
docker create --volumes-from <RANCHER_CONTAINER_NAME> --name rancher-data-<RANCHER_VERSION> rancher/rancher:<RANCHER_CONTAINER_TAG>
```
>**Tip:** You can obtain the ID for your Rancher container by entering the following command: `docker ps`.
2. <a id="backup"></a>Create a data container. This container contains the data from your current Rancher Server, and can be used to start Rancher Server.
- Replace `<RANCHER_CONTAINER_ID>` with the same ID from the previous step.
- Replace `<RANCHER_VERSION>` and `<RANCHER_CONTAINER_TAG>` with the version of Rancher that you are currently running, as mentioned in the **Prerequisite** above.
1. From the data container that you just created (`rancher-data-<RANCHER_VERSION>`), create a backup tarball (`rancher-data-backup-<RANCHER_VERSION>.tar.gz`).
```
docker create --volumes-from <RANCHER_CONTAINER_ID> \
--name rancher-data-<RANCHER_VERSION> rancher/rancher:<RANCHER_CONTAINER_TAG>
docker run --volumes-from rancher-data-<RANCHER_VERSION> -v $PWD:/backup alpine tar zcvf /backup/rancher-data-backup-<RANCHER_VERSION>.tar.gz /var/lib/rancher
```
3. During upgrade, you point to a Rancher server to the same Rancher data container and the Rancher data in the data container will continue to be updated/changed. Therefore, you need to get a snapshot of the data to be used for disaster recovery or in case you need to rollback the upgrade.
1. Restart Rancher Server. Replace `<RANCHER_CONTAINER_NAME>` with the name of your Rancher container.
```
docker run --volumes-from rancher-data-<RANCHER_VERSION> \
-v $PWD:/backup alpine tar zcvf \
/backup/rancher-data-backup-<RANCHER_VERSION>.tar.gz /var/lib/rancher
docker start <RANCHER_CONTAINER_NAME>
```
3. After you've created your backup, you can either restart Rancher server or [upgrade]({{< baseurl >}}/rancher/v2.x/en/upgrades/single-node-upgrade/). Replace `<RANCHER_CONTAINER_ID>` with the ID of your Rancher container.
```
# Restart Rancher server
docker start <RANCHER_CONTAINER_ID>
```
**Result:** A backup of your Rancher Server is created. If you ever need to restore your backup, see [Restoring Backups: Single Node Installs]({{< baseurl >}}/rancher/v2.x/en/upgrades/restorations/single-node-restoration).
**Result:** A backup tarball of your Rancher Server data is created. Make note of the current directory, as this is where the tarball resides. See [Restoring Backups: Single Node Installs]({{< baseurl >}}/rancher/v2.x/en/backups/restorations/single-node-restoration) if you need to restore backup data.
Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB