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

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

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.
Комментарий: Published by Scroll Versions from space TMIG and version 7.11

Работа с СУБД PostgreSQL 12 поддерживается на РЕД ОС 7.3 Сертифицированной редакции.

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

. Подробнее см. раздел "Поддерживаемые СУБД" в статье "Аппаратные и программные требования". 

Sv translation
languageru

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

  1. Убедитесь, что версия вашей

    базы данных

    СУБД поддерживается Traffic Monitor

    : 
    • Oracle Enterprise 19c
    • PostgreSQL 12
    • PostgreSQL 15
    • Postgres Pro Enterprise 15
    • Jatoba 5

    Если используется СУБД PostgreSQL, Postgres Pro Enterprise или Jatoba, выполните предварительную настройку.

Предупреждение
titleВажно!
Информация
titleПримечание:

При необходимости обновите СУБД до поддерживаемой версии, для этого используйте официальную инструкцию.

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

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

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

    Якорь
    postgres12
    postgres12

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

      Блок кода
      languagetext
      yum -y install pgagent_12* postgresql-contrib
    2. Убедитесь, что SELinux деактивирован.
      С инструкцией по отключению SELinux можно ознакомиться на официальном сайте РЕД ОС.
    3. Отредактируйте содержимое файла /usr/lib/

      Создайте или дополните файл /etc/systemd/system/postgresql-12.service

      , заменив директорию в строке Environment=PGDATA= на /u01/postgres. 
      Вы можете сделать это вручную или с помощью следующей команды:

      sed -i "s|Environment=PGDATA=/var/lib/pgsql/data|.d/override.conf следующим содержимым:

      Блок кода
      [Service]
      Environment=PGDATA=/u01/postgres
      |" /usr/lib/systemd/system/postgresql.service
    4. Для применения изменений в конфигурации сервиса выполните команду:


      systemctl

      Блок кода
      languagetext
      systemctl daemon-reload
    5. Создайте директории для файлов и архивов, инициализируйте базу данных:

      Блок кода
      languagetext
      mkdir -p /u01/postgres

      
      chown postgres:postgres /u01/postgres

      
      sudo -u postgres initdb --encoding=UTF8 --locale=en_US.UTF-8 -D /u01/postgres

      
      mkdir -p /u01/postgres/tmp /u02/pgdata /u02/pgdata1 /u02/arch
    6. Создайте конфигурационный файл /u01/postgres/iwtm-postgres.conf. Например, с помощью команды:

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

      Блок кода
      # -----------------------------
      # 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                        # min 128KiB
      
      huge_pages = try                           # on, off, or try
      
      max_locks_per_transaction = 256
      temp_buffers =  MB
      work_mem = MB
      effective_cache_size = MB
      
      min_wal_size = MB
      max_wal_size = MB
      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
      stats_temp_directory = '/u01/postgres/pg_stat_tmp'
      autovacuum_max_workers = 5
      autovacuum_naptime = 20
      max_parallel_maintenance_workers = 8
      maintenance_work_mem = GB
      autovacuum_freeze_max_age = 1000000000
      shared_preload_libraries = 'pg_stat_statements'
      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

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

    8. Рекурсивно смените директориям /u02 и /u01 владельца и группу на postgres:

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

      Блок кода
      languagetext
      echo "include = 'iwtm-postgres.conf'" >> /u01/postgres/postgresql.conf
    10. Настройте файл доступа pg_hba.conf с помощью команд:

      sed

      Блок кода
      languagetext
      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. Запустите сервис postgresql и проверьте его статус. Используйте команды:

      Блок кода
      languagetext
      systemctl enable postgresql

      
      systemctl start postgresql

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


      sudo

      Блок кода
      languagetext
      sudo -u postgres psql -p 5433 -c "alter user postgres password 'xxXX1234';"
    13. Создайте требуемые расширения, выполнив запросы:


      sudo

      Блок кода
      languagetext
      sudo -u postgres psql -p 5433 -c "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 pgagent;"
    14. Для настройки pgAgent в ОС выполните команды:

      Блок кода
      languagetext
      mkdir -p /home/pgagent

      
      touch /home/pgagent/.pgpass

      
      echo "127.0.0.1:5433:postgres:postgres:xxXX1234" > /home/pgagent/.pgpass

      
      chmod 0600 /home/pgagent/.pgpass

      
      chown -R pgagent:pgagent /home/pgagent

      
      usermod -s /bin/bash pgagent
      
      
      sed -i "s|DBPORT=5432|DBPORT=5433|" /etc/pgagent/pgagent_12.conf
    15. Создайте или отредактируйте файл /etc/sudoers.d/pgagent, чтобы содержимое соответствовало образцу ниже:

      # allow pgagent to execute any command
      pgagent ALL = (postgres) NOPASSWD: ALL
      Defaults:pgagent !requiretty

                                                                                         

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


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

    Пустая строка в конце файла pgagent обязательна.

  • Измените для файла /etc/sudoers.d/pgagent права, владельца и группу, выполнив команды:chmod 440

    Блок кода
    languagetext
    chmod 440 /etc/sudoers.d/pgagent
    
    chown root:root /etc/sudoers.d/pgagent
  • Запустите сервис pgagent и проверьте его статус с помощью команд:

    Блок кода
    languagetext
    systemctl enable pgagent_12

    
    systemctl start pgagent_12

    
    systemctl status pgagent_12
  • По завершении настройки убедитесь в отсутствии критических ошибок в логах базы данных и /var/log/pgagent_12.log.

    Якорь
    postgres15
    postgres15

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


      rpm -Uhv pgagent_15-4.2.2-3.rhel7.x86_64.rpm

      Блок кода
      languagetext
      yum -y install pgagent_15* postgresql15-contrib
    2. Остановите работу сервисов postgresql и pgagent, используя команды:

      Блок кода
      languagetext
      systemctl stop postgresql-15

      
      systemctl stop pgagent
      -
      _15
    3. Отредактируйте содержимое файла 

      Создайте или дополните файл /etc/systemd/system/postgresql-15.service

      , заменив в строке Environment=PGDATA= указанную  директорию на /u01/postgres.
      Вы можете сделать это вручную или с помощью следующей команды:

      sed -i "s|.d/override.conf следующим содержимым:

      Блок кода
      [Service]
      Environment=PGDATA=/
      var/lib/pgsql/15/data /|Environment=PGDATA=/
      u01/postgres
      /|" /etc/systemd/system/postgresql-15.service
    4. Для применения изменений в конфигурации сервиса выполните команду:

      Блок кода
      languagetext
      systemctl daemon-reload
    5. Создайте директории для файлов и архивов, инициализируйте базу данных и смените директориям владельца и группу на postgres:

      Блок кода
      languagetext
      mkdir -p /u01/postgres

      
      chown postgres:postgres /u01/postgres

      
      export PGSETUP_INITDB_OPTIONS=" --encoding=UTF8"

      
      sudo -u postgres /usr/pgsql-15/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. Создайте конфигурационный файл /u01/postgres/iwtm-postgres.conf. Например, с помощью следующей команды:

      Блок кода
      languagetext
      touch /u01/postgres/iwtm-postgres.conf
    7. Добавьте в файл /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'
      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

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

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

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

      Блок кода
      languagetext
      echo "include = 'iwtm-postgres.conf'" >> /u01/postgres/postgresql.conf
    10. Настройте файл доступа pg_hba.conf

       с

      с помощью команд:

      Блок кода
      languagetext
      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. Запустите сервис postgresql и проверьте его статус с помощью команд:

      Блок кода
      languagetext
      systemctl enable postgresql-15

      
      systemctl start postgresql-15

      
      systemctl status postgresql-15
    12. Измените для администратора базы данных пароль по умолчанию:

      Блок кода
      languagetext
      su - postgres

      
      psql -p 5433

      
      alter user postgres password 'xxXX1234';
    13. Создайте требуемые расширения, выполнив запросы:

      Блок кода
      languagetext
      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 pgagent;


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

      Блок кода
      languagetext
      \q

      
      exit
    15. Для настройки в ОС пользователя pgagent

       выполните

      выполните команды:

      Блок кода
      languagetext
      mkdir /home/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
    16. Создайте или отредактируйте файл /etc/sudoers.d/pgagent, чтобы содержимое соответствовало образцу ниже:

      code

    languagec#
    # allow pgagent to execute any command

    pgagent ALL = (postgres) NOPASSWD: ALL

    Defaults:pgagent !requiretty


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

    Пустая строка в конце файла pgagent обязательна.

  • Измените /etc/sudoers.d/pgagent права, владельца и группу, выполнив команды:

    Блок кода
    languagetext
    chmod 440 /etc/sudoers.d/pgagent

    
    chown root:root /etc/sudoers.d/pgagent
  • Запустите сервис pgagent и проверьте его статус с помощью команд:

    systemctl enable pgagent_15
    systemctl start pgagent_15
    systemctl status В конфигурационном файле /etc/pgagent/pgagent_15.conf измените значение параметра DBPORT с 5432 на 5433:

    Блок кода
    languagetext
    sed -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent_15.conf
  • Запустите сервис pgagent и проверьте его статус с помощью команд:

    Блок кода
    languagetext
    systemctl enable pgagent_15
    systemctl start pgagent_15
    systemctl status pgagent_15
  • По завершении настройки убедитесь в отсутствии критических ошибок в логах базы данных и /var/log/pgagent_15.log.

    Якорь
    pgpro
    pgpro

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

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

    1. Установите дополнительный пакет, выполнив команду:

      Блок кода
      languagetext
      yum -y install postgrespro-ent-15-contrib 
    2. Остановите работу сервиса postgrespro

       и pgagent с

      с помощью команды:

      Блок кода
      languagetext
      systemctl stop postgrespro-ent-15.service
    3. Скопируйте в директорию /var/lib/pgpro/ent-15/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-15/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'
      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

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

    4. Добавьте в конфигурационный файл /var/lib/pgpro/ent-15/data/postgresql.conf ссылку на файл iwtm-postgres.conf.
      Вы можете сделать это командой:


      echo 

      Блок кода
      languagetext
      echo "include = 'iwtm-postgres.conf'" >>  
      >>  
      /var/lib/pgpro/ent-15/data/postgresql.conf
    5. Отредактируйте файл доступа /var/lib/pgpro/ent-15/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. Замените строки с помощью команд:

        Блок кода
        languagetext
        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-15/data/pg_hba.conf

        
        sed -i "s|local[[:space:]]*all[[:space:]]*all[[:space:]]*peer|local   all             all                                     trust|" /var/lib/pgpro/ent-15/data/pg_hba.conf
    6. Создайте директорию /var/lib/pgpro/ent-15/data/tmp и назначьте ей владельца и группу с помощью команд:

      mkdir 
      Блок кода
      languagetext
      mkdir -p /var/lib/pgpro/ent-15/data/tmp

      chown postgres
      
      chown postgres:postgres /var/lib/pgpro/ent-15/data/tmp
    7. Раскрыть
      titleЕсли вы выполняете настройку на сервере под управлением РЕД ОС:
      1. Перейдите в директорию:

        Блок кода
        cd /usr/lib/systemd/system
      2. Переименуйте сервисный файл:

        Блок кода
        mv postgrespro-ent-15.service postgresql-15.service
      3. Перезагрузите сервер:

        Блок кода
        languagetext
        reboot
      4. Запустите сервис:

        Блок кода
        languagetext
        systemctl start postgresql-15.service
      5. Перейдите в вашу рабочую директорию.
        В нашем примере:

        Блок кода
        cd /distr
      6. Скопируйте в директорию прилагаемый в поставке архив iwtm-postgresql-15.5-x.x.x.xxx-redos-73.tar.gz.
      7. Распакуйте архив с помощью команды:

        Блок кода
        languagetext
        tar -xvf iwtm-postgresql-15.5-x.x.x.xxx-redos-73.tar.gz

        В нашем примере:

        Блок кода
        languagetext
        tar -xvf iwtm-postgresql-15.5-7.
        9
        10.0.
        101
        97-redos-73.tar.gz


      8. Перейдите в директорию с содержимым архива.
      9. Установите

        пакет pgagent_15-4.2.2-3.rhel7.x86_64.rpm с помощью команды:
        yum install

        пакеты с помощью команды:

        Блок кода
        languagetext
        yum install pgagent_15-4.2.2-3.rhel7.x86_64.
        rpm
        rpm 
    8. Раскрыть
      titleЕсли вы выполняете настройку на сервере под управлением ОС Red Hat Enterprise Linux:
      1. Запустите сервис:

        Блок кода
        languagetext
        systemctl start postgrespro-ent-15.service
      2. Скачайте по ссылке пакет pgagent_15-4.2.2-3.rhel7.x86_64.rpm.
      3. Установите пакет с помощью команды:


        yum install

        Блок кода
        languagetext
        yum install pgagent_15-4.2.2-3.rhel7.x86_64.rpm
    9. Измените для администратора базы данных пароль по умолчанию:

      Блок кода
      languagetext
      su - postgres

      
      psql -p 5433

      
      alter user postgres password 'xxXX1234';
    10. Создайте требуемые расширения, выполнив запросы:

      Блок кода
      languagetext
      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 pgagent;
    11. Для выхода введите команды:

      Блок кода
      languagetext
      \q

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

      Блок кода
      languagetext
      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
    13. Создайте /etc/sudoers.d/iw-pgagent со следующим содержимым:

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

      Блок кода
      languagetext
      chmod 440 /etc/sudoers.d/iw-pgagent

      
      chown root:root /etc/sudoers.d/iw-pgagent
    15. Отредактируйте конфигурационный файл /etc/pgagent/pgagent_15.conf с помощью команд:
      • На ОС Red Hat Enterprise Linux:sed 

        Блок кода
        languagetext
        sed -i --follow-
        symlinks 
        symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent_15.conf

        echo 
        
        echo "LD_LIBRARY_PATH=/opt/pgpro/ent-15/lib"
         >> 
         >> /etc/pgagent/pgagent_15.conf
      • На РЕД ОС:

        sed 
        Блок кода
        languagetext
        sed -i --follow-
        symlinks 
        symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent-15.conf

        echo 
        
        echo "LD_LIBRARY_PATH=/opt/pgpro/ent-15/lib"
         >> 
         >> /etc/pgagent/pgagent-15.conf
    16. Включите сервис pgagent, запустите и проверьте его статус с помощью команд:
      • На ОС Red Hat Enterprise Linux:systemctl enable pgagent

        Блок кода
        languagetext
        systemctl enable pgagent_15

        
        systemctl start pgagent_15

        
        systemctl status pgagent_15


      • На РЕД ОС:


        systemctl enable pgagent

        Блок кода
        languagetext
        systemctl enable pgagent-15

        
        systemctl start pgagent-15

        
        systemctl status pgagent-15
    17. Создайте директорию /u02:

      Блок кода
      languagetext
      mkdir /u02
    18. Смонтируйте в директорию /u02 дисковое хранилище.

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

      Блок кода
      languagetext
      mkdir /u02/pgdata

      
      mkdir /u02/pgdata1

      
      mkdir /u02/arch

      
      chown -R postgres:postgres /u02
    По завершении настройки убедитесь в отсутствии критических ошибок в логах базы данных и /var/log/pgagent_15.log или /var/log/pgagent-15.log.

    Якорь
    jatoba
    jatoba

    В файле /usr/lib
    Раскрыть
    titleДля СУБД Jatoba
    1. Установите дополнительный пакет, выполнив команду:

      Блок кода
      languagetext
      yum -y install jatoba5-contrib
    2. Создайте или дополните файл /etc/systemd/system/jatoba-5.service

      измените директорию, указанную в строке

      .d/override.conf следующим содержимым:

      Блок кода
      [Service]
      Environment=PGDATA=
      , на
      /u01/postgres
      . 
    3. Для применения изменений в конфигурации сервиса выполните команду:

      Блок кода
      languagetext
      systemctl daemon-reload
    4. Создайте директории для файлов и архивов, смените директориям владельца и группу на postgres. Используйте команды:


      mkdir -p


      Блок кода
      languagetext
      mkdir -p /u01/postgres

      
      chown postgres:postgres /u01/postgres

      
      mkdir -p /u02/pgdata

      
      mkdir -p /u02/pgdata1

      
      mkdir -p /u02/arch

      
      chown -R postgres:postgres /u02
    5. Инициализируйте базу данных. Для этого:
      1. Перейдите в директорию /usr/jatoba-5/bin/:

        Блок кода
        languagetext
        cd /usr/jatoba-5/bin/
      2. Используйте команду инициализации:

        Блок кода
        languagetext
        PGSETUP_INITDB_OPTIONS=" --encoding=UTF8" ./jatoba-setup initdb jatoba-5 --encoding=UTF8 --locale=en_US.UTF-8 -D /u01/postgres
    6. Создайте временную директорию и смените владельца и группу на postgres. Используйте команды: 

      Блок кода
      languagetext
      mkdir -p /u01/postgres/tmp

      
      chown postgres:postgres /u01/postgres/tmp
      Предупреждение
      titleВажно!

      Создание временной директории tmp допустимо только после инициализации базы данных.

    7. В директории /u01/postgres/ создайте конфигурационный файл iwtm-postgres.conf:

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

      Блок кода
      # -----------------------------
      # 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                        # min 128KiB
      
      huge_pages = try                           # on, off, or try
      
      max_locks_per_transaction = 256
      temp_buffers = MB
      work_mem = MB
      effective_cache_size = MB
      
      min_wal_size = MB
      max_wal_size = MB
      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
      
      autovacuum_max_workers = 5
      autovacuum_naptime = 20
      max_parallel_maintenance_workers = 8
      maintenance_work_mem = MB
      autovacuum_freeze_max_age = 1000000000
      
      shared_preload_libraries = 'pg_stat_statements'
      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

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

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

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

      Блок кода
      languagetext
      echo "include = 'iwtm-postgres.conf'" >> /u01/postgres/postgresql.conf
    11. Настройте файл доступа pg_hba.conf с помощью команд:

      Блок кода
      languagetext
      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
    12. Активируйте СУБД согласно Руководству по установке СУБД Jatoba.
    13. Запустите сервис jatoba-5 и проверьте его статус. Используйте команды:

      Блок кода
      languagetext
      systemctl enable jatoba-5

      
      systemctl start jatoba-5

      
      systemctl status jatoba-5
    14. Установите pgAgent из репозитория ОС с помощью команды:

      Блок кода
      languagetext
      yum install pgagent_15
    15. Перенесите файлы для установки расширений из каталога postgresql-15 в каталог jatoba-5. Для этого:
      1. Перейдите в /usr/pgsql-15/share:

        Блок кода
        languagetext
        cd /usr/jatoba-5/share/
      2. Используйте команды смены директорий:

        Блок кода
        languagetext
        cp -R pgagent_15-x.x.x /usr/jatoba-5/share/

        
        cp extension/* /usr/jatoba-5/share/extension/
        Предупреждение
        titleВажно!

        В первой команде замените имя pgagent_15-x.x.x на точное название каталога, расположенного в директории /usr/jatoba-5/share/. Например, pgagent_15-4.0.0.

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

      Блок кода
      languagetext
      su - postgres

      
      psql -p 5433

      
      alter user postgres password 'xxXX1234';
    17. Создайте расширения, выполнив запросы:

      Блок кода
      languagetext
      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 pgagent;
    18. Для выхода введите команды:

      Блок кода
      languagetext
      \q

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

      Блок кода
      languagetext
      mkdir /home/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
    20. Создайте или отредактируйте файл /etc/sudoers.d/pgagent, чтобы содержимое соответствовало образцу ниже:

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

      Блок кода
      languagetext
      chmod 440 /etc/sudoers.d/pgagent

      
      chown root:root /etc/sudoers.d/pgagent
    22. В конфигурационном файле /etc/pgagent/pgagent_15.conf измените значение параметра DBPORT с 5432 на 5433:

      Блок кода
      languagetext
      sed -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent_15.conf
    23. Запустите сервис pgagent_15 и проверьте его статус с помощью команд:

      Блок кода
      languagetext
      systemctl enable pgagent_15

      
      systemctl start pgagent_15

      
      systemctl status pgagent_15

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

    Sv translation
    languageen

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

    1. Make sure the version of your database is supported by Traffic Monitor:
      • Oracle Enterprise 19c
      • PostgreSQL 15
      • Postgres Pro Enterprise 15
    2. In case you use PostgreSQL or Postgres Pro Enterprise DBMS, make the preliminary configuration.
    Предупреждение
    titleWarning!

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

    Configuring DBMS

    To prepare a remote database for installation of Traffic Monitor components, the following actions should be taken on database server:

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

    rpm -Uhv pgagent_15-4.2.2-3.rhel7.x86_64.rpm

  • Stop postgresql and pgagent services operation using the commands:

    systemctl stop postgresql-15
    systemctl stop pgagent-15

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

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

  • 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-15/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#
    # ----------------------------- # PostgreSQL

    Якорь
    tantor
    tantor

    Раскрыть
    titleДля СУБД Tantor
    Информация
    titleПримечание:

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

    1. Остановите работу сервиса tantor-be-server-15 с помощью команды:

      Блок кода
      languagetext
      systemctl stop tantor-be-server-15.service
    2. Скопируйте в директорию /var/lib/postgresql/tantor-be-15/data/ имеющийся конфигурационный файл iwtm-postgres.conf или создайте там новый со следующим содержимым:

      Блок кода
      languagetext
      # -----------------------------
      # Tantor 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
    1. 128kB
      
      huge_pages = try                           # on, off, or try
      
      max_locks_per_transaction = 512
      temp_buffers = 
    MB
    1. 32MB
      work_mem = 
    MB
    1. 16MB
      effective_cache_size = 
    MB
    1. 4096MB
      
      min_wal_size = 
    MB
    1. 6144MB
      max_wal_size = 
    MB
    1. 6144MB
      
    log_min_duration_statement
    1. lc_messages = 
    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
    1. 'en_US.UTF-8'                # locale for system error message
      log_directory = '
    /u01/postgres/
    1. pg_
    stat_tmp
    1. log'
      
    autovacuum
    1. log_
    max_workers
    1. filename = 
    5 autovacuum_naptime = 20 maintenance_work_mem = GB autovacuum_freeze_max_age = 1000000000 shared_preload_libraries = 'pg_stat_statements' 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. 

  • 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 iwtm-postgres.conf file using the command:

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

  • Configure the access file pg_hba.conf using the commands:
    sed -i
    1. '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/postgresql/tantor-be-15/data/pg_stat_tmp'
      
      autovacuum_max_workers = 5
      autovacuum_naptime = 20
      maintenance_work_mem = 1GB
      autovacuum_freeze_max_age = 1000000000
      
      #shared_preload_libraries =  'pg_stat_statements'
      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

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

    2. Выдайте пользователю postgres права на файл iwtm-postgres.conf.

      Блок кода
      languagetext
      chown postgres:postgres /var/lib/postgresql/tantor-be-15/data/iwtm-postgres.conf
    3. Добавьте в конфигурационный файл /var/lib/postgresql/tantor-be-15/data/postgresql.conf ссылку на файл iwtm-postgres.conf. Используйте команду:

      Блок кода
      languagetext
      echo "include = 'iwtm-postgres.conf'" >> /var/lib/postgresql/tantor-be-15/data/postgresql.conf
    4. Отредактируйте файл доступа /var/lib/postgresql/tantor-be-15/data/pg_hba.conf:
      1. После строк:

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

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

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

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

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

        Блок кода
        languagetext
        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/postgresql/tantor-be-15/data/pg_hba.conf
        sed -i "s|local[[:space:]]*all[[:space:]]*all[[:space:]]*peer|local   all             all                                     trust|" /var/lib/postgresql/tantor-be-15/data/pg_hba.conf
    5. Создайте директорию /var/lib/pgpro/ent-15/data/tmp и назначьте ей владельца и группу с помощью команд:

      Блок кода
      languagetext
      mkdir –p /var/lib/postgresql/tantor-be-15/data/tmp
      chown postgres:postgres /var/lib/postgresql/tantor-be-15/data/tmp
    6. Установите pgAgent:

      Раскрыть
      titleНа сервере под управлением ОС Red Hat Enterprise Linux:
      1. Запустите сервис Tantor:

        Блок кода
        languagetext
        systemctl start tantor-be-server-15.service
      2. Скачайте пакет pgagent_15-4.2.2-3.rhel7.x86_64.rpm из репозитория Yum.
      3. Установите пакет с помощью команды:

        Блок кода
        languagetext
        yum install pgagent_15-4.2.2-3.rhel7.x86_64.rpm
      Раскрыть
      titleНа сервере под управлением РЕД ОС:
      1. Запустите сервис Tantor:

        Блок кода
        languagetext
        systemctl start tantor-be-server-15.service
      2. Перейдите в вашу рабочую директорию.
        В нашем примере:

        Блок кода
        languagetext
        cd /distr
      3. Скопируйте в директорию прилагаемый в поставке архив iwtm-postgresql-15.5-x.x.x.xxx-redos-73.tar.gz.
      4. Распакуйте архив с помощью команды:

        Блок кода
        languagetext
        tar -xvf iwtm-postgresql-15.5-x.x.x.xxx-redos-73.tar.gz

        В нашем примере:

        Блок кода
        languagetext
        tar -xvf iwtm-postgresql-15.5-7.11.0.97-redos-73.tar.gz
      5. Перейдите в директорию с содержимым архива.
      6. Установите пакет pgagent_15-4.2.2-3.rhel7.x86_64.rpm с помощью команды:

        Блок кода
        languagetext
        yum install pgagent_15-4.2.2-3.rhel7.x86_64.rpm
    7. Скопируйте файлы расширения:

      Блок кода
      languagetext
      cp /usr/pgsql-15/share/extension/pgagent* /opt/tantor/db/15/share/postgresql/extension/
    8. Смените пользователя на postgres:

      Блок кода
      languagetext
      su - postgres
    9. Подключитесь к базе данных:

      Блок кода
      languagetext
      psql -p 5433
    10. Измените для администратора базы данных пароль по умолчанию:

      Блок кода
      languagetext
      alter user postgres with password 'xxXX1234';
    11. Создайте требуемые расширения, выполнив запросы:

      Блок кода
      languagetext
      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 pgagent;
    12. Для выхода введите команды:

      Блок кода
      languagetext
      \q
      exit
    13. Для настройки в ОС пользователя pgagent выполните команды:

      Блок кода
      languagetext
      mkdir /home/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
    14. Создайте /etc/sudoers.d/iw-pgagent со следующим содержимым:

      Блок кода
      languagetext
      # allow pgagent to execute any command
      pgagent ALL = (postgres) NOPASSWD: ALL
      Defaults:pgagent !requiretty

      Вы можете сделать это при помощи команд:

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

      Блок кода
      languagetext
      chmod 440 /etc/sudoers.d/iw-pgagent
      chown root:root /etc/sudoers.d/iw-pgagent
    16. Отредактируйте конфигурационный файл /etc/pgagent/pgagent_15.conf:

      Раскрыть
      titleНа сервере под управлением ОС Red Hat Enterprise Linux:

      Используйте команды:

      Блок кода
      languagetext
      sed -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent_15.conf
      echo "LD_LIBRARY_PATH=/opt/tantor/db/15/lib/" >> /etc/pgagent/pgagent_15.conf
      Раскрыть
      titleНа сервере под управлением РЕД ОС:

      Используйте команды:

      Блок кода
      languagetext
      sed -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent-15.conf
      echo "LD_LIBRARY_PATH=/opt/tantor/db/15/lib" >> /etc/pgagent/pgagent-15.conf
    17. Включите сервис pgAgent, запустите и проверьте его статус:

      Раскрыть
      titleНа сервере под управлением ОС Red Hat Enterprise Linux:

      Используйте команды:

      Блок кода
      languagetext
      systemctl enable pgagent_15
      systemctl start pgagent_15
      systemctl status pgagent_15
      Раскрыть
      titleНа сервере под управлением РЕД ОС:
      1. Включите сервис:

        Блок кода
        languagetext
        systemctl enable pgagent-15
      2. Внесите изменения в файл /etc/systemd/system/multi-user.target.wants/pgagent-15.service.
        В разделе Unit в следующих строках: 

        Блок кода
        languagetext
        After=postgresql-15.service
        BindsTo=postgresql-15.service

        замените postgresql-15.service на tantor-be-server-15.service:

        Блок кода
        languagetext
        After=tantor-be-server-15.service
        BindsTo=tantor-be-server-15.service
      3. Запустите сервис и проверьте его статус:

        Блок кода
        languagetext
        systemctl start pgagent-15
        systemctl status pgagent-15
    18. Создайте директорию /u02:

      Блок кода
      languagetext
      mkdir /u02
    19. Создайте директории для табличных пространств и смените владельца и группу на postgres:

      Блок кода
      languagetext
      mkdir /u02/pgdata
      mkdir /u02/pgdata1
      mkdir /u02/arch
      chown -R postgres:postgres /u02
    По завершении настройки убедитесь в отсутствии критических ошибок в логах базы данных и /var/log/pgagent_15.log или /var/log/pgagent-15.log.

    Sv translation
    languageen

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

    1. Make sure the version of your database is supported by Traffic Monitor. For details, see "Supported DBMS" section of "Аппаратные и программные требования" article.

      Информация
      titleNote:

      If required, update the DBMS to supported version. To do this, use the official instructions.

    2. In case you use one of the DBMS listed below, make the preliminary configuration:

    Configuring DBMS

    To prepare a remote database for installation of Traffic Monitor components, the following actions should be taken on database server:

    Якорь
    postgres-en
    postgres-en

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

      Блок кода
      languagetext
      yum -y install pgagent_15* postgresql15-contrib
    2. Stop postgresql and pgagent services operation using the commands:

      Блок кода
      languagetext
      systemctl stop postgresql-15
      systemctl stop pgagent_15
    3. Create a file /etc/systemd/system/postgresql-15.service.d/override.conf or add the following content to it:

      Блок кода
      [Service]
      Environment=PGDATA=/u01/postgres
    4. To apply changes to service configuration, run the command:

      Блок кода
      languagetext
      systemctl daemon-reload
    5. Create directories for files and archives, initialize the database and change the directory's owner as well as the group topostgres:

      Блок кода
      languagetext
      mkdir -p /u01/postgres
      chown postgres:postgres /u01/postgres
      export PGSETUP_INITDB_OPTIONS=" --encoding=UTF8"
      sudo -u postgres /usr/pgsql-15/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. For example, use the command as follows:

      Блок кода
      languagetext
      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'
      track_io_timing = on
      track_activity_query_size = 32768
      constraint_exclusion = off # on, off, or partition
      Предупреждение
      titleImportant!

      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:

      Блок кода
      languagetext
      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:

      Блок кода
      languagetext
      echo "include = 'iwtm-postgres.conf'" >> /u01/postgres/postgresql.conf
    10. Configure the access file pg_hba.conf using the commands:

      Блок кода
      languagetext
      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:

      Блок кода
      languagetext
      systemctl enable postgresql-15
      systemctl start postgresql-15
      systemctl status postgresql-15
    12. Change the DB administrator's default password:

      Блок кода
      languagetext
      su - postgres
      psql -p 5433
      alter user postgres password 'xxXX1234';
    13. Create all required expansions running the queries below:

      Блок кода
      languagetext
      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 pgagent;
    14. To exit, enter the commands:

      Блок кода
      languagetext
      \q
      exit
    15. To configure pgagent user in OS, run the commands:

      Блок кода
      languagetext
      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
      sed -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent_15.conf
    16. Create or edit the file /etc/sudoers.d/pgagent, so that the content looks as follows:

      # allow pgagent to execute any command
      pgagent ALL = (postgres) NOPASSWD: ALL
      Defaults:pgagent !requiretty


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

      Empty line at the end of pgagent file is compulsory.

    17. Change the privileges, owner and group as per /etc/sudoers.d/pgagent running the commands:

      Блок кода
      languagetext
      chmod 440 /etc/sudoers.d/pgagent
      chown root:root /etc/sudoers.d/pgagent
    18. Run pgagent and check its status using the commands:

      Блок кода
      languagetext
      systemctl enable pgagent_15
      systemctl start pgagent-15
      systemctl status pgagent-15

    Finalising the configuration, make sure there are no critical errors in /var/log/pgagent-15.log and database logs.

    Якорь
    pgpro-en
    pgpro-en

    Раскрыть
    titleFor Postges Pro Enterprise DBMS
    1. Install an additional package using the command:

      Блок кода
      languagetext
      yum -y install postgrespro-ent-15-contrib
    2. Stop postgrespro service operation using the command:

      Блок кода
      languagetext
      systemctl stop postgrespro-ent-15.service
    3. Copy to /var/lib/pgpro/ent-15/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 = '/var/lib/pgpro/ent-15/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'
      track_io_timing = on
      track_activity_query_size = 32768
      
      constraint_exclusion = off                 # on, off, or partition
      standard_conforming_strings = on
      Предупреждение
      titleImportant!

      The configuration file's content above contains 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.

    4. Add to configuration file /var/lib/pgpro/ent-15/data/postgresql.conf the link to the file iwtm-postgres.conf.
      You can do it using the command:

      Блок кода
      languagetext
      echo "include = 'iwtm-postgres.conf'" >>  /var/lib/pgpro/ent-15/data/postgresql.conf
    5. Edit the access file /var/lib/pgpro/ent-15/data/pg_hba.conf:
      1. After the strings:

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

        add a string:

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

        The provided values are for Traffic Monitor installation with default parameters. In case you are going to use different values during Traffic Monitor installation, specify them here.

      2. Replace the strings using the commands:

        Блок кода
        languagetext
        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-15/data/pg_hba.conf
        sed -i "s|local[[:space:]]*all[[:space:]]*all[[:space:]]*peer|local   all             all                                     trust|" /var/lib/pgpro/ent-15/data/pg_hba.conf
    6. Create a directory /var/lib/pgpro/ent-15/data/tmp and assign its owner and group using the commands:

      Блок кода
      languagetext
      mkdir -p /var/lib/pgpro/ent-15/data/tmp
      chown postgres:postgres /var/lib/pgpro/ent-15/data/tmp
    7. Start the service postgrespro:

      Блок кода
      languagetext
      systemctl start postgrespro-ent-15.service
    8. Follow the link to load the package pgagent_15-4.2.2-3.rhel7.x86_64.rpm.
    9. Install the package using the command:

      Блок кода
      languagetext
      yum install pgagent_15-4.2.2-3.rhel7.x86_64.rpm
    10. Change the default password of database administrator:

      Блок кода
      languagetext
      su - postgres
      psql -p 5433
      alter user postgres password 'xxXX1234';
    11. Create all required expansions running the queries below:

      Блок кода
      languagetext
      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 pgagent;
    12. To exit, enter the commands:

      Блок кода
      languagetext
      \q
      exit
    13. To configure pgagent user in OS, run the commands:

      Блок кода
      languagetext
      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
    14. 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
    15. Change the privileges, owner and group as per /etc/sudoers.d/iw-pgagent:

      Блок кода
      languagetext
      chmod 440 /etc/sudoers.d/iw-pgagent
      chown root:root /etc/sudoers.d/iw-pgagent
    16. Edit the configuration file /etc/pgagent/pgagent_15.conf using the commands:

      Блок кода
      languagetext
      sed -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent_15.conf
      echo "LD_LIBRARY_PATH=/opt/pgpro/ent-15/lib" >> /etc/pgagent/pgagent_15.conf
    17. Enable the service pgagent, run it and check its status using the commands:

      Блок кода
      languagetext
      systemctl enable pgagent_15
      systemctl start pgagent_15
      systemctl status pgagent_15
    18. Create a directory /u02:

      Блок кода
      languagetext
      mkdir /u02
    19. Mount disk storage in the /u02 directory.

    20. Create the directories for table spaces and their owner and group to postgres:

      Блок кода
      languagetext
      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_15.log and the database logs.

    Якорь
    jatoba-en
    jatoba-en

    Раскрыть
    titleFor Jatoba DBMS
    1. Install an additional package using the command:

      Блок кода
      languagetext
      yum -y install jatoba5-contrib
    2. Create a new file /etc/systemd/system/jatoba-5.service.d/override.conf or add the following content to the existing file:

      Блок кода
      languagetext
      [Service]
      Environment=PGDATA=/u01/postgres
    3. Apply service configuration changes by running the command:

      Блок кода
      languagetext
      systemctl daemon-reload
    4. Create directories for files and archives, change directory owner and group to postgres. Use the commands:

      Блок кода
      languagetext
      mkdir -p /u01/postgres
      chown postgres:postgres /u01/postgres
      mkdir -p /u02/pgdata
      mkdir -p /u02/pgdata1
      mkdir -p /u02/arch
      chown -R postgres:postgres /u02
    5. Initialize the database. For this:
      1. Go to /usr/jatoba-5/bin/:

        Блок кода
        languagetext
        cd /usr/jatoba-5/bin/
      2. Use the initialization command:

        Блок кода
        languagetext
        PGSETUP_INITDB_OPTIONS=" --encoding=UTF8" ./jatoba-setup initdb jatoba-5 --encoding=UTF8 --locale=en_US.UTF-8 -D /u01/postgres
    6. Create a temporary directory and change its owner and group to postgres. Use the commands: 

      Блок кода
      languagetext
      mkdir -p /u01/postgres/tmp
      chown postgres:postgres /u01/postgres/tmp
      Предупреждение
      titleImportant!

      You can create the temporary directory only after the database initialization.

    7. In /u01/postgres/ directory, create iwtm-postgres.conf configuration file:

      Блок кода
      languagetext
      touch /u01/postgres/iwtm-postgres.conf
    8. To iwtm-postgres.conf file, add the following contents:

      Блок кода
      languagetext
      # -----------------------------
      # 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                        # min 128KiB
      
      huge_pages = try                           # on, off, or try
      
      max_locks_per_transaction = 256
      temp_buffers = MB
      work_mem = MB
      effective_cache_size = MB
      
      min_wal_size = MB
      max_wal_size = MB
      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
      
      autovacuum_max_workers = 5
      autovacuum_naptime = 20
      max_parallel_maintenance_workers = 8
      maintenance_work_mem = MB
      autovacuum_freeze_max_age = 1000000000
      
      shared_preload_libraries = 'pg_stat_statements'
      track_io_timing = on
      track_activity_query_size = 32768
      
      constraint_exclusion = off                 # on, off, or partition
      standard_conforming_strings = on
      Предупреждение
      titleImportant!

      In the sample configuration file above, fields for the following parameters are empty:

      • shared_buffers

      • work_mem

      • maintenance_work_mem

      • effective_cache_size

      • temp_buffers

      • min_wal_size

      • max_wal_size

      Configure the parameters in accordance with official PostgreSQL instructions.

    9. Change the configuration file and group owner to postgres:

      Блок кода
      languagetext
      chown postgres:postgres /u01/postgres/iwtm-postgres.conf
    10. To /u01/postgres/postgresql.conf configuration file, add a link to iwtm-postgres.conf. Use the command:

      Блок кода
      languagetext
      echo "include = 'iwtm-postgres.conf'" >> /u01/postgres/postgresql.conf
    11. Configure pg_hba.conf access file using the commands:

      Блок кода
      languagetext
      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
    1.  trust|" /u01/postgres/pg_hba.conf

    1. 
      sed -i "s|host[[:space:]]*all[[:space:]]*all[[:space:]]*
    127.0.0.
    1. ::1/
    32
    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   
     all 
    1.         
       127
    1.   0.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
  • Run postgresql service and check its status using the commands:

    systemctl enable postgresql-15
    systemctl start postgresql-15
    systemctl status postgresql-15

  • Change the DB administrator's default password:

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

  • 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
    1. 0/0               md5" >> /u01/postgres/pg_hba.conf
    2. Activate the DBMS as described in Jatoba DBMS Installation Guide.
    3. Run jatoba-5 service and check its status. Use the commands:

      Блок кода
      languagetext
      systemctl enable jatoba-5
      systemctl start jatoba-5
      systemctl status jatoba-5
    4. Install pgAgent from OS repository. Use the command:

      Блок кода
      languagetext
      yum install pgagent_15
    5. Move the files for installation of extensions from postgresql-15 directory to jatoba-5. For this:
      1. Go to /usr/pgsql-15/share:

        Блок кода
        languagetext
        cd /usr/jatoba-5/share/
      2. Use the commands to change directories:

        Блок кода
        languagetext
        cp -R pgagent_15-x.x.x /usr/jatoba-5/share/
        cp extension/* /usr/jatoba-5/share/extension/
        Предупреждение
        titleImportant!

        In the first command, replace pgagent_15-x.x.x with the exact name of the catalogue from /usr/jatoba-5/share/ directory. For example, pgagent_15-4.0.0.

    6. Change the default password for the database administrator. Use the commands:

      Блок кода
      languagetext
      su - postgres
      psql -p 5433
      alter user postgres password 'xxXX1234';
    7. Create extensions by running the requests: 

      Блок кода
      languagetext
      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 pgagent;
    8. To exit, enter the commands:

      Блок кода
      languagetext
      \q

    1. 
      exit
    2. To configure

     pgagent
    1. pgAgent user in the OS, run the commands:

      Блок кода
      languagetext
      mkdir /home/pgagent
      touch /home/pgagent/.
    pgpass
    1. pgpass 
      echo "127.0.0.1:5433:postgres:postgres:xxXX1234" > /home/pgagent/.pgpass

    1. 
      chmod 0600 /home/pgagent/.pgpass

    1. 
      chown pgagent:pgagent /home/pgagent/.pgpass

    1. 
      usermod -s
    /bin/bash pgagent file
    1.  /bin/bash pgagent
      sed -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent_15.conf
    2. Create or edit

    the
    1. /etc/sudoers.d/pgagentfile, so that the content looks as follows:

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

    running the commands:
    1. file, change owner and group by running:

      Блок кода
      languagetext
      chmod 440 /etc/sudoers.d/pgagent

    1. 
      chown root:root /etc/sudoers.d/pgagent
    2. Run pgagent_15 service and

    check
    1. change its status

    using
    1. . Use the commands:

      Блок кода
      languagetext
      systemctl enable pgagent
    -
    1. _15

    1. 
      systemctl start pgagent
    -
    1. _15

    1. 
      systemctl status pgagent
    -
    1. _15
    Finalising the configuration

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

    -

    _15.log

     and database logs

     file.

    Якорь
    tantor-en
    tantor-en

    Раскрыть
    titleFor
    Postges Pro Enterprise systemctl stop postgrespro-ent
    Tantor DBMS
    1. Stop

    postgrespro and pgagent services operation using the commands:
    1. tantor-be-server-15 service with the command below:

      Блок кода
      languagetext
      systemctl stop tantor-be-server-15.service
    Copy to
    1. To /var/lib/

    pgpro
    1. postgresql/

    ent
    1. tantor-be-15/data/ directory, copy the existing

    configuration file
    1.  iwtm-postgres.conf configuration file or create

    in this directory
    1. a new

    file
    1. one with the following

    content
    1. contents:

      Блок кода
      language
    c#
    1. text
      # -----------------------------
      # 
    Postgres
    1. Tantor 
    Pro
    1. 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
    1. postgresql/
    ent
    1. tantor-be-15/data/pg_stat_tmp'
      
      autovacuum_max_workers = 5
      autovacuum_naptime = 20
      maintenance_work_mem = 1GB
      autovacuum_freeze_max_age = 
    10000000000
    1. 1000000000
      
      
    shared
    1. #shared_preload_libraries =  'pg_stat_statements'
      track_io_timing = on
      track_activity_query_size = 32768
      
      constraint_exclusion = off                 # on, off, or partition
      standard_conforming_strings = on
      Предупреждение
      titleImportant!
    The
    1. In the sample configuration file

    's content above contains example values as per parameters
    1. above, the values for the following parameters are examplary:

      • shared_buffers

      • work_mem

      • maintenance_work_mem

      • effective_cache_size

      • temp_buffers

      • min_wal_size

      • max_wal_size

      Configure

    these parameters according toofficial instructions.Add to configuration file
    1. the parameters for your system as described in the official PostgreSQL instruction.

    2. Assign rights for iwtm-postgres.conf file to postgres user.

      Блок кода
      languagetext
      chown postgres:postgres /var/lib/postgresql/tantor-be-15/data/iwtm-postgres.conf
    3. To /var/lib/

    pgpro
    1. postgresql/

    ent
    1. tantor-be-15/data/postgresql.conf

    the
    1. configuration file, add a link to

    the file 
    1. iwtm-postgres.conf.

    You can do it using
    1. Use the command:

    echo 
    1. Блок кода
      languagetext
      echo "include = 'iwtm-postgres.conf'"
     
    1.  >>
     
    1.  /var/lib/
    pgpro
    1. postgresql/
    ent
    1. tantor-be-15/data/postgresql.conf
    2. Edit
    the access file 
    1. /var/lib/
    pgpro
    1. postgresql/
    ent
    1. tantor-be-15/data/pg_hba.conf access file:
      1. After

    the strings
      1. these lines:

        Блок кода
        language
    cpp
      1. text
        # IPv6 local connections:
        host    all             all             ::1/128                 md5

        add

    a string
      1. the line:

        Блок кода
        language
    cpp
      1. text
        host    postgres        all             0.0.0.0/0               md5
        Информация
        titleNote:
    The provided values are for
      1. Use the values specified in the line above if you want to install Traffic Monitor

    installation
      1. with default parameters.

    In case you are going to use different values during Traffic Monitor installation
      1. Otherwise, specify

    them
      1. different parameters here.

    Replace the strings
      1. Change lines using the commands:

        Блок кода
        languagetext
        sed -i "s|host[[:space:]]*all[[:space:]]*all[[:space:]]*127.0.0.1/32[[:space:]]*md5|
    host    all             all             127
      1. host    all             all             127.0.0.1/
    32 
      1. 32          
    trust
      1.   trust|" /var/lib/
    pgpro
      1. postgresql/
    ent
      1. tantor-be-15/data/pg_hba.conf

      1. 
        sed -i "s|local[[:space:]]*all[[:space:]]*all[[:space:]]*peer|
    local   all             all                                     trust|"
      1. local   all             all                                     trust|" /var/lib/
    pgpro
      1. postgresql/
    ent
      1. tantor-be-15/data/pg_hba.conf
    1. Create

    a directory
    1. /var/lib/pgpro/ent-15/data/tmpdirectory and assign

    its
    1. owner and group

    using
    1. to it. Use the commands:

      Блок кода
      languagetext
      mkdir
     -p 
    1.  –p /var/lib/
    pgpro
    1. postgresql/
    ent
    1. tantor-be-15/data/tmp

    1. 
      chown
     
    1.  postgres:
    postgres 
    1. postgres /var/lib/
    pgpro
    1. postgresql/
    ent
    1. tantor-be-15/data/tmp
    2. Start

    the
    1. Tantor service

     postgrespro
    1. :

      Блок кода
      languagetext
      systemctl start
    postgrespro-ent
    1.  tantor-be-server-15.service
    Follow the link to load the package
    1. Downoad pgagent_15-4.2.2-3.rhel7.x86_64.rpm package from Yum repository.

    2. Install the package

    using the command:
    yum install
    1. :

      Блок кода
      languagetext
      yum install pgagent_15-4.2.2-3.rhel7.x86_64.rpm
    Change the default password of database administrator:
    su - postgres
    psql -p 5433
    alter user postgres password
    1. Copy the extension files:

      Блок кода
      languagetext
      cp /usr/pgsql-15/share/extension/pgagent* /opt/tantor/db/15/share/postgresql/extension/
    2. Switch user to postgres:

      Блок кода
      languagetext
      su - postgres
    3. Connect to the database:

      Блок кода
      languagetext
      psql -p 5433
    4. Change default password for database administrator:

      Блок кода
      languagetext
      alter user postgres with password 'xxXX1234';
    5. Create

    all
    1. required

    expansions
    1. extensions by running the

    queries below:
    1. requests:

      Блок кода
      languagetext
      create extension if not exists adminpack;

    1. 
      create extension if not exists dblink;

    1. 
      create extension if not exists lo;

    1. 
      create extension if not exists xml2;

    1. 
      create extension if not exists tablefunc;

    1. 
      create extension if not exists intarray;

    1. 
      create extension if not exists file_fdw;

    1. 
      create extension if not exists "uuid-ossp";

    1. 
      create extension if not exists pgcrypto;

    1. 
      create extension if not exists pgrowlocks;

    1. 
      create extension if not exists autoinc;

    1. 
      create extension if not exists hstore;

    1. 
      create extension if not exists pg_stat_statements;

    1. 
      create extension if not exists pg_buffercache;

    1. 
      create extension if not exists pgagent;
    2. To exit, enter the commands:

      Блок кода
      languagetext
      \q

    1. 
      exit
    2. To configure

    pgagent
    1. pgAgent user in the OS, run the commands:

      Блок кода
      languagetext
      mkdir /home/pgagent/
      touch /home/pgagent/.pgpass

    1. 
      echo "127.0.0.1:5433:postgres:postgres:xxXX1234" > /home/pgagent/.pgpass

    1. 
      chmod 0600 /home/pgagent/.pgpass

    1. 
      chown pgagent:pgagent /home/pgagent/.pgpass

    1. 
      usermod -s /bin/
    bash pgagent
    1. bash pgagent
    2. Create /etc/sudoers.d/iw-pgagent

     
    1. file with the following content:

      Блок кода
      language
    cpp
    1. text
      # allow pgagent to execute any command
      pgagent ALL = (postgres) NOPASSWD: ALL
      Defaults:pgagent !requiretty

      You can do this with the commands:

      Блок кода
      languagetext
      touch /etc/sudoers.d/iw-pgagent
      echo "# allow pgagent to execute any command" > /etc/sudoers.d/iw-pgagent
      echo "pgagent ALL = (postgres) NOPASSWD: ALL" >> /etc/sudoers.d/iw-pgagent
      echo 'Defaults:pgagent !requiretty' >> /etc/sudoers.d/iw-pgagent
    2. Change

    the privileges
    1. permissions, owner and group

    as per 
    1. for /etc/sudoers.d/iw-pgagent file by running:

      Блок кода
      languagetext
      chmod 440 /etc/sudoers.d/iw-pgagent

    1. 
      chown root:root /etc/sudoers.d/iw-pgagent
    2. Edit

    the configuration file
    1.  /etc/pgagent/pgagent_15.conf

    using
    1. configuration file with the commands:

      Блок кода
      languagetext
      sed
     
    1.  -i --follow-symlinks
     
    1.  "s/DBPORT=5432/DBPORT=5433/"
     
    1.  /etc/pgagent/pgagent_15.conf

    1. 
      echo
     
    1.  "LD_LIBRARY_PATH=/opt/tantor/
    pgpro
    1. db/
    ent-
    1. 15/lib/"
     
    1.  >>
     
    1.  /etc/pgagent/pgagent_15.conf
    2. Enable

    the
    1. pgAgent service

     pgagent
    1. ,

    run
    1. start it and check its status

    using
    1. . Use the commands:


    systemctl enable pgagent
    1. Блок кода
      languagetext
      systemctl enable pgagent_15

    1. 
      systemctl start pgagent_15

    1. 
      systemctl status pgagent_15
    2. Create

    a directory
    1.  /u02 directory:

      Блок кода
      languagetext
      mkdir /u02
  • Mount disk storage in the /u02 directory.

    1. Create

    the
    1. directories for

    table spaces
    1. tablespaces and

    their
    1. change owner and group to

     
    1. postgres:

      Блок кода
      languagetext
      mkdir /u02/pgdata

    1. 
      mkdir /u02/pgdata1

    1. 
      mkdir /u02/arch

    1. 
      chown -R postgres:postgres /u02
    When you finish, make sure that there are no critical errors in database logs and in /var/log/pgagent_15.log
    and the database logs
    .