Build from source code¶
What nodes to install on¶
pbm-agent
¶
Install pbm-agent
on all servers that have mongod
nodes in the
MongoDB cluster (or non-sharded replica set). You don’t need to start it on the arbiter
node, since it doesn’t have the data set.
pbm
CLI¶
You can install pbm
CLI on any or all servers or desktop computers you wish to use it from. Those computers must not be network-blocked from accessing the MongoDB cluster.
Before you start¶
Check the system requirements and supported MongoDB versions.
Prerequisites¶
To build Percona Backup for MongoDB from source, you need the following:
- Go 1.19 or above. Install and set up Go tools
- make
- git
krb5-devel
for Red Hat Enterprise Linux / CentOS orlibkrb5-dev
for Debian / Ubuntu. This package is required for Kerberos authentication in Percona Server for MongoDB.
Procedure¶
Here’s how to build Percona Backup for MongoDB:
-
Clone the repository
$ git clone https://github.com/percona/percona-backup-mongodb
-
Go to the project directory and build it
$ cd percona-backup-mongodb $ make build
After make completes, you can find pbm
and pbm-agent
binaries
in the ./bin
directory.
-
Check that Percona Backup for MongoDB has been built correctly and is ready for use.
$ cd bin $ ./pbm version
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¶
After the installation, do the following:
-
Create the environment file:
$ touch /etc/default/pbm-agent
-
Create the
pbm-agent.service
systemd unit file.$ sudo vim /lib/systemd/system/pbm-agent.service
-
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. -
Make
systemd
aware of the new service:$ sudo systemctl daemon-reload
After the installation, do the following:
-
Create the environment file:
$ touch /etc/sysconfig/pbm-agent
-
Create the
pbm-agent.service
systemd unit file.$ sudo vim /usr/lib/systemd/system/pbm-agent.service
-
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. -
Make
systemd
aware of the new service:$ sudo systemctl daemon-reload
Next steps¶
Created: April 16, 2025