Дерево страниц

Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.
Комментарий: Published by Scroll Versions from space TMIG and version 7.7
# ----------------------------- # PostgreSQL configuration file # ----------------------------- # # IWTM custom values listen_addresses = '*' port = 5433 max_connections = 1000 # (change requires restart) tcp_keepalives_idle = 60 # TCP_KEEPIDLE, in seconds' tcp_keepalives_interval = 20 # TCP_KEEPINTVL, in seconds' tcp_keepalives_count = 2 # TCP_KEEPCNT shared_buffers = kB huge_pages = try # on, off, or try max_locks_per_transaction = 512 temp_buffers = MB work_mem = MB effective_cache_size = MB min_wal_size = MB max_wal_size = MB
Sv translation
languageru

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

  1. Обновите базу данных до версии, поддерживаемой Traffic Monitor.
  2. Если используется СУБД PostgreSQL или Postgres Pro Enterprise, выполните предварительную настройку.

    Предупреждение
    titleВажно!

    Работа с СУБД Postgres Pro Enterprise поддерживается на ОС Red Hat Enterprise Linux или РЕД ОС.

Настройка СУБД

PostgreSQL

Чтобы подготовить удаленную базу данных соответствующей версии к установке компонентов Traffic Monitor, выполните на сервере базы данных следующие действия:

Раскрыть
titleДля СУБД PostgeSQL
  1. Установите дополнительные пакеты, выполнив команды:

    rpm -Uhv pg

_stat_kcache13-2.1.3-1.rhel7.x86
  1. _

64.rpm
rpm -Uhv pg_
  1. pathman_13-1.5.12-1.rhel7.x86_64.rpm
    rpm -Uhv pgagent_13-4.0.0-4.rhel7.x86_64.rpm

  2. Остановите работу сервисов postgresql и pgagent, используя команды:

    systemctl stop postgresql-13
    systemctl stop pgagent-13

  3. Отредактируйте содержимое файла /etc/systemd/system/postgresql-13.service, заменив в строке Environment=PGDATA= указанную  директорию на /u01/postgres.
    Вы можете сделать это вручную или с помощью следующей команды:

    sed

  1. -i

  1. "s|Environment=PGDATA=/var/lib/pgsql/13.2/data

  1. /|Environment=PGDATA=/u01/postgres/|"

  1. /etc/systemd/system/postgresql-13.service

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

    systemctl

  1. daemon-reload

  2. Создайте директории для файлов и архивов, инициализируйте базу данных и смените директориям владельца и группу на postgres:

    mkdir -p /u01/postgres
    chown postgres:postgres /u01/postgres
    export PGSETUP_INITDB_OPTIONS=" --encoding=UTF8"
    sudo -u postgres /usr/pgsql-13/bin/initdb --encoding=UTF8 --locale=en_US.UTF-8 -D /u01/postgres/
    mkdir -p /u01/postgres/tmp
    chown postgres:postgres /u01/postgres/tmp
    mkdir -p /u02/pgdata
    chown postgres:postgres /u02/pgdata
    mkdir -p /u02/pgdata1
    chown postgres:postgres /u02/pgdata1
    mkdir -p /u02/arch
    chown postgres:postgres /u02/arch

  3. Создайте конфигурационный файл /u01/postgres/iwtm-postgres.conf. Например, с помощью следующей команды:

    touch /u01/postgres/iwtm-postgres.conf

  4. Добавьте в файл /u01/postgres/iwtm-postgres.conf следующее содержимое:

    Блок кода
    languagec#
    # -----------------------------
    # PostgreSQL configuration file
    # -----------------------------
    #
    # IWTM custom values
    listen_addresses = '*'
    port = 5433
    max_connections = 1000 # (change requires restart)
    tcp_keepalives_idle = 60 # TCP_KEEPIDLE, in seconds'
    tcp_keepalives_interval = 20 # TCP_KEEPINTVL, in seconds'
    tcp_keepalives_count = 2 # TCP_KEEPCNT
    shared_buffers = kB
    huge_pages = try # on, off, or try
    max_locks_per_transaction = 512
    temp_buffers =  MB
    work_mem = MB
    effective_cache_size = MB
    min_wal_size = MB
    max_wal_size = MB
    log_min_duration_statement = 120000 # -1 is disabled, 0 logs all statements
    track_activity_query_size = 32768 # (change requires restart)
    log_autovacuum_min_duration = 30000 # -1 disables, 0 logs all actions and
    stats_temp_directory = '/u01/postgres/pg_stat_tmp'
    autovacuum_max_workers = 5
    autovacuum_naptime = 20
    maintenance_work_mem = GB
    autovacuum_freeze_max_age = 1000000000
    shared_preload_libraries = 'pg_stat_statements,pg_
