5.5. Instances #

This section explains how to manage instances. It includes the following instructions:

Creating an Instance

Agents automatically discover hosts, instances, instance objects, and other components installed on the server and create them in the web application. You can configure the automatic discovery in the ppem-agent.yml agent configuration file.

Note

The automatic discovery and a number of other features are not supported when PPEM is installed in a secure environment.

PPEM provides the following ways of creating instances:

Creating a New Instance

Creating a new instance includes creating a new main data catalog and starting the instance service on the server.

To create a new instance:

  1. In the navigation panel, go to InfrastructureInstances.

  2. In the top-right corner of the page, click Add instance.

  3. Select Create a new instance, and then click Next.

  4. Enter parameters of the new instance (parameters marked with an asterisk are required):

    • Name.

    • Server: The server where the instance is installed.

    • System user: The OS user who will own the instance files and catalogs and on behalf of which the instance service will run. In most cases, it is the postgres user.

      Ensure that the specified user exists in the OS.

    • Main data directory: The path to the server catalog where the main instance catalogs and files will be located.

    • Connection address and Connection port: The network address and port number that the instance will use for receiving client connections.

    • Authentication method: The authentication method that the instance will use to verify users when receiving client connections.

      Possible values:

      • scram-sha-256.

      • md5.

      • trust: Do not perform authentication.

        It is recommended to select this value only for test environments.

    • DB super user and Super user password: The name and password of the DBMS user that will be created and on behalf of which the agent will connect to the instance.

      The default DBMS user name is postgres.

    • Tags: The tags that will be assigned to the instance.

    • Configuration preset: The configuration preset that will be applied to the instance.

      Possible values:

      • : Do not apply a configuration preset to the instance.

      • Settings for 1C: Apply the 1C configuration preset to the instance.

      • Settings for OLTP: Apply the OLTP (Online Transaction Processing) configuration preset to the instance.

      You can apply another configuration preset to the instance later.

    • Start instance after creation: Specifies whether the instance service starts after instance creation.

  5. Click Execute.

Adding an Existing Instance

You may need to add an existing instance if the automatic discovery of instances installed on the server is disabled.

Before performing this instruction, ensure that the instance is running on the server and is ready to receive client connections.

To add an existing instance:

  1. In the navigation panel, go to InfrastructureInstances.

  2. In the top-right corner of the page, click Add instance.

  3. Select Add an existing instance, and then click Next.

  4. In Instance parameters, enter parameters of the instance (parameters marked with an asterisk are required):

    • Name.

    • Server: The server where the instance is installed.

    • Main data directory: The path to the server catalog where the main instance catalogs and files will be located.

    • Connection address and Connection port: The network address and port number that the instance uses for receiving client connections.

    • DB super user and Super user password: The name and password of the DBMS user on behalf of which the agent will connect to the instance.

      The default DBMS user name is postgres.

    • Tags: The tags that will be assigned to the instance.

  5. Click Execute.

Creating an Instance from a Backup

For more information about backups, refer to Backup.

Before performing this instruction, create a backup.

To create an instance from a backup:

  1. In the navigation panel, go to InfrastructureInstances.

  2. In the top-right corner of the page, click Add instance.

  3. Select Create from backup, and then click Next.

  4. Enter parameters of the backup from which the instance will be created (parameters marked with an asterisk are required):

    • Catalog: The storage catalog where the backup is located.

    • Instance: The instance for which the backup is created.

    • Period: The time period when the backup was created.

    • Backup: The backup from which the instance will be created.

  5. Click Next, and then enter parameters of the new instance (parameters marked with an asterisk are required):

    • Name.

    • Server: The server where the instance is installed.

    • System user: The OS user who will own the instance files and catalogs and on behalf of which the instance service will run. In most cases, it is the postgres user.

      It is recommended to ensure that the specified user exists in the OS.

    • Main data directory: The path to the server catalog where the main instance catalogs and files will be located.

    • Connection address and Connection port: The network address and port number that the instance will use for receiving client connections.

    • Tags: The tags that will be assigned to the instance.

    • Backup: The backup from which the instance will be created.

      The value is entered automatically.

    • Backup size: The size of the backup from which the instance will be created.

      The value is entered automatically.

    • Restore point: The state to which the instance will be restored.

      Possible values:

      • : Restore the instance to the last state covered by the backup.

      • Time: Restore the instance state to the specified date and time covered by the backup.

        For this value, in Time, specify the date and time.

      • LSN: Restore the instance to the state corresponding to the specified WAL LSN.

        For this value, in LSN, enter the WAL LSN.

      • Transaction: Restore the instance state to the specified transaction number.

        For this value, in Transaction, enter the transaction number.

      For Time, LSN, and Transaction, specify the following parameters:

      • Restore including the specified value: Specifies whether the instance state is restored including the specified value.

        For example, if you enter 123456 in Transaction and enable Restore including the specified value, the instance state is restored to the transaction 123456. Otherwise, the instance state is restored to the 123455 transaction.

      • Action after restore: The action to perform on the server after restoring the instance to the state.

        Possible values:

        • Pause after restore: Pause the creation of the instance from the backup. It allows ensuring that the correct state was restored for the instance before creating it.

        • Promote after restore: Create the instance from the backup and start receiving client connections.

        • Shutdown instance after restore: Create the instance from the backup, and then stop the server.

    • Partial recovery: Specifies the instance databases that will be restored or excluded from the restoration process.

      Possible values:

      • Do not use: Restore all instance databases.

      • Exclude some databases: Exclude the specified databases from restoration.

      • Restore some databases: Restore the specified instance databases.

      For Exclude some databases and Restore some database, specify the unique name of the database using Databases, and then click Add database.

    • Checking available space: Allows checking whether there is enough disk space on the server for creating the instance from the backup.

      To start the check, click Check.

  6. Click Execute.

