Configuring and Using Pivotal Postgres

Configuring pgBackRest

pgBackrest, an open source backup and restore solution for PostgreSQL, is included with Pivotal Postgres. You can configure PostgreSQL and pgBackRest to set up backup and restore for your Postgres clusters.

Procedure

  1. Install pgBackRest Perl prerequisites.

    $ sudo yum install perl perl-Time-HiRes perl-Digest-SHA perl-JSON-PP
    
  2. Create pgBackRest configuration directories and files.

    $ sudo mkdir -p /etc/pgbackrest
    $ sudo mkdir -p /etc/pgbackrest/conf.d
    $ sudo touch /etc/pgbackrest/pgbackrest.conf
    $ sudo chmod 640 /etc/pgbackrest/pgbackrest.conf
    $ sudo chown postgres:postgres /etc/pgbackrest/pgbackrest.conf
    
  3. Check that pgBackRest is properly installed.

    $ sudo -u postgres pgbackrest
    

    You will see errors if any dependencies are missing.

See the pgBackRest User Guide for help configuring Postgres and pgBackRest, and for backing up and restoring your Postgres clusters.

Configuring Patroni

Pivotal Postgres includes Patroni, a high availability solution for PostgreSQL.

To use Patroni on Red Hat, you must install Python 3 and the Python packages Patroni requires.

Procedure

  1. Install Python 3.

    $ yum install -y python3 python3-devel gcc
    
  2. Create a requirements file for Python packages needed by Patroni.

    $ cat << EOF > requirements.txt
    urllib3>=1.19.1,!=1.21
    boto
    PyYAML
    requests
    six >= 1.7
    kazoo>=1.3.1
    python-etcd>=0.4.3,<0.5
    python-consul>=0.7.0
    click>=4.1
    prettytable>=0.7
    tzlocal
    python-dateutil
    psutil>=2.0.0
    cdiff
    kubernetes>=2.0.0,<=7.0.0,!=4.0.*,!=5.0.*
    EOF
    
  3. Run pip3 with the requirements file you created as input.

    $ pip3 install -r requirements.txt
    

Patroni works with a Distributed Configuration System (DCS) to coordinate multiple Postgres instances, for example, etcd, ZooKeeper, or consul. See the Patroni Documentation for steps to set up and configure Patroni with your chosen DCS.

Configuring psqlODBC

You configure psqlODBC by placing settings into a configuration file, odbc.ini, and then using an ODBC driver manager such as UnixODBC or iODBC to load the configuration file. See 7.3. Configuration Files in the PostgreSQL documentation for information about the ODBC driver configuration settings.

See also psqlODBC - PostgreSQL ODBC driver for additional HOWTOs and release-specific information associated with the driver software.

Configuring pgjdbc

In order to use the pgjdbc driver from a Java application, you must include the driver software in your CLASSPATH as described in Setting up the Class Path. See also the full documentation at The PostgreSQL JDBC Interface for information about initializing and using the JDBC driver in your Java applications.