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

PBM-1138 Added Run in a Docker doc #139

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
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
81 changes: 81 additions & 0 deletions docs/install/docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Run Percona Backup for MongoDB in a Docker container

Docker images of Percona Backup for MongoDB are hosted publicly on [Docker Hub](https://hub.docker.com/repository/docker/percona/percona-backup-mongodb).

Check notice on line 3 in docs/install/docker.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/docker.md#L3

[Google.Passive] In general, use active voice instead of passive voice ('are hosted').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('are hosted').", "location": {"path": "docs/install/docker.md", "range": {"start": {"line": 3, "column": 45}}}, "severity": "INFO"}

For more information about using Docker, see the [Docker Docs](https://docs.docker.com/).

!!! note

Make sure that you are using the latest version of Docker. The ones provided via apt and yum may be outdated and cause errors.

By default, Docker will pull the image from Docker Hub if it is not available locally.

## Start Percona Backup for MongoDB

Start Percona Backup for MongoDB container with the following command:


```{.bash data-prompt="$"}
$ docker run --name <container-name> -e PBM_MONGODB_URI="mongodb://<PBM_USER>:<PBM_USER_PASSWORD>@<HOST>:<PORT>" -d percona/percona-backup-mongodb:<tag>-multi
```

Where:

* `container-name` is the name you want to assign to your container.
* `PBM_MONGODB-URI` is a [MongoDB Connection URI](https://docs.mongodb.com/manual/reference/connection-string/) string used to connect to MongoDB nodes. See the [Initial setup](initial-setup.md) how to create the PBM user.
* `tag-multi` is the tag specifying the version you need. For example, `2.3.0-multi`. The `multi` part of the tag serves to identify the architecture (x86_64 or ARM64) and pull the respective image. See the [full list of tags](https://hub.docker.com/r/perconalab/percona-backup-mongodb/tags).

Check notice on line 26 in docs/install/docker.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/docker.md#L26

[Google.Parens] Use parentheses judiciously.
Raw output
{"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/install/docker.md", "range": {"start": {"line": 26, "column": 151}}}, "severity": "INFO"}

Note that every MongoDB node (including replica set secondary members and config server replica set nodes) requires a separate instance of Percona Backup for MongoDB. Thus, a typical, 3-node MongoDB replica set requires three instances of Percona Backup for MongoDB.

## Set up Percona Backup for MongoDB

Percona Backup for MongoDB requires the remote storage where to store data. Use the following commands to configure it:

1. Start a Bash session:

```{.bash data-prompt="$"}
$ docker run --name <container-name> bash
```

2. Create a YAML configuration file:

```{.bash data-prompt="$"}
$ touch /tmp/pbm_config.yaml
```

3. Specify remote storage parameters in the config file. The following example is for S3-compatible backup storage. Check what [other storages are supported](../details/storage-configuration.md):

Check failure on line 46 in docs/install/docker.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/docker.md#L46

[Vale.Spelling] Did you really mean 'storages'?
Raw output
{"message": "[Vale.Spelling] Did you really mean 'storages'?", "location": {"path": "docs/install/docker.md", "range": {"start": {"line": 46, "column": 135}}}, "severity": "ERROR"}

Check notice on line 46 in docs/install/docker.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/docker.md#L46

[Google.Passive] In general, use active voice instead of passive voice ('are supported').
Raw output
{"message": "[Google.Passive] In general, use active voice instead of passive voice ('are supported').", "location": {"path": "docs/install/docker.md", "range": {"start": {"line": 46, "column": 144}}}, "severity": "INFO"}

```yaml
storage:
type: s3
s3:
region: <your-region-here>
bucket: <your-bucket-here>
credentials:
access-key-id: <your-access-key-id-here>
secret-access-key: <your-secret-key-here>
```

4. Upload the config file:

```{.bash data-prompt="$"}
$ pbm config --file /tmp/pbm_config.yaml
```

## Run Percona Backup for MongoDB

Percona Backup for MongoDB command line utility (`pbm`) provides the set of commands to control backups: create, restore, cancel backups, etc.

Check notice on line 67 in docs/install/docker.md

View workflow job for this annotation

GitHub Actions / vale

[vale] docs/install/docker.md#L67

[Google.Parens] Use parentheses judiciously.
Raw output
{"message": "[Google.Parens] Use parentheses judiciously.", "location": {"path": "docs/install/docker.md", "range": {"start": {"line": 67, "column": 1}}}, "severity": "INFO"}

For example, to start a backup, use the following command:

```{.bash data-prompt="$"}
$ docker run --name <container-name> pbm backup
```

where `<container-name>` is the name you assigned to the container and `pbm backup` is the command to start a backup.

In the same way you can run other pbm commands. Find the full list of available commands in [Percona Backup for MongoDB reference](https://docs.percona.com/percona-backup-mongodb/reference/pbm-commands.html).

## Next steps

[List backups](../usage/list-backup.md)
3 changes: 2 additions & 1 deletion mkdocs-base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,8 @@ nav:
- Method 1. From repositories: install/repos.md
- Method 2. Build from source: install/source.md
- Method 3. Download tarballs: install/tarball.md
- Method 4. Deploy on Kubernetes: install/cloud.md
- Method 4. Run in Docker: install/docker.md
- Method 5. Deploy on Kubernetes: install/cloud.md
- Set up and configure: 'install/initial-setup.md'
- Make a backup : "usage/start-backup.md"
- Restore a backup: usage/restore.md
Expand Down