stat_kcache,pg_
  1. pathman'
    track_io_timing = on
    track_activity_query_size = 32768
    constraint_exclusion = off # on, off, or partition
    Предупреждение
    titleВажно!

    В примере содержимого конфигурационного файла указаны пустые поля значений следующих параметров:

    • shared_buffers

    • work_mem

    • maintenance_work_mem

    • effective_cache_size

    • temp_buffers

    • min_wal_size

    • max_wal_size

    Выполните настройки перечисленных параметров в соответствии с официальной инструкцией (доступна на английском языке).

  2. Смените у конфигурационного файла владельца и группу на postgres:

    chown postgres:postgres /u01/postgres/iwtm-postgres.conf

  3. Добавьте в конфигурационный файл /u01/postgres/postgresql.conf ссылку на файл iwtm-postgres.conf с помощью команды:

    echo "include = 'iwtm-postgres.conf'" >> /u01/postgres/postgresql.conf

  4. Настройте файл доступа pg_hba.conf с помощью команд:

    sed -i "s|local[[:space:]]*all[[:space:]]*all[[:space:]]*peer|local   all             all                                     trust|" /u01/postgres/pg_hba.conf
    sed -i "s|host[[:space:]]*all[[:space:]]*all[[:space:]]*127.0.0.1/32[[:space:]]*ident|host    all             all             127.0.0.1/32            trust|" /u01/postgres/pg_hba.conf
    sed -i "s|host[[:space:]]*all[[:space:]]*all[[:space:]]*::1/128[[:space:]]*ident|host    all             all             ::1/128                 trust|" /u01/postgres/pg_hba.conf
    echo "# Enable not local access" >> /u01/postgres/pg_hba.conf
    echo "host    postgres        all             0.0.0.0/0               md5" >> /u01/postgres/pg_hba.conf

  5. Запустите сервис postgresql и проверьте его статус с помощью команд:

    systemctl enable postgresql-13
    systemctl start postgresql-13
    systemctl status postgresql-13

  6. Измените для администратора базы данных пароль по умолчанию:

    su - postgres
    psql -p 5433
    alter user postgres password 'xxXX1234';

  7. Создайте требуемые расширения, выполнив запросы:

    create extension if not exists adminpack;
    create extension if not exists dblink;
    create extension if not exists lo;
    create extension if not exists xml2;
    create extension if not exists tablefunc;
    create extension if not exists intarray;
    create extension if not exists file_fdw;
    create extension if not exists "uuid-ossp";
    create extension if not exists pgcrypto;
    create extension if not exists pgrowlocks;
    create extension if not exists autoinc;
    create extension if not exists hstore;
    create extension if not exists pg_stat_statements;
    create extension if not exists pg_buffercache;
    create extension if not exists pg_

stat_kcache;
create extension if not exists pg_pathman
  1. pathman;
    create extension if not exists pgagent;

  2. Для выхода введите команды:

    \q
    exit

  3. Для настройки в ОС пользователя pgagent выполните команды:

    touch /home/pgagent/.pgpass
    echo "127.0.0.1:5433:postgres:postgres:xxXX1234" > /home/pgagent/.pgpass
    chmod 0600 /home/pgagent/.pgpass
    chown pgagent:pgagent /home/pgagent/.pgpass
    usermod -s /bin/bash pgagent

  4. Создайте или отредактируйте файл /etc/sudoers.d/pgagent, чтобы содержимое соответствовало образцу ниже:

    Блок кода
    languagec#
    # allow pgagent to execute any command
    pgagent ALL = (postgres) NOPASSWD: ALL
    Defaults:pgagent !requiretty
  5. Измените /etc/sudoers.d/pgagent права, владельца и группу, выполнив команды:

    chmod 440 /etc/sudoers.d/pgagent
    chown root:root /etc/sudoers.d/pgagent

  6. Запустите сервис pgagent и проверьте его статус с помощью команд:

    systemctl enable pgagent-13
    systemctl start pgagent-13
    systemctl status pgagent-13

По завершении настройки убедитесь в отсутствии критических ошибок в логах базы данных и /var/log/pgagent-13.log.

Sv translation
languageen

If you plan using a database, which is already deployed, you have to do the following:

  1. Update the database to version, supported by Traffic Monitor.
  2. In case you use PostgreSQL DBMS, make the preliminary configuration.

