Skip to content

Installing Percona Backup for MongoDB

Percona provides and supports Percona Backup for MongoDB installation packages for Debian, Ubuntu, Red Hat Enterprise Linux and CentOS Linux distributions. Find detailed information about supported Linux distributions on the Percona Software and Platform Lifecycle page.

You can install Percona Backup for MongoDB in one of the following ways:

Alternatively, you can run Percona Backup for MongoDB in a Docker container

Regardless of the installation method you choose, the following tools are at your disposal after the installation completes:

Tool

Purpose

pbm

Command-line interface for controlling the backup system

pbm-agent

An agent for running backup/restore actions on a database host

pbm-speed-test

An interface for field-testing compression and backup upload speed


Install pbm-agent on every server that has mongod nodes in the MongoDB cluster (or non-sharded replica set). You don’t need to install pbm-agent on arbiter nodes since they don’t have the data set.

You can install pbm CLI on any or all servers or desktop computers you wish to use it from, so long as those computers aren’t network-blocked from accessing the MongoDB cluster.

Installing from Percona repositories

This is the recommended installation method. Percona provides the percona-release configuration tool that simplifies operating repositories and enables to install and update both Percona Backup for MongoDB packages and required dependencies smoothly.

Install percona-release tool using the package manager of your operating system. Follow the instructions in Percona Software repositories documentation to install percona-release.

Enable the repository. As of version 1.3.0, Percona Backup for MongoDB packages are stored in the pbm repository.

$ sudo percona-release enable pbm release

Install Percona Backup for MongoDB on Debian and Ubuntu

Reload the local package database:

$ sudo apt update

Install Percona Backup for MongoDB:

$ sudo apt install percona-backup-mongodb

Install Percona Backup for MongoDB on Red Hat Enterprise Linux and CentOS

Use the following command to install Percona Backup for MongoDB:

$ sudo yum install percona-backup-mongodb

Building from source code

Building the project requires:

  • Go 1.15 or above

  • make

  • git

  • krb5-devel for Red Hat Enterprise Linux / CentOS or libkrb5-dev for Debian / Ubuntu. This package is required for Kerberos authentication in Percona Server for MongoDB.

See also

Installing and setting up Go tools

https://golang.org/doc/install

To build the project (from the project dir):

$ git clone https://github.com/percona/percona-backup-mongodb
$ cd percona-backup-mongodb
$ make build

After make completes, you can find pbm and pbm-agent binaries in the ./bin directory:

$ cd bin
$ ./pbm version

By running pbm version, you can verify if Percona Backup for MongoDB has been built correctly and is ready for use.

Output

Version:   [pbm version number]
Platform:  linux/amd64
GitCommit: [commit hash]
GitBranch: main
BuildTime: [time when this version was produced in UTC format]
GoVersion: [Go version number]

Tip

Instead of specifying the path to pbm binaries, you can add it to the PATH environment variable:

export PATH=/percona-backup-mongodb/bin:$PATH

Post-install steps

  1. Create the environment file:

    • The path for Debian and Ubuntu is /etc/default/pbm-agent.

    • The path for RHEL and CentOS is /etc/sysconfig/pbm-agent.

  2. Create the pbm-agent.service systemd unit file.

    In Ubuntu and Debian, the pbm-agent.service systemd unit file is at the path /lib/systemd/system/pbm-agent.service.

    In RHEL and CentOS, the path to this file is /usr/lib/systemd/system/pbm-agent.service.

  3. In the pbm-agent.service file, specify the following:

    [Unit]
    Description=pbm-agent
    After=time-sync.target network.target
    
    [Service]
    EnvironmentFile=-/etc/default/pbm-agent
    Type=simple
    User=mongod
    Group=mongod
    PermissionsStartOnly=true
    ExecStart=/usr/bin/pbm-agent
    
    [Install]
    WantedBy=multi-user.target
    

    Note

    Make sure that the ExecStart directory includes the Percona Backup for MongoDB binaries. Otherwise, copy them from the ./bin directory of you installation path.

  4. Make systemd aware of the new service:

    $ sudo systemctl daemon-reload
    

Download packages from Percona website

You can download installation packages specific for your operating system from Percona website and install them using dpkg (Debian and Ubuntu) or rpm (Red Hat Enterprise Linux and CentOS). However, you must make sure that all dependencies are satisfied.

Alternatively, you can download and install Percona Backup for MongoDB from binary tarballs.

Install from binary tarball

Find the link to the binary tarballs under the Generic Linux menu item on Percona website.

  1. Fetch the binary tarball. Replace the <version> with the required version.

    $ wget https://downloads.percona.com/downloads/percona-backup-mongodb/percona-backup-mongodb-<version>/binary/tarball/percona-backup-mongodb-<version>-x86_64.tar.gz
    
  2. Extract the tarball

    $ tar -xf percona-backup-mongodb-<version>-x86_64.tar.gz
    
  3. Export the location of the binaries to the PATH variable. For example, if you’ve extracted the tarball to your home directory, the command would be the following:

    $ export PATH=~/percona-backup-mongodb-<version>/:$PATH
    

After Percona Backup for MongoDB is successfully installed on your system, you have pbm and pbm-agent programs available. See Initial setup for guidelines how to set up Percona Backup for MongoDB.