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

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

Ключ

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

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

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

    Блок кода
    languagetext
    yum -y install postgrespro-ent-15-contrib 
  2. Остановите работу сервиса postgrespro с помощью команды:

    Блок кода
    languagetext
    systemctl stop postgrespro-ent-15.service
  3. Создайте или дополните файл /etc/systemd/system/postgrespro-ent-15.service.d/override.conf следующим содержимым:

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

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

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

    Блок кода
    languagetext
    touch /u01/postgres/iwtm-postgres.conf
  7. Добавьте в файл /u01/postgres/iwtm-postgres.conf:

    Блок кода
    languagetext
    # -----------------------------
    # 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
    enable_partitionwise_join = on
    
    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. Смените у конфигурационного файла владельца и группу на 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. Отредактируйте файл доступа /u01/postgres/pg_hba.conf:
    1. После строк:

      Блок кода
      languagecpp
      # 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|" /u01/postgres/pg_hba.conf
      sed -i "s|local[[:space:]]*all[[:space:]]*all[[:space:]]*peer|local   all             all                                     trust|" /u01/postgres/pg_hba.conf
  11. Раскрыть
    titleЕсли вы выполняете настройку на сервере под управлением РЕД ОС:
    1. Перейдите в директорию:

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

      Блок кода
      languagetext
      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.14-x.x.x.xxx-redos-7x.3x.tar.gz.
    7. Распакуйте архив с помощью команды:

      Блок кода
      languagetext
      tar -xvf iwtm-postgresql-15.14-x.x.x.xxx-redos-7x.3x.tar.gz

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

      Блок кода
      languagetext
      tar -xvf iwtm-postgresql-15.14-7.1016.0.97-redos-7.3.tar.gz
    8. Перейдите в директорию с содержимым архива.
    9. Установите пакет с помощью команды:

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

      Блок кода
      languagetext
      systemctl start postgrespro-ent-15.service
    2. Скачайте по ссылке пакет

      Скачайте пакет pgagent:

    3. Установите пакет с помощью команды:

      Блок кода
      languagetext
      yum install pgagent_15-4.2.2-3.rhel7.x86_64.rpm
    Измените для администратора базы данных пароль по умолчанию
    1. Убедитесь, что пакет установился по пути с базой данных. Если этого не произошло, то переместите его в директорию /opt/pgpro/ent-15/share/extension/.
  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
    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/iw-pgagent со следующим содержимым:

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

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

      Блок кода
      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
    • На РЕД ОС:

      Блок кода
      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
  19. Включите сервис pgagent, запустите его, а затем проверьте его статус с помощью команд:
    • На ОС Red Hat Enterprise Linux:

      Блок кода
      languagetext
      systemctl enable pgagent_15
      systemctl start pgagent_15
      systemctl status pgagent_15
    • На РЕД ОС:

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

    Блок кода
    languagetext
    mkdir /u02
  21. Смонтируйте в директорию директорию /u02 дисковое  дисковое хранилище.
  22. Создайте директории для табличных пространств и смените владельца и группу на 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

To prepare a remote database for installation of Traffic Monitor components, follow these steps on the database server:

  1. Install an additional package using the command:

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

    Блок кода
    languagetext
    systemctl stop postgrespro-ent-15.service
  3. Edit /etc/systemd/system/postgrespro-ent-15.service.d/override.conf file. In case it does not exist, create a new one. Add the following lines to it:

    Блок кода
    languagetext
    [Service]
    Environment=PGDATA=/u01/postgres
  4. In order to apply changes in 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 to postgres:

    Блок кода
    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
  6. Create /u01/postgres/iwtm-postgres.conf file. You can use the command:

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

    Блок кода
    languagetext
    # -----------------------------
    # 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
    
    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
    enable_partitionwise_join = on
    
    constraint_exclusion = off                 # on, off, or partition
    standard_conforming_strings = on
    Предупреждение
    titleВажно!

    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.

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

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

    Блок кода
    languagetext
    echo "include = 'iwtm-postgres.conf'" >> /u01/postgres/postgresql.conf
  10. Edit the access file /u01/postgres/pg_hba.conf:
    1. After the lines:

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

      add the line:

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

      The provided values are suitable 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 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.0.0.1/32            trust|" /u01/postgres/pg_hba.conf
      sed -i "s|local[[:space:]]*all[[:space:]]*all[[:space:]]*peer|local   all             all                                     trust|" /u01/postgres/pg_hba.conf
  11. Start postgrespro service:

    Блок кода
    languagetext
    systemctl start postgrespro-ent-15.service
    Follow the link to load
  12. Load pgagent package:

    package.
  13. Install the package using the command:

    Блок кода
    languagetext
    yum install pgagent_15-4.2.2-3.rhel7.x86_64.rpm
  14. Make sure the package is installed to the database directory. If not, move it to the directory /opt/pgpro/ent-15/share/extension/.
  15. Change the default password for database administrator:

    Блок кода
    languagetext
    su - postgres
    psql -p 5433
    alter user postgres password 'xxXX1234';
  16. Create all required extensions 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;
  17. To exit, enter the commands:

    Блок кода
    languagetext
    \q
    exit
  18. 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
  19. Create /etc/sudoers.d/iw-pgagent file with the following content:

    Блок кода
    languagecpp
    # allow pgagent to execute any command
    pgagent ALL = (postgres) NOPASSWD: ALL
    Defaults:pgagent !requiretty
  20. 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
  21. 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
  22. 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
  23. Create /u02 directory:

    Блок кода
    languagetext
    mkdir /u02
  24. Mount the disk storage into /u02 directory.
  25. Create directories for tablespaces, change the owner and group to postgres:

    Блок кода
    languagetext
    mkdir /u02/pgdata
    mkdir /u02/pgdata1
    mkdir /u02/arch
    chown -R postgres:postgres /u02

Once you have configured the database, make sure that there are no critical errors in /var/log/pgagent_15.log and  and the database logs.