mirror of
https://github.com/rancher/rancher-docs.git
synced 2026-09-15 21:44:24 +00:00
upgrade/rollback/backup updates
This commit is contained in:
@@ -6,38 +6,40 @@ aliases:
|
||||
- /rancher/v2.x/en/installation/backups-and-restoration/single-node-backup-and-restoration/
|
||||
---
|
||||
|
||||
After completing your single node installation of Rancher create a backup of your current installation. Use this backup as a restoration point in disaster scenarios.
|
||||
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.
|
||||
|
||||
>**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.
|
||||
|
||||
1. Stop the container currently running Rancher Server. Replace `<RANCHER_CONTAINER_ID>` with the ID of your Rancher container.
|
||||
|
||||
```bash
|
||||
```
|
||||
docker stop <RANCHER_CONTAINER_ID>
|
||||
```
|
||||
|
||||
>**Tip:** You can obtain the ID for your Rancher container by entering the following command: `docker ps`.
|
||||
|
||||
2. <a id="backup"></a>Create a date container. This container contains the state data from your current Rancher Server, and will be used to start the newer version for Rancher Server.
|
||||
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.
|
||||
|
||||
```bash
|
||||
```
|
||||
docker create --volumes-from <RANCHER_CONTAINER_ID> \
|
||||
--name rancher-data-<RANCHER_VERSION> rancher/rancher:<RANCHER_CONTAINER_TAG>
|
||||
```
|
||||
|
||||
3. Backup state the data from the data container. You will need this for disaster recovery or in case you need to rollback the upgrade.
|
||||
```bash
|
||||
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.
|
||||
|
||||
```
|
||||
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. Restart Rancher Server. Replace `<RANCHER_CONTAINER_ID>` with the ID of your Rancher container.
|
||||
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.
|
||||
|
||||
```bash
|
||||
```
|
||||
# Restart Rancher server
|
||||
docker start <RANCHER_CONTAINER_ID>
|
||||
```
|
||||
|
||||
|
||||
@@ -6,23 +6,26 @@ aliases:
|
||||
- /rancher/v2.x/en/installation/after-installation/single-node-backup-and-restoration/
|
||||
---
|
||||
|
||||
Backup to a restoration point for your Rancher install if you encounter issues when upgrading.
|
||||
Restoring to a backup for your Rancher install if you encounter issues in your Rancher setup.
|
||||
|
||||
1. Stop the container currently running Rancher Server. Replace `<RANCHER_CONTAINER_ID>` with the ID of your Rancher container.
|
||||
|
||||
```bash
|
||||
```
|
||||
docker stop <RANCHER_CONTAINER_ID>
|
||||
```
|
||||
|
||||
2. Go to the location where you saved your backup tar balls. And run the following command:
|
||||
```bash
|
||||
docker run --volumes-from <RANCHER_CONTAINER_ID> -v $PWD:/backup alpine sh -c "rm /var/lib/rancher/* -rf && tar zxvf /backup/<BACKUP_FILENAME>.tar.gz"
|
||||
```
|
||||
2. Go to the location where you saved your [backup tar balls]({{< baseurl >}}/rancher/v2.x/en/backups/backups/single-node-backups/#backup). Run the following command to delete your current state data and start your backup data:
|
||||
|
||||
>**Warning!** Running this command will delete ALL current state data from your Rancher Server container. Any changes that happened after the backup point you are restoring will be lost.
|
||||
```
|
||||
docker run --volumes-from <RANCHER_CONTAINER_ID> -v $PWD:/backup \
|
||||
alpine sh -c "rm /var/lib/rancher/* -rf && \
|
||||
tar zxvf /backup/<BACKUP_FILENAME>.tar.gz"
|
||||
```
|
||||
|
||||
>**Warning!** Running this command will delete ALL current state data from your Rancher Server container. Any changes that happened after the backup point you are restoring will be lost.
|
||||
|
||||
3. Start you rancher server container back. The container will start with the data from the restored backup.
|
||||
|
||||
```bash
|
||||
```
|
||||
docker start <RANCHER_CONTAINER_ID>
|
||||
```
|
||||
|
||||
@@ -16,19 +16,21 @@ docker pull rancher/rancher:<PRIOR_VERSION>
|
||||
|
||||
2. Stop the container currently running Rancher Server. Replace `<RANCHER_CONTAINER_ID>` with the ID of your Rancher container.
|
||||
|
||||
```bash
|
||||
```
|
||||
docker stop <RANCHER_CONTAINER_ID>
|
||||
```
|
||||
|
||||
3. Go to the location where you saved your backup tar balls. And run the following command.
|
||||
3. Go to the location where you saved your [backup tar balls]({{< baseurl>}}/rancher/v2.x/en/upgrades/single-node-upgrade/#backup). Run the following command to create a data container from the backup tar ball.
|
||||
|
||||
```bash
|
||||
docker run --volumes-from rancher-data-<PRIOR_VERSION> -v $PWD:/backup alpine sh -c "rm /var/lib/rancher/* -rf && tar zxvf /backup/<BACKUP_FILENAME>.tar.gz"
|
||||
```
|
||||
```
|
||||
docker run --volumes-from rancher-data-<PRIOR_VERSION> \
|
||||
-v $PWD:/backup alpine sh -c "rm /var/lib/rancher/* -rf \
|
||||
&& tar zxvf /backup/<BACKUP_FILENAME>.tar.gz"
|
||||
```
|
||||
|
||||
4. Start a new Rancher Server container with the `<PRIOR_VERSION>` tag.
|
||||
4. Start a new Rancher Server container with the `<PRIOR_VERSION>` tag pointing to the data container.
|
||||
```
|
||||
docker run -d --volumes-from rancher-data-<PRIOR_VERSION> --restart=unless-stopped \
|
||||
-p 80:80 -p 443:443 rancher/rancher:<PRIOR_VERSION>
|
||||
docker run -d --volumes-from rancher-data-<PRIOR_VERSION> \
|
||||
--restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher:<PRIOR_VERSION>
|
||||
```
|
||||
>**Note:** _Do not_ stop the rollback after initiating it, even if the rollback process seems longer than expected. Stopping the rollback may result in database issues during future upgrades.
|
||||
|
||||
@@ -25,15 +25,14 @@ docker create --volumes-from <RANCHER_CONTAINER_ID> \
|
||||
--name rancher-data rancher/rancher:<RANCHER_CONTAINER_TAG>
|
||||
```
|
||||
|
||||
1. <a id="backup"></a>Create another container of your current Rancher data. However, this container is a backup for restoring your Rancher Server if your upgrade is unsuccessful. Name the container `rancher-data-snapshot-<CURRENT_VERSION>`.
|
||||
1. <a id="backup"></a>Create a backup tar ball of your current Rancher data. If you need to rollback, use this backup tar ball.
|
||||
|
||||
- Replace `<RANCHER_CONTAINER_ID>` with the same ID from the previous step.
|
||||
- Replace `<CURRENT_VERSION>` with the tag for the version of Rancher currently installed.
|
||||
- Replace `<RANCHER_CONTAINER_TAG>` with the version of Rancher that you are currently running, as mentioned in the [prerequisite](#prereq).
|
||||
- Replace `<RANCHER_VERSION>` with the tag for the version of Rancher currently installed.
|
||||
|
||||
```
|
||||
docker create --volumes-from <RANCHER_CONTAINER_ID> \
|
||||
--name rancher-data-snapshot-<CURRENT_VERSION> rancher/rancher:<RANCHER_CONTAINER_TAG>
|
||||
docker run --volumes-from rancher-data -v $PWD:/backup \
|
||||
alpine tar zcvf /backup/rancher-data-backup-<RANCHER_VERSION>.tar.gz \
|
||||
/var/lib/rancher
|
||||
```
|
||||
|
||||
1. Pull the most recent image of Rancher.
|
||||
|
||||
Reference in New Issue
Block a user