Configuring

Suggest edits

Prerequisites

  • The database host with the EDB Postgres Advanced Server environment needs the following components:

    • IBM supported operating system for Spectrum Protect clients

    • IBM Spectrum Protect BA client (used for regular file backup)

    • IBM Spectrum Protect API client

    • EDB Postgres Advanced Server version 10 or later

    • Repostor Data Protector client

  • A PostgreSQL user must be defined for use with the RDP.

    • This user must be able to connect to EDB Postgres Advanced Server and have sufficient permissions for database backup and restore.

    • This user needs access to local Spectrum Protect files to read configuration files and to write to log files.

      Note

      If the user isn't the same user that owns the PostgreSQL server process, make sure that the server process owner has the correct SP client file access so they can execute archive_command.

  • A Spectrum Protect node must be defined in the Spectrum Protect server environment in a management class that suits the needs of the DBA team.

  • The Spectrum Protect client details for setting up connection to Spectrum Protect server must be available, including the client Spectrum Protect password.

Installing and configuring Repostor Data Protector for PostgreSQL

The high-level steps for installing and configuring the integration are:

  1. Configure local Spectrum Protect configuration files.
  2. Install Repostor Data Protector client.
  3. Verify the connection to PostgreSQL psql.
  4. Configure PostgreSQL archive_command to use logwriter.
  5. Set up a backup script.

Configure the local Spectrum Protect configuration files

Configure the local Spectrum Protect configuration files with details needed to connect to Spectrum Protect server.

  1. Create a Spectrum Protect options file with the logical server name.

  2. Edit the dsm.sys file by adding a section for the new logical server name for this Spectrum Protect node with connection details.

  3. Create soft links from the API directory to the ba clients bin directory for dsm.sys and dsm.opt. This example uses dsm.postgres.opt Spectrum Protect options for the filename:

     ln -s /opt/tivoli/tsm/client/ba/bin/dsm.sys
         /opt/tivoli/tsm/client/api/bin64/dsm.sys
     ln -s /opt/tivoli/tsm/client/ba/bin/dsm.postgres.opt
         /opt/tivoli/tsm/client/api/bin64/dsm.opt

    Here's the listing (ls -l command) from the API directory for this example showing the links:

     dsm.opt -> /opt/tivoli/tsm/client/ba/bin/dsm.postgres.opt
     dsm.sys -> /opt/tivoli/tsm/client/ba/bin/dsm.sys
  4. Set the DSMI_CONFIG variable for the OS user that runs the RDP tools, preferably the same user that owns the PostgreSQL server process.

  5. Verify that the OS user can connect to Spectrum Protect server, which also verifies correct file access to local SP files:

    dsmc q session -se=XXX

    Where ‘XXX’ is your logical server name.

Install the Repostor Data Protector client

  1. Verify that IBM Spectrum Protect clients for API and BA are already installed. For example:

     rpm -aq | grep TIV
     TIVsm-API64-8.1.8-0.x86_64
     TIVsm-BA-8.1.8-0.x86_64
  2. Install RDP. (Verify that you have the latest version on www.repostor.com.)

    rpm -ivh rdp4Postgres-4.4.4.0-31.x86_64

    If you're on Ubuntu, you need to prepare the package with the alien tool:

     sudo apt-get install alien
     sudo alien rdp4Postgres-4.4.4.0-31.x86_64.rpm
     sudo dpkg -I rdp4Postgres-4.4.4.0-31.deb
  1. Install the license file. The license.dat file should be placed in the Repostor /opt/repostor/rdp4Postgres/etc directory. If no license is available yet, a trial license is generated the first time you run a backup. This trial license needs to be cleared with a special UNLOCK key before changing to a contract license.

  2. Add the Repostor bin directory to the PATH. All users that run RDP commands need to have the PATH set to include the Repostor bin directory. The path is /opt/repostor/rdp4Postgres/bin.

Verify the connection to PostgreSQL psql

The user used with the -u option to the RDP commands must be able to connect to PostgreSQL and be allowed to back up/restore databases.

For example, to verify the connection for user enterprisedb:

    psql -U enterprisedb -l

Configure PostgreSQL archive_command to use logwriter

If your PostgreSQL environment has WAL activated and you plan to back up PostgreSQL on the instance level (-f option with RDP), then you need to configure the PostgreSQL archive_command to run the RDP logwriter.script.

For example, this is a sample specification of the archive_command in the postgresql.conf file:

    archive_command =
    ‘/opt/repostor/rdp4Postgres/bin/logwriter.script -v -S instName
    -s “%p” -d %f’
Note

The instance name you specify with the -S option must be the same as the one you use with the RDP postgresbackup command. The logwriter.script is a script that calls the logwriter binary. It's a script to allow for local configuration if you want to set a specific environment before running the logwriter.

Set up a backup script

If you run postgresbackup from a script that initiated from Spectrum Protect scheduler, set LOGNAME.

In this example, the paths and filenames are unique to each installation:

    #!/bin/bash
    #

    ### Set PATH & DSMI_CONFIG
    export PATH=$PATH:/opt/repostor/rdp4Postgres/bin
    export DSMI_CONFIG=/opt/tivoli/tsm/client/ba/bin/dsm.postgres.opt

    ### Set LOGNAME
    export LOGNAME=enterprisedb

    ### Run postgresbackup command, send output to logfile under /tmp
    postgresbackup -u enterprisedb -f -z -v >/tmp/postgresbackup.log 2>&1

Could this page be better? Report a problem or suggest an addition!