Viewing Instances

In the navigation panel, go to InfrastructureInstances.

The table of instances with the following columns will be displayed:

  • Name:

    • The unique name of the instance.

    • PostgreSQL version: The version and edition of Postgres Pro on the instance server.

    • Data directory: The path to the server catalog where the main instance catalogs and files are located.

    • Port: The port number that the instance uses for receiving client connections.

  • Server:

    • The FQDM of the instance server.

    • The IP address of the instance server.

    • The status of the instance.

      Possible values:

      • Unknown: The status of the instance is unknown.

      • Initialization scheduled: The instance initialization was scheduled.

      • Initializing: The instance is being initialized.

      • Initialized: The instance is initialized.

      • Restoring: The instance is being created from a backup.

      • Restored: The instance is created from the backup.

      • Restore canceled: The creation of an instance from a backup was canceled.

      • Starting: The instance is being started.

      • Started: The instance is started.

      • Stopping: The instance is being stopped.

      • Stopped: The instance is stopped.

      • Restarting: The instance is being restarted.

      • Reloading: The cluster is being reloaded.

      • Failed: There is an error with the instance.

      • Scheduled for removal: The instance is being deleted.

      • Base backup: A backup is being created for the instance.

      • Agent not responding: The agent installed on the instance server is not responding.

  • Role.

    Possible values:

    • primary: The instance is the primary node of the cluster and replicates data to standby nodes.

    • standby: The instance is a standby node of a replication cluster and receives replicated data from the primary node.

    • cascade: The instance is a standby node of a streaming replication cluster. It receives replicated data from the main node and provides data replication to other standby nodes simultaneously.

    • maintenance: The instance is a separate node and is not added to a replication cluster.

    For more information about data replication, refer to the official Postgres Pro documentation.

  • DB:

    • Database: Unique names of databases.

    • Transactions per second: The number of transactions per second in the database.

    • Connections: The number of client database connections.

  • Tags: The tags assigned to the instance.

Checking the Consistency of an Instance Catalog

The catalog consistency check ensures that the main instance files were not damaged during storage.

To check the consistency of an instance catalog:

  1. In the navigation panel, go to InfrastructureInstances.

  2. Click Check directory integrity next to the instance.

  3. Click Run.

To view the result, in the navigation panel, go to Tasks console and click Show log next to the task that was automatically created for checking the consistency of the instance catalog.

Stopping and Starting an Instance

  1. In the navigation panel, go to InfrastructureInstances.

  2. Click Stop or Run next to the instance.

  3. To stop an instance, click Stop.

Restarting an Instance

  1. In the navigation panel, go to InfrastructureInstances.

  2. Click Restart next to the instance.

  3. Click Restart.

Creating a Backup

For more information about backups, refer to Backup.

