Skip to main content
Version 3.1.1

High Availability Service Installation

The PostgreSQL Ecosystem components that PgSmart integrates with to provide the high availability service are: Patroni, etcd and HAProxy.

Prerequisites
  • Install PgSmart, observing the minimum requirements .

  • A repository of extra packages is required to resolve indirect dependencies. In accordance with the security and support policies of each organisation, Tecnisys does not provide such packages. For distributions in the Enterprise Linux family, the Extra Packages for Enterprise Linux - EPEL generally provides the necessary indirect dependencies.

  • Start the PgSmart Agent service on all machines in the database environment..

    Terminal input
        systemctl start pgsmart-agent
  • Log in as the PgSmart local user, for example:

    Terminal input
        su - PgSmart
  • PgSmart's PgSmart Agent Registry via PgSmart-Client.

warning

We recommend dedicated servers for each component of the High Availability service.

warning

The High Availability Agent, represented by the Patroni component, must be installed on the same server as the Database Service, represented by the PostgreSQL component.

Command Syntax
Terminal input
    pgsmart install -a <value> --service ha --ha-components={agent|dcs|proxy) [Flags]

Flags:

  • -M, --pgversion=(11/12/13/14/15) => Default: 15. => Major version of PostgreSQL, regardless of the service. The latest release of the selected major version will be used.
  • -a, --agent= <agent>. => Alias, hostname or IP of the server where a PgSmart Agent is installed.
  • -h, --help. => Help.
  • -q, --quiet. => Non-interactive execution to install service components. Used together with --service, --pg-major-version, --agent.
  • --ha-components=(agent|dcs|proxy). => Components of the High Availability service. Used in conjunction with the --quiet, --service=ha and --agent options. Where
    • agent => High Availability Agent
    • dcs => Distributed Configuration Repository
    • proxy => High Availability Proxy
Non-Interactive Installation

This installation mode is enabled by the quiet option (--quiet, -q) and its execution uses default values for unspecified parameters. However, this option is disabled during the first installation due to the need to create the PostgreSYS package repository based on information requested interactively.

Terminal input
    pgsmart install =q -a <value> --service=ha --ha-components={agent|dcs|proxy)
Figure 1 - HA Installation - Non Interactive
Figure 1 - HA Installation - Non Interactive
Interactive installation
Terminal input
    pgsmart install
  1. Select the PgSmart Agent (or Register a new Agent).

  2. Select High Availability service.

  3. Select the Major version of environment PostgreSQL.

  4. Select the release of the environment PostgreSQL majority version.

  5. Select the desired High Availability component to be installed (agent|dcs|proxy).

  6. Confirm the installation.

  7. Confirm that you want to install the PostgreSYS package repository.

    note

    This question will not be asked if the pgsys-utils repositories are already present or mapped on the machine.

    Figure 2 - HA Installation - Interactive
    Figure 2 - HA Installation - Interactive

Command variations for interactive installation

Some parameters can be passed in advance in the command; however, without the quiet option (--quiet, -q), the execution remains interactive, with these parameters being used with the default values in the prompts.

Examples:

Terminal input
    pgsmart install --service=ha
Terminal input
    pgsmart install --ha-components=agent
Final Notes
note

The installation process can be traced in the PgSmart log file:

Terminal input
    tail -f /var/log/pgsmart-agent/pgsmart.log
Terminal input
    tail -f /var/log/pgsmart-client/pgsmart.log
note

PgSmart sets environment variables (PGDATA, PGBIN, among others) in the current user's bash_profile file that will be loaded in new sessions. If you want to load these variables immediately, execute the command below after the installation:

Terminal input
    source ~/.bash_profile