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

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

Ключ

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

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

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

    Блок кода
    languagetext
    yum -y install jatoba5-contrib
  2. Создайте или дополните файл /etc/systemd/system/jatoba-5.service.d/override.conf следующим содержимым:

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

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

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

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

    Настройте эти параметры в соответствии с официальной инструкцией (на английском).

  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. Для этого:

    1. Перейдите в /usr/pgsql-15/share/:

      Блок кода
      languagetext
      cd /usr/pgsql-15/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

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 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 content:

    Блок кода
    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
    enable_partitionwise_join = on
    
    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|" /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. Activate the DBMS as described in Jatoba DBMS Installation Guide.
  13. Run jatoba-5 service and check its status. Use the commands:

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

    Блок кода
    languagetext
    yum install pgagent_15
  15. 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/pgsql-15/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.

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

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

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

    Блок кода
    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. Create or edit /etc/sudoers.d/pgagent file, so that the content looks as follows:

    Блок кода
    languagetext
    # allow pgagent to execute any command
    pgagent ALL = (postgres) NOPASSWD: ALL
    Defaults:pgagent !requiretty
  21. For /etc/sudoers.d/pgagentfile, change owner and group by running:

    Блок кода
    languagetext
    chmod 440 /etc/sudoers.d/pgagent
    chown root:root /etc/sudoers.d/pgagent
  22. In /etc/pgagent/pgagent_15.conf configuration file, change the value of DBPORT parameter from 5432 to 5433:

    Блок кода
    languagetext
    sed -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent_15.conf
  23. Run pgagent_15 service and check its status. Use the commands:

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

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