Percona MongoDB incremental backup and PITR feature

Percona released Percona Backup MongoDB version 1.3.1 and it brings a feature that was hugely expected by the community. It’s the ability to perform consistent incremental backups. This allows us to perform Point in Time Recovery (PITR).

Let’s see how to run a full backup with incremental backup in details.

First, it is necessary to have the PBM agent installed on the host where the mongoD process is running. You can install using YUM or APT.

To install using YUM:

Next, you need to start the pbm-agent in the server where mongoD process is running. You can use systemctl or nohup. For, example, using systemctl:

In, this example, I’m going to start manually and in the foreground just for illustrative purposes:

Now, we need to install pbm on another host. The pbm is the utility that will execute the backups. Percona backup for MongoDB allows to stream to AWS S3 or to the filesystem. In this case, I’m going to use the filesystem and enable PITR feature. I’m going to create a config.yaml file with the settings:

Once we did it, I’m going to set the initial configuration on pbm:

If we look at the pbm-agent output:

The last error message is expected because we do not have a full backup at this point. But now everything is ready. So let’s start a backup:

And that’s it. Let’s check our backup:

And it is done! If we check our directory we will see the files:

And the PITR directory:

As we can see, it is very easy to run backups with PITR. And it is a tool completely open source. The only similar option is available on Atlas (paid cloud form MongoDB) which is not open source.

See you next!

Leave a Reply