Если вы будете использовать уже развернутую базу данных, перед установкой Системы обязательно:
- Убедитесь, что версия вашей СУБД поддерживается Traffic Monitor:
- Oracle Enterprise 19c
- PostgreSQL 12*
- PostgreSQL 15
- Postgres Pro Enterprise 15*
Jatoba 5
Примечание:
При необходимости обновите СУБД до поддерживаемой версии, для этого используйте официальную инструкцию.
Если используется СУБД PostgreSQL, Postgres Pro Enterprise или Jatoba, выполните предварительную настройку.
Важно!
* Работа с СУБД поддерживается только при установке Traffic Monitor на сервер под управлением следующих ОС:
- PostgreSQL 12 – только при использовании РЕД ОС 7.3 Сертифицированной редакции;
- Postgres Pro Enterprise – только при использовании ОС Red Hat Enterprise Linux или РЕД ОС.
Настройка СУБД
Чтобы подготовить удаленную базу данных к установке компонентов Traffic Monitor, выполните на сервере базы данных следующие действия:
Установите дополнительные пакеты, выполнив команду:
yum -y install pgagent_12* postgresql-contrib
- Убедитесь, что SELinux деактивирован.
С инструкцией по отключению SELinux можно ознакомиться на официальном сайте РЕД ОС. Создайте или дополните файл
/etc/systemd/system/postgresql-12.service.d/override.confследующим содержимым:[Service] Environment=PGDATA=/u01/postgres
Для применения изменений в конфигурации сервиса выполните команду:
systemctl daemon-reload
Создайте директории для файлов и архивов, инициализируйте базу данных:
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
Создайте конфигурационный файл
/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 # 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
Важно!
В примере содержимого конфигурационного файла указаны пустые поля значений следующих параметров:
shared_bufferswork_memmaintenance_work_memeffective_cache_sizetemp_buffersmin_wal_sizemax_wal_size
Выполните настройки перечисленных параметров в соответствии с официальной инструкцией (доступна на английском языке).
Рекурсивно смените директориям
/u02и/u01владельца и группу наpostgres:chown -R postgres:postgres /u02 /u01
Добавьте в конфигурационный файл
/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.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
Запустите сервис
postgresqlи проверьте его статус. Используйте команды:systemctl enable postgresql systemctl start postgresql systemctl status postgresql
Измените для администратора базы данных пароль по умолчанию:
sudo -u postgres psql -p 5433 -c "alter user postgres password 'xxXX1234';"
Создайте требуемые расширения, выполнив запросы:
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;"
Для настройки pgAgent в ОС выполните команды:
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
Создайте или отредактируйте файл
/etc/sudoers.d/pgagent, чтобы содержимое соответствовало образцу ниже:# allow pgagent to execute any command
pgagent ALL = (postgres) NOPASSWD: ALL
Defaults:pgagent !requirettyВажно!
Пустая строка в конце файла
pgagentобязательна.Измените для файла
/etc/sudoers.d/pgagentправа, владельца и группу, выполнив команды:chmod 440 /etc/sudoers.d/pgagent chown root:root /etc/sudoers.d/pgagent
Запустите сервис
pgagentи проверьте его статус с помощью команд:systemctl enable pgagent_12 systemctl start pgagent_12 systemctl status pgagent_12
/var/log/pgagent_12.log.Установите дополнительные пакеты, выполнив команды:
yum -y install pgagent_15* postgresql15-contrib
Остановите работу сервисов
postgresqlиpgagent, используя команды:systemctl stop postgresql-15 systemctl stop pgagent-15
Создайте или дополните файл
/etc/systemd/system/postgresql-15.service.d/override.confследующим содержимым:[Service] Environment=PGDATA=/u01/postgres
Для применения изменений в конфигурации сервиса выполните команду:
systemctl daemon-reload
Создайте директории для файлов и архивов, инициализируйте базу данных и смените директориям владельца и группу на
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
Создайте конфигурационный файл
/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' track_io_timing = on track_activity_query_size = 32768 constraint_exclusion = off # on, off, or partition
Важно!
В примере содержимого конфигурационного файла указаны пустые поля значений следующих параметров:
shared_bufferswork_memmaintenance_work_memeffective_cache_sizetemp_buffersmin_wal_sizemax_wal_size
Выполните настройки перечисленных параметров в соответствии с официальной инструкцией (доступна на английском языке).
Смените у конфигурационного файла владельца и группу на
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.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
Запустите сервис
postgresqlи проверьте его статус с помощью команд:systemctl enable postgresql-15 systemctl start postgresql-15 systemctl status postgresql-15
Измените для администратора базы данных пароль по умолчанию:
su - postgres psql -p 5433 alter 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 pgagent;
Для выхода введите команды:
\q exit
Для настройки в ОС пользователя
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
Создайте или отредактируйте файл
/etc/sudoers.d/pgagent, чтобы содержимое соответствовало образцу ниже:# allow pgagent to execute any command
pgagent ALL = (postgres) NOPASSWD: ALL
Defaults:pgagent !requirettyВажно!
Пустая строка в конце файла
pgagentобязательна.Измените
/etc/sudoers.d/pgagentправа, владельца и группу, выполнив команды:chmod 440 /etc/sudoers.d/pgagent chown root:root /etc/sudoers.d/pgagent
В конфигурационном файле
/etc/pgagent/pgagent_15.confизмените значение параметраDBPORTс5432на5433:sed -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent_15.conf
Запустите сервис
pgagentи проверьте его статус с помощью команд:systemctl enable pgagent_15 systemctl start pgagent_15 systemctl status pgagent_15
/var/log/pgagent_15.log.Примечание:
Шаги инструкции относятся к обеим поддерживаемым ОС. Если действие требуется выполнить только для конкретной ОС, об этом будет сказано в описании.
Установите дополнительный пакет, выполнив команду:
yum -y install postgrespro-ent-15-contrib
Остановите работу сервиса
postgresproс помощью команды:systemctl stop postgrespro-ent-15.service
Скопируйте в директорию
/var/lib/pgpro/ent-15/dataимеющийся конфигурационный файлiwtm-postgres.confили создайте там новый со следующим содержимым:# ----------------------------- # 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
Важно!
В образце содержимого конфигурационного файла указаны примерные значения следующих параметров:
shared_bufferswork_memmaintenance_work_memeffective_cache_sizetemp_buffersmin_wal_sizemax_wal_size
Выполните настройку перечисленных параметров под вашу систему в соответствии с официальной инструкцией.
Добавьте в конфигурационный файл
/var/lib/pgpro/ent-15/data/postgresql.confссылку на файлiwtm-postgres.conf.
Вы можете сделать это командой:echo "include = 'iwtm-postgres.conf'" >> /var/lib/pgpro/ent-15/data/postgresql.conf
- Отредактируйте файл доступа
/var/lib/pgpro/ent-15/data/pg_hba.conf:После строк:
# IPv6 local connections: host all all ::1/128 md5
добавьте строку:
host postgres all 0.0.0.0/0 md5
Примечание:
Указанные значения подходят для установки Traffic Monitor с параметрами по умолчанию. Если при установке Traffic Monitor вы будете использовать другие значения, укажите их здесь.
Замените строки с помощью команд:
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
Создайте директорию
/var/lib/pgpro/ent-15/data/tmpи назначьте ей владельца и группу с помощью команд:mkdir -p /var/lib/pgpro/ent-15/data/tmp chown postgres:postgres /var/lib/pgpro/ent-15/data/tmp
- Если вы выполняете настройку на сервере под управлением РЕД ОС:
Перейдите в директорию:
cd /usr/lib/systemd/system
Переименуйте сервисный файл:
mv postgrespro-ent-15.service postgresql-15.service
Перезагрузите сервер:
reboot
Запустите сервис:
systemctl start postgresql-15.service
Перейдите в вашу рабочую директорию.
В нашем примере:cd /distr
- Скопируйте в директорию прилагаемый в поставке архив
iwtm-postgresql-15.5-x.x.x.xxx-redos-73.tar.gz. Распакуйте архив с помощью команды:
tar -xvf iwtm-postgresql-15.5-x.x.x.xxx-redos-73.tar.gz
В нашем примере:
tar -xvf iwtm-postgresql-15.5-7.10.0.97-redos-73.tar.gz
- Перейдите в директорию с содержимым архива.
Установите пакет
pgagent_15-4.2.2-3.rhel7.x86_64.rpmс помощью команды:yum install pgagent_15-4.2.2-3.rhel7.x86_64.rpm
- Если вы выполняете настройку на сервере под управлением ОС Red Hat Enterprise Linux:
Запустите сервис:
systemctl start postgrespro-ent-15.service
- Скачайте по ссылке пакет
pgagent_15-4.2.2-3.rhel7.x86_64.rpm. Установите пакет с помощью команды:
yum install pgagent_15-4.2.2-3.rhel7.x86_64.rpm
Измените для администратора базы данных пароль по умолчанию:
su - postgres psql -p 5433 alter 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 pgagent;
Для выхода введите команды:
\q exit
Для настройки в ОС пользователя
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
Создайте
/etc/sudoers.d/iw-pgagentсо следующим содержимым:# allow pgagent to execute any command pgagent ALL = (postgres) NOPASSWD: ALL Defaults:pgagent !requiretty
Измените
/etc/sudoers.d/iw-pgagentправа, владельца и группу, выполнив команды:chmod 440 /etc/sudoers.d/iw-pgagent chown root:root /etc/sudoers.d/iw-pgagent
- Отредактируйте конфигурационный файл
/etc/pgagent/pgagent_15.confс помощью команд:На ОС Red Hat Enterprise Linux:
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
На РЕД ОС:
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
- Включите сервис
pgagent, запустите и проверьте его статус с помощью команд:На ОС Red Hat Enterprise Linux:
systemctl enable pgagent_15 systemctl start pgagent_15 systemctl status pgagent_15
На РЕД ОС:
systemctl enable pgagent-15 systemctl start pgagent-15 systemctl status pgagent-15
Создайте директорию
/u02:mkdir /u02
Смонтируйте в директорию
/u02дисковое хранилище.Создайте директории для табличных пространств и смените владельца и группу на
postgres:mkdir /u02/pgdata mkdir /u02/pgdata1 mkdir /u02/arch chown -R postgres:postgres /u02
/var/log/pgagent_15.log или /var/log/pgagent-15.log.Установите дополнительный пакет, выполнив команду:
yum -y install jatoba5-contrib
Создайте или дополните файл
/etc/systemd/system/jatoba-5.service.d/override.confследующим содержимым:[Service] Environment=PGDATA=/u01/postgres
Для применения изменений в конфигурации сервиса выполните команду:
systemctl daemon-reload
Создайте директории для файлов и архивов, смените директориям владельца и группу на
postgres. Используйте команды: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
- Инициализируйте базу данных. Для этого:
Перейдите в директорию
/usr/jatoba-5/bin/:cd /usr/jatoba-5/bin/
Используйте команду инициализации:
PGSETUP_INITDB_OPTIONS=" --encoding=UTF8" ./jatoba-setup initdb jatoba-5 --encoding=UTF8 --locale=en_US.UTF-8 -D /u01/postgres
Создайте временную директорию и смените владельца и группу на
postgres. Используйте команды:mkdir -p /u01/postgres/tmp chown postgres:postgres /u01/postgres/tmp
Важно!
Создание временной директории
tmpдопустимо только после инициализации базы данных.В директории
/u01/postgres/создайте конфигурационный файлiwtm-postgres.conf:touch /u01/postgres/iwtm-postgres.conf
Добавьте в файл
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
Важно!
В примере содержимого конфигурационного файла указаны пустые поля значений следующих параметров:
shared_bufferswork_memmaintenance_work_memeffective_cache_sizetemp_buffersmin_wal_sizemax_wal_size
Выполните настройки перечисленных параметров в соответствии с официальной инструкцией (доступна на английском языке).
Смените у конфигурационного файла владельца и группу на
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.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
- Активируйте СУБД согласно Руководству по установке СУБД Jatoba.
Запустите сервис
jatoba-5и проверьте его статус. Используйте команды:systemctl enable jatoba-5 systemctl start jatoba-5 systemctl status jatoba-5
Установите pgAgent из репозитория ОС с помощью команды:
yum install pgagent_15
- Перенесите файлы для установки расширений из каталога
postgresql-15в каталогjatoba-5. Для этого:Перейдите в
/usr/pgsql-15/share:cd /usr/jatoba-5/share/
Используйте команды смены директорий:
cp -R pgagent_15-x.x.x /usr/jatoba-5/share/ cp extension/* /usr/jatoba-5/share/extension/
Важно!
В первой команде замените имя
pgagent_15-x.x.xна точное название каталога, расположенного в директории/usr/jatoba-5/share/. Например,pgagent_15-4.0.0.
Измените пароль по умолчанию для администратора базы данных. Используйте команды:
su - postgres psql -p 5433 alter 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 pgagent;
Для выхода введите команды:
\q exit
Для настройки в ОС пользователя pgAgent выполните команды:
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
Создайте или отредактируйте файл
/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/pgagent chown root:root /etc/sudoers.d/pgagent
В конфигурационном файле
/etc/pgagent/pgagent_15.confизмените значение параметраDBPORTс5432на5433:sed -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent_15.conf
Запустите сервис
pgagent_15и проверьте его статус с помощью команд:systemctl enable pgagent_15 systemctl start pgagent_15 systemctl status pgagent_15
По завершении настройки убедитесь в отсутствии критических ошибок в логах базы данных и /var/log/pgagent_15.log.
- Нет меток