Barman is a tool used for managing PostgreSQL backup and recovery for multiple servers. In this tutorial, we will guide you through the process of installing Barman on macOS.
Before you proceed, ensure your system meets the following requirements:
In macOS, Python is already pre-installed. You can check the version by running the command:
python --version
If Python is not installed, you can install it using the package manager of your choice:
# using Homebrew
brew install python
# using MacPorts
sudo port install python
You can install Barman using pip, the official package installer for Python. To install pip, run the following command:
sudo easy_install pip
Once pip is installed, you can install Barman by running the following command:
sudo pip install pgbarman
Before you start using Barman, you need to configure it.
First, create a directory where you will store the Barman configuration files:
sudo mkdir /etc/barman
sudo chown $(whoami) /etc/barman
Next, create the Barman configuration file barman.conf
inside the /etc/barman
directory:
nano /etc/barman/barman.conf
Add the following configuration to barman.conf
:
[barman]
barman_home = /var/lib/barman
[postgres01]
description = "PostgreSQL Database Server version 12.1"
conninfo = host=10.0.0.2 user=barman password=barman123
streaming_conninfo = host=10.0.0.2 user=barman password=barman123
backup_method = rsync
[postgres02]
description = "PostgreSQL Database Server version 11.6"
conninfo = host=10.0.0.3 user=barman password=barman123
streaming_conninfo = host=10.0.0.3 user=barman password=barman123
# add more PostgreSQL Database Servers here
Replace the conninfo and streaming_conninfo values with your PostgreSQL Database Server's connect information. You can add as many database servers as you need.
Save and close the file.
To start Barman, run the following command:
sudo barman cron
This will start the Barman cron job to schedule backups.
To check if Barman is running correctly, run the command:
sudo barman check all
This should return a message indicating that "Barman check has been successfully run."
You have successfully installed and configured Barman on your macOS system.
If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!
Alternatively, for the best virtual desktop, try Shells!