To create a backup:

  1. In the navigation panel, go to InfrastructureInstances.

  2. Click Create backup next to the instance.

  3. Enter parameters of the new backup (parameters marked with an asterisk are required):

    • Instance: The instance for which the backup will be created.

      The value is entered automatically.

    • Copy storage: The storage where the backup will be located.

      You can select a local or S3 storage. The local storage must be located on the same server as the instance for which you are creating the backup.

    • User and Password: The name and password of the DBMS user under which the backup will be performed.

    • Database: The database for connecting to the instance.

    • Backup mode: The backup creation mode.

      Possible values:

      • full

      • page

      • ptrack

      • delta

      For more information about backup modes, refer to the official Postgres Pro documentation on pg_probackup.

    • Threads count: The number of parallel threads that will be started at backup creation.

    • Waiting time (sec): The waiting timeout in seconds for WAL segment archiving and streaming.

    • Create a stand-alone backup: Specifies whether to create a streaming backup that includes the WAL records required for restoring the instance later.

    • Replication slot: The replication slot that will be used for transferring WAL records.

    • Create temporary replication slot: Specifies whether to create a temporary replication slot for transferring WAL records of the instance for which you are creating the backup.

      If you enable this checkbox, WAL segments are available even when they are switched at backup creation.

  4. Click Next, and then specify additional parameters if required:

    • External catalogs: The path to the instance catalog that will also be included in the backup.

    • include log catalog: Specifies whether the backup includes the catalog with the instance activity logs.

    • Don’t check copy: Specifies whether to skip the automatic verification of the created backup.

      If you enable this checkbox, the backup is created faster.

    • Smooth execution of the checkpoint: Specifies whether backup creation starts only after the scheduled checkpoint.

    • Disable block-level verification: Specifies whether to disable the block-level checksum verification for faster consistency checking at backup creation.

    • Compression level: The file compression level at backup creation.

      You can enter a value from 0 to 9, where 0 disables file compression, and 9 enables the highest file compression level.

    • Compression algorithm: The algorithm used for compressing files.

      Possible values:

      • zlib

      • lz4

      • zstd

      • pglz

      This parameter is available only if you enter a value greater than 0 in Compression level.

    • Pinning: The pinning parameters of the backup.

      Possible values:

      • Do not pin: Do not pin the backup.

        If you select this value, the parameters specified in Parameters of storing are used.

      • ttl: After the backup is created, it cannot be deleted from a storage during the specified number of days.

        For this value, in Retention period, days, enter the number of days.

      • expire-time: The backup cannot be deleted from a storage until the specified date and time.

        For this value, in Retention period until, specify the date and time.

    • Storage parameters: The backup storage parameters of the storage catalog created for the instance.

      Available parameters:

      • Retention redundancy: The maximum number of full backups.

        For example, if you specify 3, the catalog can contain a maximum of three full backups.

        To disable this limitation, specify 0. In this case, the number of backups in the catalog is not limited.

      • Retention window: The number of days (24 hours) covered by backups. For example, if you specify 7, the catalog must always contain backups required for restoring the data for the last seven days, including today.

        To disable this limitation, specify 0. In this case, backups can be deleted from the catalog at any moment.

      • WAL depth: The minimum number of backups on each timeline. Having backups on all timelines is required for point-in-time recovery (PITR).

        For example, if you specify 3, the catalog must always contain at least three backups on each timeline.

        To disable this limitation, specify 0. In this case, point-in-time recovery is not available.

      • Expired copies: The management policy for expired backups.

        Possible values:

        • Merge: Merge expired backups with new ones if possible.

        • Delete: Delete expired backups from the catalog.

        • Remove expired WAL: Delete WAL of expired backups from the catalog.

        You can enable all checkboxes simultaneously.

      Retention redundancy, Retention window, and WAL depth are applied only if you enable Merge and/or Delete for Expired copies.

      The values of Retention redundancy and Retention window are considered simultaneously when deleting expired backups from the catalog. For example, if you enter 3 in Retention redundancy and 7 in Retention window, a maximum of three full backups are saved, as well as all backups required for restoring the data for the past 7 days, including today.

      You can also configure storage parameters for an instance, as well as for a storage when creating or editing it.

      The following priority is applied:

      • backup parameters are applied first

      • instance parameters are applied second

      • storage parameters are applied third

      For more information about storage parameters, refer to the official Postgres Pro documentation on pg_probackup.

  5. Click Execute backup.

Applying a Configuration Preset to an Instance

You can apply another configuration preset to an instance.

Important

When you apply a configuration preset, the instance can be automatically restarted if it is required for changes to take effect.

To apply a configuration preset to an instance:

  1. In the navigation panel, go to InfrastructureInstances.

  2. Click Configuration presets next to the instance.

  3. Select a new configuration preset.

  4. Click Apply.

Editing an Instance

You can select the repository instance when editing an instance.

To edit an instance:

  1. In the navigation panel, go to InfrastructureInstances.

  2. Click Edit next to the instance.

  3. Edit instance parameters.

  4. Click Save.

Selecting a Repository Instance

The repository database is located in an instance. Similarly to other instances, you can create this instance in the web application.

In the web application, you must manually specify the instance where the repository database is located.

To select the repository instance:

  1. In the navigation panel, go to InfrastructureInstances.

  2. Click Edit next to the instance.

  3. Enable Instance of EM repository.

  4. Click Save.

Deleting an Instance

Important

After deleting the instance from the web application, you must also delete it from the server. Otherwise, the instance will be automatically created in the web application again.

When PPEM is installed in a secure environment, if you delete an automatically created instance, it will not be automatically created anymore. In this case, to restore the instance, you must add it manually.

To delete an instance:

  1. In the navigation panel, go to InfrastructureInstances.

  2. Click Remove from EM next to the instance.

  3. (Optional) To delete the main instance data catalog on the server, enable Delete with data directory.

  4. Confirm the operation and click Delete.