27.1. Установка в минимальной среде #

27.1.1. Выполнение предварительных требований #

Убедитесь, что выполнены следующие предварительные требования:

Таблица 27.1. Предварительные требования

Требование

Хост для менеджера

Хост для агента

Платформа

Любая платформа, совместимая с архитектурой x86_64 (AMD64).

Это может быть физический сервер, виртуальная машина или контейнер с доступом в привилегированном режиме.

Ресурсы хоста

2 ядра ЦП, 4 ГБ ОЗУ, 40 ГБ SSD (или больше)

2 ядра ЦП, 2 ГБ ОЗУ, 20 ГБ SSD (или больше)

Операционная система

Любая из следующих ОС:

  • Альт Линукс 10/11/СП 8.2/СП 8.4/СП 10

  • Astra Linux «Смоленск» 1.7/1.8

  • РЕД ОС 7.3/8.2

  • РОСА 2021.1

  • Debian 11/12

  • Red Hat Enterprise Linux 8/9

  • SUSE Linux Enterprise Server 15

  • Ubuntu 20.04/22.04/24.04

Программное обеспечение

(Необязательно) Чтобы включить дополнительную функциональность PPEM, такую как журналирование, мониторинг и сбор метрик, необходимо установить дополнительное программное обеспечение.

Доступ к Интернету

У хоста должен быть выход в Интернет для доступа к репозиториям пакетов Postgres Pro.

Права пользователя

  • Возможность подключаться к хосту от имени пользователя root или любого другого пользователя, который может использовать sudo.

  • Возможность подключаться к СУБД на хосте от имени суперпользователя (как правило, пользователя postgres).


За подробной информацией о требованиях к аппаратному и программному обеспечению обратитесь к Главе 4.

27.1.2. Установка дополнительного программного обеспечения #

Примечание

Это необязательный шаг.

Пропустите его, если функциональность PPEM, перечисленная ниже, не требуется.

На хостах с СУБД и агентами необходимо установить дополнительное программное обеспечение для работы следующей функциональности PPEM:

Это программное обеспечение автоматически обнаруживается агентом, установленным на хосте, и соответствующая функциональность включается автоматически.

27.1.3. Подключение репозитория пакетов #

На хостах с менеджером и агентом подключите репозиторий пакетов Postgres Pro:

  1. Получите ключ доступа к репозиторию:

    1. Откройте свой личный кабинет на портале технической поддержки.

    2. Перейдите на страницу Администрирование → Набор лицензий → Репозитории.

    3. Найдите и скопируйте ключ доступа.

      Ключи доступны только администраторам набора лицензий.

  2. Скачайте bash-скрипт pgpro-repo-add.sh:

    wget --user 'значение_ключа_доступа' --password='' https://repo.postgrespro.ru/ppem/ppem/keys/pgpro-repo-add.sh

    Примечание

    Значение ключа доступа нужно указывать в --user, не в --password. Этот последний параметр должен быть пустым.

    Этот скрипт подключает репозиторий Postgres Pro, чтобы менеджер пакетов операционной системы хоста мог использовать его.

  3. (Необязательно) При необходимости проверьте содержимое скрипта.

  4. Сделайте файл скрипта исполняемым и запустите его:

    
    chmod +x pgpro-repo-add.sh && ./pgpro-repo-add.sh
    
    

    Скрипт установит ключи GPG Postgres Pro, подключит репозиторий и настроит менеджер пакетов.

  5. При запросе введите указанные выше учётные данные для доступа:

    Важно

    Если учётные данные не предоставлены или неверны, скрипт предлагает добавить репозиторий без учётных данных.

    Если вы решите подключить репозиторий без учётных данных, вам потребуется вручную ввести их позже для доступа к репозиторию.

27.1.4. Установка менеджера #

На хосте менеджера:

  1. Подключите репозиторий пакетов Postgres Pro, если он ещё не подключён.

  2. Установите двоичные пакеты ppem и ppem-gui с помощью менеджера пакетов операционной системы.

  3. Создайте базу данных репозитория PPEM:

    1. От имени суперпользователя СУБД (например, postgres) создайте пользователя ppem, который будет владельцем базы данных репозитория. Используйте параметр --pwprompt, только если необходимо задать пароль для этого пользователя:

      sudo -u postgres createuser --pwprompt ppem

      Если используется параметр --pwprompt, при запросе пароля введите пароль для пользователя ppem.

    2. От имени суперпользователя СУБД (например, postgres) создайте базу данных репозитория с пользователем ppem в качестве владельца:

      sudo -u postgres createdb -O ppem ppem
    3. Убедитесь, что владелец базы данных может подключиться к базе данных репозитория ppem:

      sudo -u ppem psql

      При успешном соединении должно отобразиться приглашение psql.

      Если СУБД установлена с нестандартными значениями параметров, может потребоваться скорректировать параметры аутентификации.

      За подробной информацией обратитесь к разделам Подключения и аутентификация и Аутентификация клиентского приложения официальной документации Postgres Pro.

  4. В файле конфигурации менеджера укажите учётные данные для базы данных репозитория:

    repo:
      url: "postgres:///ppem?user=ppem&password=пароль_пользователя_ppem"

    Где пароль_пользователя_ppem — это пароль, заданный на шаге 3a.

    Как правило, конфигурация располагается в файле /etc/ppem-manager.yml.

    Если найти файл конфигурации не удаётся, попробуйте поискать его или создать заново с помощью менеджера пакетов.

  5. Включите и запустите службу менеджера:

    systemctl enable --now ppem
  6. Убедитесь, что службы работают корректно:

    systemctl status ppem

Примечание

Если используется другая система инициализации, скорректируйте соответствующие команды при необходимости.

27.1.5. Доступ к веб-приложению PPEM #

Для взаимодействия с менеджером агенту требуется API-ключ.

Чтобы получить ключ, используйте веб-приложение PPEM:

  1. В веб-браузере перейдите по следующему URL:

    http://адрес_хоста_менеджера_PPEM:8080/
  2. На странице авторизации введите имя пользователя admin, заданное по умолчанию, и пароль admin, затем нажмите Войти.

  3. В навигационной панели перейдите в Главная.

  4. На странице отобразится инструкция по установке агента. Скопируйте ключ из инструкции.

  5. Если инструкция по установке агента случайно закрылась:

    1. В навигационной панели перейдите в Инфраструктура → Агенты.

    2. В столбце Ключ аутентификации рядом с любым агентом нажмите , чтобы скопировать ключ.

27.1.6. Установка агента #

Чтобы СУБД управлялась через PPEM, агент должен быть установлен на хосте СУБД.

В целях упрощения в этом руководстве по быстрому старту предполагается, что агент будет работать от имени суперпользователя СУБД postgres без необходимости явно предоставлять права выделенному пользователю агента.

Предупреждение

Используйте этот подход только в целях оценки и тестирования.

В производственных средах создайте отдельного пользователя агента и предоставьте ему минимальный набор прав.

Чтобы установить агент на хосте СУБД:

  1. Подключите репозиторий пакетов Postgres Pro, если он ещё не подключён.

  2. Установите двоичный пакет ppem-agent с помощью менеджера пакетов операционной системы.

  3. В файле конфигурации агента /etc/ppem-agent.yml укажите значения для следующих параметров:

    • agent.manager.api_key: ранее полученный API-ключ для подключения агента к менеджеру.

    • agent.manager.url: URL для подключения агента к менеджеру.

      Пример: http://ppem.example.com:8080/v1.

    • agent.instance.connection_defaults: учётные данные суперпользователя (как правило, пользователя postgres) СУБД, которой будет управлять PPEM.

      Параметр password необязательный. Используйте его, только если необходимо установить пароль для подключения к СУБД.

    При необходимости используйте пример файла конфигурации агента.

  4. Включите и запустите службу агента:

    systemctl enable --now ppem-agent
  5. Убедитесь, что служба запущена и работает:

    systemctl status ppem-agent

Примечание

Если используется другая система инициализации, скорректируйте соответствующие команды при необходимости.

27.1.7. Проверка установки #

После выполнения всех действий, описанных в предыдущих разделах, проверьте установку:

  1. Войдите в веб-приложение PPEM, как описано в Подразделе 27.1.5.

  2. В навигационной панели перейдите в Инфраструктура → Экземпляры.

  3. Убедитесь, что ваш экземпляр Postgres Pro отображается в списке управляемых экземпляров базы данных.

PPEM успешно установлен в минимальной среде. Теперь экземпляром базы данных можно управлять через веб-приложение.

27.1. Installation in the Minimal Environment #

27.1.1. Meeting Prerequisites #

Ensure that the following prerequisites are met:

Table 27.1. Prerequisites

Prerequisite

Host for manager

Host for agent

Platform

Any platform that is compatible with the x86_64 (AMD64) architecture.

It can be either a physical server, a virtual machine, or a container that can be accessed in privileged mode.

Host resources

2 CPU cores, 4 GB RAM, 40 GB SSD (or higher)

2 CPU cores, 2 GB RAM, 20 GB SSD (or higher)

Operating system

Any of:

  • Alt Linux 10/11/SP 8.2/SP 8.4/SP 10

  • Astra Linux Smolensk 1.7/1.8

  • Red OS 7.3/8.2

  • ROSA 2021.1

  • Debian 11/12

  • Red Hat Enterprise Linux 8/9

  • SUSE Linux Enterprise Server 15

  • Ubuntu 20.04/22.04/24.04

Software

(Optional) Additional software must be installed to enable more PPEM features, such as logging, monitoring, and metrics collection.

Internet access

The host must have Internet access to reach the Postgres Pro package repositories.

Privileged user

  • Ability to connect to the host on behalf of the root user or any other user who can use sudo.

  • Ability to connect to the DBMS on the host on behalf of the superuser (typically the postgres user).


For more information about hardware and software requirements, refer to Chapter 4.

27.1.2. Installing the Additional Software #

Note

This is an optional step.

Skip it if you do not need the PPEM features listed below.

PPEM requires the additional software to be installed on the hosts with DBMS and agents for the following PPEM features to operate:

This software is automatically detected by the agent installed on the host, and the related features are enabled automatically.