To prepare a remote database of relevant version so that Traffic Monitor components were installed, the following actions should be taken on database server:

  • Install additional packages, running the commands:
    rpm -Uhv pg_stat_kcache13-2.1.3-1.rhel7.x86_64.rpm
    rpm -Uhv pg_pathman_13-1.5.12-1.rhel7.x86_64.rpm
    rpm -Uhv pgagent_13-4.0.0-4.rhel7.x86_64.rpm
  • Stop postgresql and pgagent services operation using the commands:
    systemctl stop postgresql-13
    systemctl stop pgagent-13
  • Edit the file's content /etc/systemd/system/postgresql-13.service, replacing a specififed directory to /u01/postgres in Environment=PGDATA= line.
  • To apply changes to service configuration, run the command:
    systemctl daemon-reload
  • Create directories for files and archives, initialize the database and change the directory's owner as well as the group to postgres:
    mkdir -p /u01/postgres
    chown postgres:postgres /u01/postgres
    export PGSETUP_INITDB_OPTIONS=" --encoding=UTF8"
    sudo -u postgres /usr/pgsql-13/bin/initdb --encoding=UTF8 --locale=en_US.UTF-8 -D /u01/postgres/
    mkdir -p /u01/postgres/tmp
    chown postgres:postgres /u01/postgres/tmp
    mkdir -p /u02/pgdata
    chown postgres:postgres /u02/pgdata
    mkdir -p /u02/pgdata1
    chown postgres:postgres /u02/pgdata1
    mkdir -p /u02/arch
    chown postgres:postgres /u02/arch
  • Create a configuration file  /u01/postgres/iwtm-postgres.conf. For example, use the command as follows:
    touch /u01/postgres/iwtm-postgres.conf
  • Add to file /u01/postgres/iwtm-postgres.conf the following content:

    Блок кода
    languagec#
    Раскрыть
    titleДля СУБД Postges Pro Enterprise
    Информация
    titleПримечание:

    Шаги инструкции относятся к обеим поддерживаемым ОС. Если действие требуется выполнить только для конкретной ОС, об этом будет сказано в описании.

    1. Остановите работу сервиса postgrespro и pgagent с помощью команды:

      systemctl stop postgrespro-ent-13.service

    2. Скопируйте в директорию /var/lib/pgpro/ent-13/data имеющийся конфигурационный файл iwtm-postgres.conf или создайте там новый со следующим содержимым:

      Блок кода
      languagec#
      # -----------------------------
      # Postgres Pro configuration file
      # -----------------------------
      #
      # IWTM custom values
      
      listen_addresses = '*'
      port = 5433
      max_connections = 1000                     # (change requires restart)
      tcp_keepalives_idle = 60                   # TCP_KEEPIDLE, in seconds'
      tcp_keepalives_interval = 20               # TCP_KEEPINTVL, in seconds'
      tcp_keepalives_count = 2                   # TCP_KEEPCNT
      
      shared_buffers = 128kB
      
      huge_pages = try                           # on, off, or try
      
      max_locks_per_transaction = 512
      temp_buffers = 32MB
      work_mem = 16MB
      effective_cache_size = 4096MB
      
      min_wal_size = 6144MB
      max_wal_size = 6144MB
      lc_messages = 'en_US.UTF-8'                # locale for system error message
      log_directory = 'pg_log'
      log_filename = 'postgresql.log'            # log file name pattern
      log_rotation_age = 0                       # Automatic rotation of logfiles will happen after that time. 0 disables.
      log_rotation_size = 0                      # Automatic rotation of logfiles will happen after that much log output. 0 disables.
      log_min_duration_statement = 120000        # -1 is disabled, 0 logs all statements
      track_activity_query_size = 32768          # (change requires restart)
      log_autovacuum_min_duration = 30000        # -1 disables, 0 logs all actions and
      stats_temp_directory = '/var/lib/pgpro/ent-13/data/pg_stat_tmp'
      
      autovacuum_max_workers = 5
      autovacuum_naptime = 20
      maintenance_work_mem = 1GB
      autovacuum_freeze_max_age = 10000000000
      
      shared_preload_libraries = 'pg_stat_statements,pg_pathman'
      track_io_timing = on
      track_activity_query_size = 32768
      
      constraint_exclusion = off                 # on, off, or partition
      standard_conforming_strings = on
      Предупреждение
      titleВажно!

      В образце содержимого конфигурационного файла указаны примерные значения следующих параметров:

      • shared_buffers

      • work_mem

      • maintenance_work_mem

      • effective_cache_size

      • temp_buffers

      • min_wal_size

      • max_wal_size

      Выполните настройку перечисленных параметров под вашу систему в соответствии с официальной инструкцией.

    3. Добавьте в конфигурационный файл /var/lib/pgpro/ent-13/data/postgresql.conf ссылку на файл iwtm-postgres.conf.
      Вы можете сделать это командой:
      echo "include = 'iwtm-postgres.conf'" >>  /var/lib/pgpro/ent-13/data/postgresql.conf
    4. Отредактируйте файл доступа /var/lib/pgpro/ent-13/data/pg_hba.conf:
      1. После строк:

        Блок кода
        languagecpp
        # IPv6 local connections:
        host    all             all             ::1/128                 md5

        добавьте строку:

        Блок кода
        languagecpp
        host    postgres        all             0.0.0.0/0               md5
        Информация
        titleПримечание:

        Указанные значения подходят для установки Traffic Monitor с параметрами по умолчанию. Если при установке Traffic Monitor вы будете использовать другие значения, укажите их здесь.

      2. Замените строки с помощью команд:

        sed -i "s|host[[:space:]]*all[[:space:]]*all[[:space:]]*127.0.0.1/32[[:space:]]*md5|host    all             all             127.0.0.1/32            trust|" /var/lib/pgpro/ent-13/data/pg_hba.conf
        sed -i "s|local[[:space:]]*all[[:space:]]*all[[:space:]]*peer|local   all             all                                     trust|" /var/lib/pgpro/ent-13/data/pg_hba.conf
    5. Создайте директорию /var/lib/pgpro/ent-13/data/tmp и назначьте ей владельца и группу с помощью команд:
      mkdir -p /var/lib/pgpro/ent-13/data/tmp
      chown postgres:postgres /var/lib/pgpro/ent-13/data/tmp
    6. Раскрыть
      titleЕсли вы выполняете настройку на сервере под управлением РЕД ОС:
      1. Перейдите в директорию:
        cd /usr/lib/systemd/system
      2. Переименуйте сервисный файл:
        mv postgrespro-ent-13.service postgresql-13.service
      3. Перезагрузите сервер:
        reboot
      4. Запустите сервис:
        systemctl start postgresql-13.service
      5. Перейдите в вашу рабочую директорию.
        В нашем примере:
        cd /distr
      6. Скопируйте в директорию прилагаемый в поставке архив iwtm-postgresql-13.8-x.x.x.xxx-redos-73.tar.gz.
      7. Распакуйте архив с помощью команды:
        tar -xvf iwtm-postgresql-13.8-x.x.x.xxx-redos-73.tar.gz
        В нашем примере:
        tar -xvf iwtm-postgresql-13.8-7.7.0.101-redos-73.tar.gz
      8. Перейдите в директорию с содержимым архива.
      9. Установите пакет pgagent_13-4.2.1-1.el7.iw.x86_64.rpm с помощью команды:
        yum install pgagent_13-4.2.1-1.el7.iw.x86_64.rpm
    7. Раскрыть
      titleЕсли вы выполняете настройку на сервере под управлением ОС Red Hat Enterprise Linux:
      1. Запустите сервис:
        systemctl start postgrespro-ent-13.service
      2. Скачайте по ссылке пакет pgagent_13-4.2.1-0.rhel7.x86_64.rpm.
      3. Установите пакет с помощью команды:
        yum install pgagent_13-4.2.1-0.rhel7.x86_64.rpm
    8. Измените для администратора базы данных пароль по умолчанию:

      su - postgres
      psql -p 5433
      alter user postgres password 'xxXX1234';

    9. Создайте требуемые расширения, выполнив запросы:

      create extension if not exists adminpack;
      create extension if not exists dblink;
      create extension if not exists lo;
      create extension if not exists xml2;
      create extension if not exists tablefunc;
      create extension if not exists intarray;
      create extension if not exists file_fdw;
      create extension if not exists "uuid-ossp";
      create extension if not exists pgcrypto;
      create extension if not exists pgrowlocks;
      create extension if not exists autoinc;
      create extension if not exists hstore;
      create extension if not exists pg_stat_statements;
      create extension if not exists pg_buffercache;
      create extension if not exists pg_pathman;
      create extension if not exists pgagent;

    10. Для выхода введите команды:

      \q
      exit

    11. Для настройки в ОС пользователя pgagent выполните команды:

      touch /home/pgagent/.pgpass
      echo "127.0.0.1:5433:postgres:postgres:xxXX1234" > /home/pgagent/.pgpass
      chmod 0600 /home/pgagent/.pgpass
      chown pgagent:pgagent /home/pgagent/.pgpass
      usermod -s /bin/bash pgagent

    12. Создайте /etc/sudoers.d/iw-pgagent со следующим содержимым:

      Блок кода
      languagecpp
      # allow pgagent to execute any command
      pgagent ALL = (postgres) NOPASSWD: ALL
      Defaults:pgagent !requiretty
    13. Измените /etc/sudoers.d/iw-pgagent права, владельца и группу, выполнив команды:

      chmod 440 /etc/sudoers.d/iw-pgagent
      chown root:root /etc/sudoers.d/iw-pgagent

    14. Отредактируйте конфигурационный файл /etc/pgagent/pgagent_13.conf с помощью команд:
      • На ОС Red Hat Enterprise Linux:
        sed -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent_13.conf
        echo "LD_LIBRARY_PATH=/opt/pgpro/ent-13/lib" >> /etc/pgagent/pgagent_13.conf

      • На РЕД ОС:
        sed
         -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent-13.conf
        echo "LD_LIBRARY_PATH=/opt/pgpro/ent-13/lib" >> /etc/pgagent/pgagent-13.conf
    15. Включите сервис pgagent, запустите и проверьте его статус с помощью команд:
      • На ОС Red Hat Enterprise Linux:
        systemctl enable pgagent_13
        systemctl start pgagent_13
        systemctl status pgagent_13

      • На РЕД ОС:
        systemctl enable pgagent-13
        systemctl start pgagent-13
        systemctl status pgagent-13
    16. Создайте директорию /u02:
      mkdir /u02
    17. Смонтируйте в директорию /u02 дисковое хранилище.

    18. Создайте директории для табличных пространств и смените владельца и группу на postgres.:
      mkdir /u02/pgdata
      mkdir /u02/pgdata1
      mkdir /u02/arch
      chown -R postgres:postgres /u02

    По завершении настройки убедитесь в отсутствии критических ошибок в логах базы данных и /var/log/pgagent_13.log или /var/log/pgagent-13.log.

    Sv translation
    languageen


    If you plan using a database, which is already deployed, you have to do the following:

    1. Update the database to version, supported by Traffic Monitor.
    2. In case you use PostgreSQL DBMS, make the preliminary configuration.
    Предупреждение
    titleWarning!

    Working with Postgres Pro Enterprise DBMS is supported only on OS Red Hat Enterprise Linux.

    Configuring DBMS

    To prepare a remote database of relevant version so that Traffic Monitor components were installed, the following actions should be taken on database server:

    Раскрыть
    titleFor PostgeSQL DBMS
    1. Install additional packages, running the commands:

      rpm -Uhv pg_pathman_13-1.5.12-1.rhel7.x86_64.rpm
      rpm -Uhv pgagent_13-4.0.0-4.rhel7.x86_64.rpm

    2. Stop postgresql and pgagent services operation using the commands:

      systemctl stop postgresql-13
      systemctl stop pgagent-13

    3. Edit the file's content /etc/systemd/system/postgresql-13.service, replacing a specififed directory to /u01/postgres . You can perform the operation manually or using the command:

      sed -i "s|Environment=PGDATA=/var/lib/pgsql/13.2/data /|Environment=PGDATA=/u01/postgres/|" /etc/systemd/system/postgresql-13.service

    4. To apply changes to service configuration, run the command:

      systemctl daemon-reload

    5. Create directories for files and archives, initialize the database and change the directory's owner as well as the group to postgres:

      mkdir -p /u01/postgres
      chown postgres:postgres /u01/postgres
      export PGSETUP_INITDB_OPTIONS=" --encoding=UTF8"
      sudo -u postgres /usr/pgsql-13/bin/initdb --encoding=UTF8 --locale=en_US.UTF-8 -D /u01/postgres/
      mkdir -p /u01/postgres/tmp
      chown postgres:postgres /u01/postgres/tmp
      mkdir -p /u02/pgdata
      chown postgres:postgres /u02/pgdata
      mkdir -p /u02/pgdata1
      chown postgres:postgres /u02/pgdata1
      mkdir -p /u02/arch
      chown postgres:postgres /u02/arch

    6. Create a configuration file /u01/postgres/iwtm-postgres.conf. or example, use the command as follows:

      touch /u01/postgres/iwtm-postgres.conf

    7. Add to file /u01/postgres/iwtm-postgres.conf the following content:

      Блок кода
      languagec#
      # -----------------------------
      # PostgreSQL configuration file
      # -----------------------------
      #
      # IWTM custom values
      listen_addresses = '*'
      port = 5433
      max_connections = 1000 # (change requires restart)
      tcp_keepalives_idle = 60 # TCP_KEEPIDLE, in seconds'
      tcp_keepalives_interval = 20 # TCP_KEEPINTVL, in seconds'
      tcp_keepalives_count = 2 # TCP_KEEPCNT
      shared_buffers = kB
      huge_pages = try # on, off, or try
      max_locks_per_transaction = 512
      temp_buffers =  MB
      work_mem = MB
      effective_cache_size = MB
      min_wal_size = MB
      max_wal_size = MB
      log_min_duration_statement = 120000 # -1 is disabled, 0 logs all statements
      track_activity_query_size = 32768 # (change requires restart)
      log_autovacuum_min_duration = 30000 # -1 disables, 0 logs all actions and
      stats_temp_directory = '/u01/postgres/pg_stat_tmp'
      autovacuum_max_workers = 5
      autovacuum_naptime = 20
      maintenance_work_mem = GB
      autovacuum_freeze_max_age = 1000000000
      shared_preload_libraries = 'pg_stat_statements,pg_pathman'
      track_io_timing = on
      track_activity_query_size = 32768
      constraint_exclusion = off # on, off, or partition
      Предупреждение
      titleВажно!

      The configuration file's content above contains empty value fields as per parameters:

      • shared_buffers

      • work_mem

      • maintenance_work_mem

      • effective_cache_size

      • temp_buffers

      • min_wal_size

      • max_wal_size

      Configure these parameters according to official instructions. 

    8. Change the configuration file's owner and group to postgres:

      chown postgres:postgres /u01/postgres/iwtm-postgres.conf

    9. Add to /u01/postgres/postgresql.conf a link to iwtm-postgres.conf file using the command:

      echo "include = 'iwtm-postgres.conf'" >> /u01/postgres/postgresql.conf

    10. Configure the access file pg_hba.conf using the commands:

      sed -i "s|local[[:space:]]*all[[:space:]]*all[[:space:]]*peer|local   all             all                                     trust|" /u01/postgres/pg_hba.conf
      sed -i "s|host[[:space:]]*all[[:space:]]*all[[:space:]]*127.0.0.1/32[[:space:]]*ident|host    all             all             127.0.0.1/32            trust|" /u01/postgres/pg_hba.conf
      sed -i "s|host[[:space:]]*all[[:space:]]*all[[:space:]]*::1/128[[:space:]]*ident|host    all             all             ::1/128                 trust|" /u01/postgres/pg_hba.conf
      echo "# Enable not local access" >> /u01/postgres/pg_hba.conf
      echo "host    postgres        all             0.0.0.0/0               md5" >> /u01/postgres/pg_hba.conf

    11. Run postgresql service and check its status using the commands:

      systemctl enable postgresql-13
      systemctl start postgresql-13
      systemctl status postgresql-13

    12. Change the DB administrator's default password:

      su - postgres
      psql -p 5433
      alter user postgres password 'xxXX1234';

    13. Create all required expansions running the queries below:

      create extension if not exists adminpack;
      create extension if not exists dblink;
      create extension if not exists lo;
      create extension if not exists xml2;
      create extension if not exists tablefunc;
      create extension if not exists intarray;
      create extension if not exists file_fdw;
      create extension if not exists "uuid-ossp";
      create extension if not exists pgcrypto;
      create extension if not exists pgrowlocks;
      create extension if not exists autoinc;
      create extension if not exists hstore;
      create extension if not exists pg_stat_statements;
      create extension if not exists pg_buffercache;
      create extension if not exists pg_pathman;
      create extension if not exists pgagent;

    14. To exit enter the commands:

      \q
      exit

    15. To configure pgagent in user OS run the commands:

      touch /home/pgagent/.pgpass
      echo "127.0.0.1:5433:postgres:postgres:xxXX1234" > /home/pgagent/.pgpass
      chmod 0600 /home/pgagent/.pgpass
      chown pgagent:pgagent /home/pgagent/.pgpass
      usermod -s /bin/bash pgagent

    16. Create or edit the file /etc/sudoers.d/pgagent, to make the following content:

      Блок кода
      languagec#
      # allow pgagent to execute any command
      pgagent ALL = (postgres) NOPASSWD: ALL
      Defaults:pgagent !requiretty
    17. Change the privilleges, owner and group as per /etc/sudoers.d/pgagent running the commands:

      chmod 440 /etc/sudoers.d/pgagent
      chown root:root /etc/sudoers.d/pgagent

    18. Run pgagent and check its status using the commands:

      systemctl enable pgagent-13
      systemctl start pgagent-13
      systemctl status pgagent-13


    Finalising the configuration make sure there are no critical errors in /var/log/pgagent-13.log  and database logs.
    Раскрыть
    titleFor Postges Pro Enterprise DBMS
    1. Stop postgrespro and pgagent services operation using the commands:

      systemctl stop postgrespro-ent-13.service

    2. Copy to /var/lib/pgpro/ent-13/data the existing configuration file iwtm-postgres.conf or create in this directory a new file with the following content:

      Блок кода
      languagec#
      # -----------------------------
      # Postgres Pro configuration file
      # -----------------------------
      #
      # IWTM custom values
      
      listen_addresses = '*'
      port = 5433
      max_connections = 1000                     # (change requires restart)
      tcp_keepalives_idle = 60                   # TCP_KEEPIDLE, in seconds'
      tcp_keepalives_interval = 20               # TCP_KEEPINTVL, in seconds'
      tcp_keepalives_count = 2                   # TCP_KEEPCNT
      
      shared_buffers = 128kB
      
      huge_pages = try                           # on, off, or try
      
      max_locks_per_transaction = 512
      temp_buffers = 32MB
      work_mem = 16MB
      effective_cache_size = 4096MB
      
      min_wal_size = 6144MB
      max_wal_size = 6144MB
      lc_messages = 'en_US.UTF-8'                # locale for system error message
      log_directory = 'pg_log'
      log_filename = 'postgresql.log'            # log file name pattern
      log_rotation_age = 0                       # Automatic rotation of logfiles will happen after that time. 0 disables.
      log_rotation_size = 0                      # Automatic rotation of logfiles will happen after that much log output. 0 disables.
      log_min_duration_statement = 120000        # -1 is disabled, 0 logs all statements
      track_activity_query_size = 32768          # (change requires restart)
      log_autovacuum_min_duration = 30000        # -1 disables, 0 logs all actions and
      stats_temp_directory =
    '/u01/postgres
    1.  '/var/lib/pgpro/ent-13/data/pg_stat_tmp'
      
      autovacuum_max_workers = 5
      autovacuum_naptime = 20
      maintenance_work_mem = 
    GB
    1. 1GB
      autovacuum_freeze_max_age = 
    1000000000
    1. 10000000000
      
      shared_preload_libraries = 'pg_stat_statements,pg_
    stat_kcache,pg_
    1. pathman'
      track_io_timing = on
      track_activity_query_size = 32768
      
      constraint_exclusion = off                 # on, off, or partition
      standard_conforming_strings = on
      Предупреждение
      title
    Warning
    1. Important!

      The configuration file's content above contains

    empty value fields
    1. example values as per parameters:

      • shared_buffers

      • work_mem

      • maintenance_work_mem

      • effective_cache_size

      • temp_buffers

      • min_wal_size

      • max_wal_size

      Configure these parameters according to official instructions.

  • Change the configuration file's owner and group to postgres:

    chown postgres:postgres /u01/postgres/iwtm-postgres.conf

  • Add to /u01/postgres/postgresql.conf a link to 
    1. Add to configuration file /var/lib/pgpro/ent-13/data/postgresql.conf the link to the file iwtm-postgres.conf
    file
    1. .
      You can do it using the command:
      echo "include = 'iwtm-postgres.conf'" >>
    /u01/postgres
    1.  /var/lib/pgpro/ent-13/data/postgresql.conf
    Configure the access file 
    1. Edit the access file /var/lib/pgpro/ent-13/data/pg_hba.conf
     using
    1. :
      1. After the

    commands:sed -i "s|local[[:space:]]*all[[:space:]]*all[[:space:]]*peer|local   all             all                                     trust|" /u01/postgres/pg_hba.conf
      1. strings:

        Блок кода
        languagecpp
        # IPv6 local connections:
        host    all             all             ::1/128                 md5

        add a string:

        Блок кода
        languagecpp
        host    postgres        all             0.0.0.0/0               md5
      2. Replace the strings using the commands:

        sed -i "s|host[[:space:]]*all[[:space:]]*all[[:space:]]*127.0.0.1/32[[:space:]]*
    ident
      1. md5|host    all             all             127.0.0.1/32            trust|"
    /u01/postgres
      1. /var/lib/pgpro/ent-13/data/pg_hba.conf
        sed -i "s|
    host
      1. local[[:space:]]*all[[:space:]]*all[[:space:]]*
    ::1/128[[:space:]]*ident|host    all 
      1. peer|local   all             all               
     all 
      1.            
    ::1/128 
    echo "# Enable not local access" >> /u01/postgres/pg_hba.conf
    echo "host    postgres        all             0.0.0.0/0               md5" >> /u01/postgres/pg_hba.conf
  • Run postgresql service and check its status using the commands:

    systemctl enable postgresql-13
    systemctl start postgresql-13
    systemctl status postgresql-13

  • Change the DB administrator's default password
      1.          trust|" /var/lib/pgpro/ent-13/data/pg_hba.conf
    1. Create a directory /var/lib/pgpro/ent-13/data/tmp and assign its owner and group using the commands:
      mkdir 
         trust|" /u01/postgres/pg_hba.conf
    1. -p /var/lib/pgpro/ent-13/data/tmp
      chown postgres:postgres /var/lib/pgpro/ent-13/data/tmp
    2. Start the service postgrespro:
      systemctl start postgrespro-ent-13.service
    3. Follow the link to load the package pgagent_13-4.2.1-0.rhel7.x86_64.rpm.
    4. Install the package using the command:
      yum install pgagent_13-4.2.1-0.rhel7.x86_64.rpm
    5. Change the default password of database administrator:

      su - postgres
      psql -p 5433
      alter user postgres password 'xxXX1234';

    6. Create all required expansions running
    the queries below:
    1. the queries below:

      create extension if not exists adminpack;
      create extension if not exists dblink;
      create extension if not exists lo;
      create extension if not exists xml2;
      create extension if not exists tablefunc;
      create extension if not exists intarray;
      create extension if not exists file_fdw;
      create extension if not exists "uuid-ossp";
      create extension if not exists

    adminpack
    1. pgcrypto;
      create extension if not exists

    dblink
    1. pgrowlocks;
      create extension if not exists

    lo
    1. autoinc;
      create extension if not exists

    xml2
    1. hstore;
      create extension if not exists

    tablefunc
    1. pg_stat_statements;
      create extension if not exists

    intarray
    1. pg_buffercache;
      create extension if not exists

    file
    1. pg_

    fdw
    1. pathman;
      create extension if not exists

    "uuid-ossp";
    create extension if not exists pgcrypto;
    create extension if not exists pgrowlocks;
    create extension if not exists autoinc;
    create extension if not exists hstore;
    create extension if not exists pg_stat_statements;
    create extension if not exists pg_buffercache;
    create extension if not exists pg_stat_kcache;
    create extension if not exists pg_pathman;
    create extension if not exists pgagent;
  • To exit enter the commands:

    \q
    exit

  • To configure pgagent in user OS run the commands:

    touch /home/pgagent/.pgpass
    echo "127.0.0.1:5433:postgres:postgres:xxXX1234" > /home/pgagent/.pgpass
    chmod 0600 /home/pgagent/.pgpass
    chown pgagent:pgagent /home/pgagent/.pgpass
    usermod -s /bin/bash pgagent

  • Create or edit the file /etc/sudoers.d/pgagent to make the following content:

    Блок кода
    languagec#
    # allow pgagent to execute any command
    pgagent ALL = (postgres) NOPASSWD: ALL
    Defaults:pgagent !requiretty
  • Change the privilleges, owner and group as per /etc/sudoers.d/pgagent running the commands:

    chmod 440 /etc/sudoers.d/pgagent
    chown root:root /etc/sudoers.d/pgagent

  • Run pgagent service and check its status using the commands:

    systemctl enable pgagent-13
    systemctl start pgagent-13
    systemctl status pgagent-13

  • Finalising the configuration make sure there are no critical errors in /var/log/pgagent-13.log. and database
    1. pgagent;

    2. To exit enter the commands:

      \q
      exit

    3. To configure pgagent in user OS run the commands:

      touch /home/pgagent/.pgpass
      echo "127.0.0.1:5433:postgres:postgres:xxXX1234" > /home/pgagent/.pgpass
      chmod 0600 /home/pgagent/.pgpass
      chown pgagent:pgagent /home/pgagent/.pgpass
      usermod -s /bin/bash pgagent

    4. Create /etc/sudoers.d/iw-pgagent with the following content:

      Блок кода
      languagecpp
      # allow pgagent to execute any command
      pgagent ALL = (postgres) NOPASSWD: ALL
      Defaults:pgagent !requiretty
    5. Change  the privilleges, owner and group as per /etc/sudoers.d/iw-pgagent:

      chmod 440 /etc/sudoers.d/iw-pgagent
      chown root:root /etc/sudoers.d/iw-pgagent

    6. Edit the configuration file /etc/pgagent/pgagent_13.conf using the commands:

      sed -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent_13.conf
      echo "LD_LIBRARY_PATH=/opt/pgpro/ent-13/lib" >> /etc/pgagent/pgagent_13.conf

    7. Enable the service pgagent, run it and check its status using the commands:

      systemctl enable pgagent_13
      systemctl start pgagent_13
      systemctl status pgagent_13

    8. Create a directory /u02:
      mkdir /u02
    9. Mount disk storage in the /u02 directory.

    10. Create the directories for table spaces and their owner and group to postgres.:
      mkdir /u02/pgdata
      mkdir /u02/pgdata1
      mkdir /u02/arch
      chown -R postgres:postgres /u02

    When you finish, make sure that there are no critical errors in /var/log/pgagent_13.log and the database logs.