Step 4 - Installing the PGD software v4
Installing the PGD software
With the repositories configured, you can now install the Postgres Distributed software. You must perform these steps on each host before proceeding to the next step.
- Install the packages.
- Install the PGD packages, which include a server-specific BDR package and generic PGD CLI packages(
edb-bdr4-<postgresversion>
andedb-pgd-cli
).
- Install the PGD packages, which include a server-specific BDR package and generic PGD CLI packages(
- Ensure the Postgres database server was initialized and started.
- Use
systemctl status
to check the service is running. - If it isn't, initialize the database and start the service.
- Use
- Configure the BDR extension.
- Add the BDR extension (
$libdir/bdr
) at the start of theshared_preload_libraries
setting inpostgresql.conf
. - Set the
wal_level
GUC variable tological
inpostgresql.conf
. - Turn on commit timestamp tracking by setting
track_commit_timestamp
to'on'
inpostgresql.conf
. - Raise the maximum worker processes to 16 or higher by setting
max_worker_processes
to'16'
inpostgresql.conf
.The
max_worker_processes
valueThe
max_worker_processes
value is derived from the topology of the cluster, the number of peers, number of databases, and other factors. To calculate the needed value, see Postgres configuration/settings. The value of 16 was calculated for the size of cluster being deployed in this example and must be raised for larger clusters. - Set a password on the EnterprisedDB/Postgres user.
- Add rules to
pg_hba.conf
to allow nodes to connect to each other.- Ensure that these lines are present in
pg_hba.conf
:
- Ensure that these lines are present in
- Add a
.pgpass
file to allow nodes to authenticate each other.- Configure a user with sufficient privileges to be able to log into the other nodes.
- See The Password File in the Postgres documentation for more on the
.pgpass
file.
- Add the BDR extension (
- Restart the server.
- Verify the restarted server is running with the modified settings and that the BDR extension is available.
- Create the replicated database.
- Log in to the server's default database (
edb
for EDB Postgres Advanced Server,postgres
for EDB Postgres Extended Server and community Postgres). - Use
CREATE DATABASE bdrdb
to create the default PGD replicated database. - Log out and then log back in to
bdrdb
. - Use
CREATE EXTENSION bdr
to enable the BDR extension and PGD to run on that database.
- Log in to the server's default database (
The worked example that follows explores these steps in detail for EDB Postgres Advanced Server.
If you're installing PGD with EDB Postgres Extended Server or community Postgres, the steps are similar, but details such as package names and paths are different. These differences are summarized in Installing PGD for EDB Postgres Extended Server and Installing PGD for Postgresql.
Worked example
Install the packages
The first step is to install the packages. For each Postgres package, there's an edb-bdr4-<postgresversion>
package to go with it.
For example, if you're installing EDB Postgres Advanced Server (epas) version 14, you install edb-bdr4-epas14
.
There in one other packages to also install:
edb-pgd-cli
for the PGD command line tool
To install all of these packages on a RHEL or RHEL-compatible Linux, run:
Ensure the database is initialized and started
If it wasn't initialized and started by the database's package initialization (or you're repeating the process), you need to initialize and start the server.
To see if the server is running, you can check the service. The service name for EDB Advanced Server is edb-as-14
, so run:
If the server isn't running, the response is: