Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic backup and restore documentation #2361

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions 07.Server-installation/05.Backup-and-restore/docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: Backup and Restore
taxonomy:
category: docs
label: tutorial
---

## Overview

Mender Server stores all data in a MongoDB database. This includes device authentication data, inventory data, users and organization settings. It is important to back up this data regularly to prevent data loss.
Artifacts data are stored in an external storage, such as AWS S3 or Minio, and are not part of the Mender Server database. You should also back up this data separately.

## Backup

!!!!! Always verify the right backup procedure from your database vendor documentation. The following is a general guideline.

The backup procedure for MongoDB is straightforward. You can use the `mongodump` tool to create a backup of the database. The following command creates a backup of the database to the `backup` directory:

```bash
mongodump --host <MONGODB_HOST> --port <MONGODB_PORT> --out /backup/directory
```

You can also backup artifacts data stored in an external storage, such as AWS S3 or Minio, by copying the data to a backup location. For example:

```bash
aws s3 cp s3://<BUCKET_NAME> /backup/directory --recursive
```

## Restore

!!!!! Always verify the right restore procedure from your database vendor documentation. The following is a general guideline.

To restore the MongoDB database from a backup, you can use the `mongorestore` tool. The following command restores the database from the `backup` directory:

```bash
mongorestore --host <MONGODB_HOST> --port <MONGODB_PORT> /backup/directory
```

You can also restore artifacts data stored in an external storage, such as AWS S3 or Minio, by copying the data from the backup location to the original storage location. For example:

```bash
aws s3 cp /backup/directory s3://<BUCKET_NAME> --recursive
```

## Mender Server

At this point you can start the Mender Server services. If you have restored the database to a different server, you may need to update the `global.mongodb.URL` setting in the `mender-server` helm configuration to point to the new MongoDB server.
The same applies for your external storage, if you have restored the artifacts data to a different location, by updating the `global.s3.AWS_BUCKET` setting in the `mender-server` helm configuration.