Skip to main content
Version 4.0.0

High Availability Agent Configuration

Below are the necessary commands to configure the High Availability Agent in the PostgreSQL Ecosystem:

Prerequisites
note

In a high availability environment, it is recommended to use dedicated servers for each component.

Command Syntax
Terminal input
    pgsmart ha agent config [Flags]

Flags:

  • -h, --help => Help
Non-Interactive Configuration

Non-interactive execution is disabled for this operation.

Interactive Configuration
  1. Select the PgSmart Agent (or Register new Agent).

  2. Enter the name of the High Availability Environment.

  3. Identify the Server.

Connection Data Configuration for High Availability Agent:

  1. Identify the network interface to be used internally by the High Availability Agent.

  2. Identify the port to be used by the High Availability Agent.

Connection Data Configuration for the Repository

  1. Confirm if the Distributed Configuration Store (DCS) has already been configured (prerequisite):

    3.1. Enter the IP address of the DCS for client requests.

    3.2. Enter the port of the DCS for client requests.

    3.3. Confirm if you wish to add another server to compose the Distributed Configuration Store and update its data if affirmative.

PostgreSQL Instance Data Configuration

  1. Enter the Instance data:

    4.1. Enter the network interface for monitoring the PostgreSQL instance.

    4.2. Enter the network interface for access to the PostgreSQL instance.

    4.3. Confirm the existence of the PostgreSQL instance.

    4.4. Select the data directory of the PostgreSQL instance.

    4.5. Enter the transaction log directory WALDIR.

    4.6. Enter the password file directory (PGPASS).

    4.7. Confirm the existence of a MASTER PostgreSQL instance in the high availability environment.

Instance User Configuration

  1. Enter Instance User data:

    5.1. Enter the replication user name.

    5.2. Enter the replication user password.

    5.3. Confirm if the replication user (replication role) already exists in the PostgreSQL instance.

    5.4. Enter the high availability agent user name.

    5.5. Enter the high availability agent user password.

    5.6. Confirm if the high availability agent (SUPERUSER role) already exists in the PostgreSQL instance.

Instance Operation Rules Configuration

  1. Enter the Operation Rules:

    6.1. Confirm if the PostgreSQL instance can be promoted to MASTER in a failover.

    6.2. Confirm if the PostgreSQL instance can be cloned to automatically recreate other instances (requires template(s)).

    6.3. Confirm if synchronous replication is allowed.

PostgreSQL Instance Template Configuration

  1. If cloning is confirmed, PgSmart will proceed to Template Configuration:

    7.1. Enter the default character encoding ENCODE.

    7.2. Enter the default regional representation for dates and monetary values (LOCALE).

    7.3. Confirm enabling Checksum for data pages.

    7.4. Select the network interface for data replication.

    7.5. Confirm if you want to inform another PostgreSQL server(s) that compose(s) the High Availability Environment.

    7.5.1. If yes, provide the IP address of the server(s).

    7.6. Confirm if you wish to specify the proxy server for the High Availability Environment.

    7.6.1. If yes, provide the IP address of the proxy server(s).

Template Access Rules Configuration

  1. Confirm if you want to include access rules for applications in the initialization template. If affirmative:

    8.1. Select the Access Rule Type.

    8.2. Enter the Database(s).

    8.3. Enter the User(s) or Group(s).

    8.4. Enter the Hostname or IP/CIDR authorized.

    8.5. Select the authentication method.

Template Users Configuration

  1. Confirm if you want to include users in the initialization template. If affirmative:

    9.1. Enter the user name.

    9.2. Enter the user password.

    9.3. Select the user privileges [createrole (create users) or createdb (create database)].

Service Activation

  1. Activate the Service:

    10.1. Confirm saving the High Availability Agent configuration.

    10.2. Confirm creating the replicator user in the PostgreSQL instance.

    10.3. Confirm creating the patroni user in the PostgreSQL instance.

    10.4. Confirm defining the necessary access rules for the High Availability environment in the PostgreSQL instance.

    10.5. Confirm RELOAD of the instance to apply the access rules.

    10.6. Confirm starting the High Availability Agent service:

    Figure 1 - High Availability - Agent - Configuration
    Figure 1 - High Availability - Agent - Configuration