27.1.3. Adding the Package Repository #

On both the manager and agent hosts, add the Postgres Pro package repository:

  1. Get the access key for the repository:

    1. Open your personal account in the technical support portal.

    2. Go to Administration → License Set → Repositories.

    3. Locate and copy the access key.

      Access keys are available only to license set administrators.

  2. Download the pgpro-repo-add.sh Bash script:

    wget --user 'access_key_value' --password='' https://repo.postgrespro.com/ppem/ppem/keys/pgpro-repo-add.sh
    

    Note

    Specify the access key value in --user, not --password. The latter option must be empty.

    This script adds the Postgres Pro repository so that the package manager of the host operating system can use it.

  3. (Optional) Examine the content of the script, if necessary.

  4. Make the script file executable and run it:

    
    chmod +x pgpro-repo-add.sh && ./pgpro-repo-add.sh
    
    

    The script will install the Postgres Pro GPG keys, add the repository, and configure the package manager.

  5. When prompted, enter the same access credentials as above:

    Important

    If no credentials are provided or they are invalid, the script offers to add the repository without credentials.

    If you proceed without credentials, you must manually provide the credentials later in order to access the repository.

27.1.4. Installing the Manager #

On the manager host:

  1. Add the Postgres Pro package repository, if not added yet.

  2. Install the ppem and ppem-gui binary packages using the package manager of the operating system.

  3. Create the PPEM repository database:

    1. On behalf of the DBMS superuser (e.g., postgres), create the ppem user who will own the repository database. Use the --pwprompt option only if you want to set a password for this user:

      sudo -u postgres createuser --pwprompt ppem
      

      If you used --pwprompt, enter a password for the ppem user when prompted.

    2. On behalf of the DBMS superuser (e.g., postgres), create the repository database with the ppem user as its owner:

      sudo -u postgres createdb -O ppem ppem
      
    3. Verify that the database owner can connect to the ppem repository database:

      sudo -u ppem psql
      

      The psql prompt must be displayed, indicating the successful connection.

      If the DBMS is installed with non-default settings, you may need to adjust the authentication parameters.

      For more information, refer to the Connections and Authentication and Client Authentication sections of the official Postgres Pro documentation.

  4. Specify the access credentials for the repository database in the manager configuration file:

    repo:
      url: "postgres:///ppem?user=ppem&password=ppem_user_password"
    

    Where ppem_user_password is the password set at step 3a.

    Usually the configuration is located in the /etc/ppem-manager.yml file.

    If you cannot locate the configuration file, try to locate or recreate it using the package manager.

  5. Enable and start the manager service:

    systemctl enable --now ppem
    
  6. Verify that the services are running correctly:

    systemctl status ppem
    

Note

If another initialization system is used, adjust the relevant commands as needed.

27.1.5. Accessing the PPEM Web Application #

The agent requires an API key to interact with the manager.

Access the PPEM web application to obtain the key:

  1. In a web browser, go to the following URL:

    http://PPEM_manager_host_address:8080/
    
  2. On the authorization page, enter the default admin username and admin password, then click Log in.

  3. In the navigation panel, go to Summary.

  4. The agent installation instruction will be displayed on the page. Copy the key from the instruction.

  5. If the agent installation instruction was accidentally closed:

    1. In the navigation panel, go to Infrastructure → Agents.

    2. In the Authentication key column next to any agent, click to copy the key.

27.1.6. Installing the Agent #

For a DBMS to be managed by PPEM, the agent must be installed on the DBMS host.

For the sake of simplicity, it is assumed in the quick start guide that the agent will operate on behalf of the postgres DBMS superuser, without the need to explicitly grant privileges to a dedicated agent user.

Warning

Use this approach only for evaluating and testing purposes.

In production environments, create a separate agent user and grant a minimal set of privileges to it.

To install the agent on the DBMS host:

  1. Add the Postgres Pro package repository, if not already added.

  2. Install the ppem-agent binary package using the package manager of the operating system.

  3. In the /etc/ppem-agent.yml agent configuration file, specify values for the following parameters:

    • agent.manager.api_key: The previously obtained API key for connecting the agent to the manager.

    • agent.manager.url: The URL for connecting the agent to the manager.

      Example: http://ppem.example.com:8080/v1.

    • agent.instance.connection_defaults: The credentials of the superuser (typically postgres) of the DBMS that PPEM will manage.

      The password parameter is optional. Use it only if you want to set a password for the DBMS connection.

    If necessary, use the sample agent configuration file as a reference.

  4. Enable and start the agent service:

    systemctl enable --now ppem-agent
    
  5. Ensure that the service is up and running:

    systemctl status ppem-agent
    

Note

If another init system is in use, correct the related commands as necessary.

27.1.7. Verifying the Installation #

After completing the steps described in the previous sections, verify the installation:

  1. Log in to the PPEM web application as described in Section 27.1.5.

  2. In the navigation panel, go to Infrastructure → Instances.

  3. Verify that your Postgres Pro instance appears in the list of managed database instances.

You have successfully installed PPEM in a minimal environment. The database instance can now be managed through the web application.

FAQ