From d187652785651187dfd1f10369995f52ce7ea09b Mon Sep 17 00:00:00 2001 From: Anastasia Alexadrova Date: Wed, 20 Sep 2023 14:38:18 +0200 Subject: [PATCH] PBM-1138 Added Run in a Docker doc --- docs/install/docker.md | 81 ++++++++++++++++++++++++++++++++++++++++++ mkdocs-base.yml | 3 +- 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 docs/install/docker.md diff --git a/docs/install/docker.md b/docs/install/docker.md new file mode 100644 index 00000000..dd68efe8 --- /dev/null +++ b/docs/install/docker.md @@ -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). + +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 -e PBM_MONGODB_URI="mongodb://:@:" -d percona/percona-backup-mongodb:-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). + +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 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): + + ```yaml + storage: + type: s3 + s3: + region: + bucket: + credentials: + access-key-id: + secret-access-key: + ``` + +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. + +For example, to start a backup, use the following command: + +```{.bash data-prompt="$"} +$ docker run --name pbm backup +``` + +where `` 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) \ No newline at end of file diff --git a/mkdocs-base.yml b/mkdocs-base.yml index c09038c4..52f04229 100644 --- a/mkdocs-base.yml +++ b/mkdocs-base.yml @@ -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