Если планируется использовать уже развернутую базу данных, перед установкой Системы обязательно:
Чтобы подготовить удаленную базу данных соответствующей версии к установке компонентов Traffic Monitor, выполните на сервере базы данных следующие действия:
rpm -Uhv pg_stat_kcache13-2.1.3-1.rhel7.x86_64.rpmrpm -Uhv pg_pathman_13-1.5.12-1.rhel7.x86_64.rpmrpm -Uhv pgagent_13-4.0.0-4.rhel7.x86_64.rpm
postgresql и pgagent, используя команды:systemctl stop postgresql-13systemctl stop pgagent-13
/etc/systemd/system/postgresql-13.service, заменив в строке Environment=PGDATA= указанную директорию на /u01/postgres.sed -i "s|Environment=PGDATA=/var/lib/pgsql/13.2/data /|Environment=PGDATA=/u01/postgres/|" /etc/systemd/system/postgresql-13.service
systemctl daemon-reload
postgres:mkdir -p /u01/postgreschown postgres:postgres /u01/postgresexport PGSETUP_INITDB_OPTIONS=" --encoding=UTF8"/usr/pgsql-13/bin/initdb --encoding=UTF8 --locale=en_US.UTF-8 -D /u01/postgres/mkdir -p /u01/postgres/tmpchown postgres:postgres /u01/postgres/tmpmkdir -p /u02/pgdatachown postgres:postgres /u02/pgdatamkdir -p /u02/pgdata1chown postgres:postgres /u02/pgdata1mkdir -p /u02/archchown postgres:postgres /u02/arch
/u01/postgres/iwtm-postgres.conf. Например, с помощью следующей команды:touch /u01/postgres/iwtm-postgres.conf
Добавьте в файл /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 huge_pages = try # on, off, or try max_locks_per_transaction = 512 temp_buffers = MB work_mem = MB effective_cache_size = MB min_wal_size = MB max_wal_size = MB log_min_duration_statement = 120000 # -1 is disabled, 0 logs all statements track_activity_query_size = 32768 # (change requires restart) log_autovacuum_min_duration = 30000 # -1 disables, 0 logs all actions and stats_temp_directory = '/u01/postgres/pg_stat_tmp' autovacuum_max_workers = 5 autovacuum_naptime = 20 maintenance_work_mem = GB autovacuum_freeze_max_age = 1000000000 shared_preload_libraries = 'pg_stat_statements,pg_stat_kcache,pg_pathman' track_io_timing = on track_activity_query_size = 32768 constraint_exclusion = off # on, off, or partition |
В примере содержимого конфигурационного файла указаны пустые поля значений следующих параметров:
Выполните настройки перечисленных параметров в соответствии с официальной инструкцией (доступна на английском языке). |
postgres:chown postgres:postgres /u01/postgres/iwtm-postgres.conf
Добавьте в конфигурационный файл /u01/postgres/postgresql.conf ссылку на файл iwtm-postgres.conf с помощью команды:
echo "include = 'iwtm-postgres.conf'" >> /u01/postgres/postgresql.conf
pg_hba.conf с помощью команд:sed -i "s|local[[:space:]]*all[[:space:]]*all[[:space:]]*peer|local all all trust|" /u01/postgres/pg_hba.confsed -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.confsed -i "s|host[[:space:]]*all[[:space:]]*all[[:space:]]*::1/128[[:space:]]*ident|host all all ::1/128 trust|" /u01/postgres/pg_hba.confecho "# Enable not local access" >> /u01/postgres/pg_hba.confecho "host postgres all 0.0.0.0/0 md5" >> /u01/postgres/pg_hba.conf
postgresql и проверьте его статус с помощью команд:systemctl enable postgresql-13systemctl start postgresql-13systemctl status postgresql-13
su - postgrespsql -p 5433alter user postgres password 'xxXX1234';
create extension if not exists adminpack;create extension if not exists dblink;create extension if not exists lo;create extension if not exists xml2;create extension if not exists tablefunc;create extension if not exists intarray;create extension if not exists file_fdw;create extension if not exists "uuid-ossp";create extension if not exists pgcrypto;create extension if not exists pgrowlocks;create extension if not exists autoinc;create extension if not exists hstore;create extension if not exists pg_stat_statements;create extension if not exists pg_buffercache;create extension if not exists pg_stat_kcache;create extension if not exists pg_pathman;create extension if not exists pgagent;
Для выхода введите команды:
\qexit
pgagent выполните команды:touch /home/pgagent/.pgpassecho "127.0.0.1:5433:postgres:postgres:xxXX1234" > /home/pgagent/.pgpasschmod 0600 /home/pgagent/.pgpasschown pgagent:pgagent /home/pgagent/.pgpassusermod -s /bin/bash pgagent
Создайте или отредактируйте файл /etc/sudoers.d/pgagent, чтобы содержимое соответствовало образцу ниже:
# allow pgagent to execute any command pgagent ALL = (postgres) NOPASSWD: ALL Defaults:pgagent !requiretty |
Измените /etc/sudoers.d/pgagent права, владельца и группу, выполнив команды:
chmod 440 /etc/sudoers.d/pgagentchown root:root /etc/sudoers.d/pgagent
pgagent и проверьте его статус с помощью команд:systemctl enable pgagent-13systemctl start pgagent-13systemctl status pgagent-13
/var/log/pgagent-13.log.