| Sv translation |
|---|
|
Если вы будете использовать уже развернутую базу данных, перед установкой Системы обязательно: Убедитесь, что версия вашей СУБД поддерживается Traffic Monitor. Подробнее см. раздел "Поддерживаемые СУБД" в статье "Аппаратные и программные требования". | Информация |
|---|
| При необходимости обновите СУБД до поддерживаемой версии, для этого используйте официальную инструкцию. Для этого воспользуйтесь официальной инструкцией. |
Если используется одна вы пользуетесь одной из указанных ниже СУБД, выполните предварительную настройку:
Настройка СУБДЧтобы подготовить удаленную базу данных к установке компонентов Traffic Monitor, выполните на сервере базы данных следующие действия: | Якорь |
|---|
| postgres12 | postgres12 | | Раскрыть |
|---|
| title | Для СУБД PostgeSQL 12 |
|---|
|
Установите дополнительные пакеты, выполнив команду:
| Блок кода |
|---|
|
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_buffers
work_mem
maintenance_work_mem
effective_cache_size
temp_buffers
min_wal_size
max_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.| Якорь |
|---|
postgres15 | postgres15 | | Раскрыть |
|---|
| title | Для СУБД PostgeSQL 15 |
|---|
|
Установите дополнительные пакеты, выполнив команды:
| Блок кода |
|---|
|
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_buffers
work_mem
maintenance_work_mem
effective_cache_size
temp_buffers
min_wal_size
max_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; |
Для выхода введите команды:
Для настройки в ОС пользователя 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
| Предупреждение |
|---|
|
Пустая строка в конце файла 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.
| Якорь |
|---|
pgpro | pgpro | | Раскрыть |
|---|
| title | Для СУБД Postges Pro Enterprise |
|---|
|
| Информация |
|---|
|
Шаги инструкции относятся к обеим поддерживаемым ОС. Если действие требуется выполнить только для конкретной ОС, об этом будет сказано в описании. |
Установите дополнительный пакет, выполнив команду:
| Блок кода |
|---|
|
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_buffers
work_mem
maintenance_work_mem
effective_cache_size
temp_buffers
min_wal_size
max_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 |
| Раскрыть |
|---|
| title | Если вы выполняете настройку на сервере под управлением РЕД ОС: |
|---|
|
Перейдите в директорию:
| Блок кода |
|---|
cd /usr/lib/systemd/system |
Переименуйте сервисный файл:
| Блок кода |
|---|
mv postgrespro-ent-15.service postgresql-15.service |
Перезагрузите сервер:
Запустите сервис:
| Блок кода |
|---|
|
systemctl start postgresql-15.service |
Перейдите в вашу рабочую директорию.
В нашем примере:
Скопируйте в директорию прилагаемый в поставке архив 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 |
Перейдите в директорию с содержимым архива.Установите пакеты с помощью команды:
| Блок кода |
|---|
|
yum install pgagent_15-4.2.2-3.rhel7.x86_64.rpm |
| Раскрыть |
|---|
| title | Если вы выполняете настройку на сервере под управлением ОС 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; |
Для выхода введите команды:
Для настройки в ОС пользователя 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 с помощью команд:Включите сервис 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:
Смонтируйте в директорию /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.| Якорь |
|---|
jatoba | jatoba | | Раскрыть |
|---|
|
Установите дополнительный пакет, выполнив команду: | Блок кода |
|---|
| 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_buffers
work_mem
maintenance_work_mem
effective_cache_size
temp_buffers
min_wal_size
max_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; |
Для выхода введите команды: Для настройки в ОС пользователя 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. |
| Якорь |
|---|
tantor | tantor | | Раскрыть |
|---|
|
| Информация |
|---|
| Шаги инструкции относятся к обеим поддерживаемым ОС. Если действие требуется выполнить только для конкретной ОС, об этом будет сказано в описании. |
Остановите работу сервиса tantor-be-server-15 с помощью команды: | Блок кода |
|---|
| systemctl stop tantor-be-server-15.service |
Скопируйте в директорию /var/lib/postgresql/tantor-be-15/data/ имеющийся конфигурационный файл iwtm-postgres.conf или создайте там новый со следующим содержимым: | Блок кода |
|---|
| # -----------------------------
# 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 = 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/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 |
| Предупреждение |
|---|
| В образце содержимого конфигурационного файла указаны примерные значения следующих параметров: shared_buffers
work_mem
maintenance_work_mem
effective_cache_size
temp_buffers
min_wal_size
max_wal_size
Выполните настройку перечисленных параметров под вашу систему в соответствии с официальной инструкцией PostreSQL. |
Выдайте пользователю postgres права на файл iwtm-postgres.conf. | Блок кода |
|---|
| chown postgres:postgres /var/lib/postgresql/tantor-be-15/data/iwtm-postgres.conf |
Добавьте в конфигурационный файл /var/lib/postgresql/tantor-be-15/data/postgresql.conf ссылку на файл iwtm-postgres.conf. Используйте команду: | Блок кода |
|---|
| echo "include = 'iwtm-postgres.conf'" >> /var/lib/postgresql/tantor-be-15/data/postgresql.conf |
- Отредактируйте файл доступа
/var/lib/postgresql/tantor-be-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/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 |
Создайте директорию /var/lib/pgpro/ent-15/data/tmp и назначьте ей владельца и группу с помощью команд: | Блок кода |
|---|
| mkdir –p /var/lib/postgresql/tantor-be-15/data/tmp
chown postgres:postgres /var/lib/postgresql/tantor-be-15/data/tmp |
Установите pgAgent: | Раскрыть |
|---|
| title | На сервере под управлением ОС Red Hat Enterprise Linux: |
|---|
| Запустите сервис Tantor: | Блок кода |
|---|
| systemctl start tantor-be-server-15.service |
- Скачайте пакет
pgagent_15-4.2.2-3.rhel7.x86_64.rpm из репозитория Yum. Установите пакет с помощью команды: | Блок кода |
|---|
| yum install pgagent_15-4.2.2-3.rhel7.x86_64.rpm |
|
| Раскрыть |
|---|
| title | На сервере под управлением РЕД ОС: |
|---|
| Запустите сервис Tantor: | Блок кода |
|---|
| systemctl start tantor-be-server-15.service |
Перейдите в вашу рабочую директорию. В нашем примере: - Скопируйте в директорию прилагаемый в поставке архив
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.11.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 |
|
Скопируйте файлы расширения: | Блок кода |
|---|
| cp /usr/pgsql-15/share/extension/pgagent* /opt/tantor/db/15/share/postgresql/extension/ |
Смените пользователя на postgres: Подключитесь к базе данных: Измените для администратора базы данных пароль по умолчанию: | Блок кода |
|---|
| alter user postgres with 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; |
Для выхода введите команды: Для настройки в ОС пользователя 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/iw-pgagent со следующим содержимым: | Блок кода |
|---|
| # allow pgagent to execute any command
pgagent ALL = (postgres) NOPASSWD: ALL
Defaults:pgagent !requiretty |
Вы можете сделать это при помощи команд: | Блок кода |
|---|
| 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 |
Измените /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: | Раскрыть |
|---|
| title | На сервере под управлением ОС Red Hat Enterprise Linux: |
|---|
| Используйте команды: | Блок кода |
|---|
| 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 | На сервере под управлением РЕД ОС: |
|---|
| Используйте команды: | Блок кода |
|---|
| 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 |
|
Включите сервис pgAgent, запустите и проверьте его статус: | Раскрыть |
|---|
| title | На сервере под управлением ОС Red Hat Enterprise Linux: |
|---|
| Используйте команды: | Блок кода |
|---|
| systemctl enable pgagent_15
systemctl start pgagent_15
systemctl status pgagent_15 |
|
| Раскрыть |
|---|
| title | На сервере под управлением РЕД ОС: |
|---|
| Включите сервис: | Блок кода |
|---|
| systemctl enable pgagent-15 |
Внесите изменения в файл /etc/systemd/system/multi-user.target.wants/pgagent-15.service. В разделе Unit в следующих строках: | Блок кода |
|---|
| After=postgresql-15.service
BindsTo=postgresql-15.service |
замените postgresql-15.service на tantor-be-server-15.service: | Блок кода |
|---|
| After=tantor-be-server-15.service
BindsTo=tantor-be-server-15.service |
Запустите сервис и проверьте его статус: | Блок кода |
|---|
| systemctl start pgagent-15
systemctl status pgagent-15 |
|
Создайте директорию /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. |
| Sv translation |
|---|
|
If you plan using a database, which is already deployed, you have to do the following: Make sure the version of your database is supported by Traffic Monitor. For details, see "Supported DBMS" section section of "Аппаратные и программные требования" article article. | Информация |
|---|
| If required, update the DBMS to supported version. To do this, use the official instructions. |
- In case you use one of the DBMS listed below, make the preliminary configuration:
Configuring DBMSTo prepare a remote database for installation of Traffic Monitor components, the following actions should be taken on database server: | Якорь |
|---|
| postgres-en | postgres-en | | Раскрыть |
|---|
|
Install additional packages running the commands:
| Блок кода |
|---|
|
yum -y install pgagent_15* postgresql15-contrib |
Stop postgresql and pgagent services operation using the commands:
| Блок кода |
|---|
|
systemctl stop postgresql-15
systemctl stop pgagent_15 |
Create a file /etc/systemd/system/postgresql-15.service.d/override.conf or add the following content to it:
| Блок кода |
|---|
[Service]
Environment=PGDATA=/u01/postgres |
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 topostgres:
| Блок кода |
|---|
|
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:
| Блок кода |
|---|
|
# -----------------------------
# 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 |
| Предупреждение |
|---|
|
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 "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 |
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 pgagent; |
To exit, enter the commands:
To configure pgagent user in OS, run the commands:
| Блок кода |
|---|
|
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 |
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
| Предупреждение |
|---|
|
Empty line at the end of pgagent file is compulsory. |
Change the privileges, owner and group as per /etc/sudoers.d/pgagent running the commands:
| Блок кода |
|---|
|
chmod 440 /etc/sudoers.d/pgagent
chown root:root /etc/sudoers.d/pgagent |
Run pgagent and check its status using the commands:
| Блок кода |
|---|
|
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 | | Раскрыть |
|---|
| title | For Postges Pro Enterprise DBMS |
|---|
|
Install an additional package using the command: | Блок кода |
|---|
| yum -y install postgrespro-ent-15-contrib |
Stop postgrespro service operation using the command: | Блок кода |
|---|
| systemctl stop postgrespro-ent-15.service |
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: | Блок кода |
|---|
| # -----------------------------
# 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 |
| Предупреждение |
|---|
| 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. |
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: | Блок кода |
|---|
| echo "include = 'iwtm-postgres.conf'" >> /var/lib/pgpro/ent-15/data/postgresql.conf |
- Edit the access file
/var/lib/pgpro/ent-15/data/pg_hba.conf:After the strings: | Блок кода |
|---|
| # IPv6 local connections:
host all all ::1/128 md5 |
add a string: | Блок кода |
|---|
| host postgres all 0.0.0.0/0 md5 |
| Информация |
|---|
| 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. |
Replace the strings using the commands: | Блок кода |
|---|
| 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 |
Create a directory /var/lib/pgpro/ent-15/data/tmp and assign its owner and group using the commands: | Блок кода |
|---|
| mkdir -p /var/lib/pgpro/ent-15/data/tmp
chown postgres:postgres /var/lib/pgpro/ent-15/data/tmp |
Start the service postgrespro: | Блок кода |
|---|
| systemctl start postgrespro-ent-15.service |
- Follow the link to load the package
pgagent_15-4.2.2-3.rhel7.x86_64.rpm. Install the package using the command: | Блок кода |
|---|
| 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 '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 pgagent; |
To exit, enter the commands: To configure pgagent user in OS, run the commands: | Блок кода |
|---|
| 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 |
Create /etc/sudoers.d/iw-pgagent with the following content: | Блок кода |
|---|
| # allow pgagent to execute any command
pgagent ALL = (postgres) NOPASSWD: ALL
Defaults:pgagent !requiretty |
Change the privileges, owner and group as per /etc/sudoers.d/iw-pgagent: | Блок кода |
|---|
| chmod 440 /etc/sudoers.d/iw-pgagent
chown root:root /etc/sudoers.d/iw-pgagent |
Edit the configuration file /etc/pgagent/pgagent_15.conf using the commands: | Блок кода |
|---|
| 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 |
Enable the service pgagent, run it and check its status using the commands:
| Блок кода |
|---|
| systemctl enable pgagent_15
systemctl start pgagent_15
systemctl status pgagent_15 |
Create a directory /u02: Mount disk storage in the /u02 directory. Create the directories for table spaces and their owner and group to postgres: | Блок кода |
|---|
| 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 | | Раскрыть |
|---|
|
Install an additional package using the command: | Блок кода |
|---|
| yum -y install jatoba5-contrib |
Create a new file /etc/systemd/system/jatoba-5.service.d/override.conf or add the following content to the existing file: | Блок кода |
|---|
| [Service]
Environment=PGDATA=/u01/postgres |
Apply service configuration changes by running the command:
| Блок кода |
|---|
| systemctl daemon-reload |
Create directories for files and archives, change directory owner and group to postgres. Use the commands:
| Блок кода |
|---|
| 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 |
- Initialize the database. For this:
Go to /usr/jatoba-5/bin/:
| Блок кода |
|---|
| cd /usr/jatoba-5/bin/ |
Use the initialization command:
| Блок кода |
|---|
| PGSETUP_INITDB_OPTIONS=" --encoding=UTF8" ./jatoba-setup initdb jatoba-5 --encoding=UTF8 --locale=en_US.UTF-8 -D /u01/postgres |
Create a temporary directory and change its owner and group to postgres. Use the commands:
| Блок кода |
|---|
| mkdir -p /u01/postgres/tmp
chown postgres:postgres /u01/postgres/tmp |
| Предупреждение |
|---|
| You can create the temporary directory only after the database initialization. |
In /u01/postgres/ directory, create iwtm-postgres.conf configuration file:
| Блок кода |
|---|
| touch /u01/postgres/iwtm-postgres.conf |
To iwtm-postgres.conf file, add the following contents: | Блок кода |
|---|
| # -----------------------------
# 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 |
| Предупреждение |
|---|
| 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. |
Change the configuration file and group owner to postgres:
| Блок кода |
|---|
| chown postgres:postgres /u01/postgres/iwtm-postgres.conf |
To /u01/postgres/postgresql.conf configuration file, add a link to iwtm-postgres.conf. Use the command:
| Блок кода |
|---|
| echo "include = 'iwtm-postgres.conf'" >> /u01/postgres/postgresql.conf |
Configure pg_hba.conf access file using the commands:
| Блок кода |
|---|
| 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 |
- Activate the DBMS as described in Jatoba DBMS Installation Guide.
Run jatoba-5 service and check its status. Use the commands:
| Блок кода |
|---|
| systemctl enable jatoba-5
systemctl start jatoba-5
systemctl status jatoba-5 |
Install pgAgent from OS repository. Use the command:
| Блок кода |
|---|
| yum install pgagent_15 |
- Move the files for installation of extensions from
postgresql-15 directory to jatoba-5. For this:Go to /usr/pgsql-15/share:
| Блок кода |
|---|
| cd /usr/jatoba-5/share/ |
Use the commands to change directories:
| Блок кода |
|---|
| cp -R pgagent_15-x.x.x /usr/jatoba-5/share/
cp extension/* /usr/jatoba-5/share/extension/ |
| Предупреждение |
|---|
| 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. |
Change the default password for the database administrator. Use the commands:
| Блок кода |
|---|
| su - postgres
psql -p 5433
alter user postgres password 'xxXX1234'; |
Create extensions by running the requests: | Блок кода |
|---|
| 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; |
To exit, enter the commands: To configure pgAgent user in the OS, run the commands: | Блок кода |
|---|
| 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
sed -i --follow-symlinks "s/DBPORT=5432/DBPORT=5433/" /etc/pgagent/pgagent_15.conf |
Create or edit /etc/sudoers.d/pgagent file, so that the content looks as follows: | Блок кода |
|---|
# allow pgagent to execute any command
pgagent ALL = (postgres) NOPASSWD: ALL
Defaults:pgagent !requiretty |
For /etc/sudoers.d/pgagent file, change owner and group by running: | Блок кода |
|---|
| chmod 440 /etc/sudoers.d/pgagent
chown root:root /etc/sudoers.d/pgagent |
Run pgagent_15 service and change its status. Use the commands: | Блок кода |
|---|
| systemctl enable pgagent_15
systemctl start pgagent_15
systemctl status pgagent_15 |
When you finish, make sure that there are no critical errors in database logs and in /var/log/pgagent_15.log file. |
| Якорь |
|---|
tantor-en | tantor-en | | Раскрыть |
|---|
|
Stop tantor-be-server-15 service with the command below:
| Блок кода |
|---|
|
systemctl stop tantor-be-server-15.service |
To /var/lib/postgresql/tantor-be-15/data/ directory, copy the existing iwtm-postgres.conf configuration file or create a new one with the following contents:
| Блок кода |
|---|
|
# -----------------------------
# 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 = 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/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 |
| Предупреждение |
|---|
|
In the sample configuration file 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 the parameters for your system as described in the official PostgreSQL instruction. |
Assign rights for iwtm-postgres.conf file to postgres user.
| Блок кода |
|---|
|
chown postgres:postgres /var/lib/postgresql/tantor-be-15/data/iwtm-postgres.conf |
To /var/lib/postgresql/tantor-be-15/data/postgresql.conf configuration file, add a link to iwtm-postgres.conf.
Use the command:
| Блок кода |
|---|
|
echo "include = 'iwtm-postgres.conf'" >> /var/lib/postgresql/tantor-be-15/data/postgresql.conf |
- Edit
/var/lib/postgresql/tantor-be-15/data/pg_hba.conf access file:After these lines:
| Блок кода |
|---|
|
# IPv6 local connections:
host all all ::1/128 md5 |
add the line:
| Блок кода |
|---|
|
host postgres all 0.0.0.0/0 md5 |
| Информация |
|---|
|
Use the values specified in the line above if you want to install Traffic Monitor with default parameters. Otherwise, specify different parameters here. |
Change lines using the commands:
| Блок кода |
|---|
|
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 |
Create /var/lib/pgpro/ent-15/data/tmp directory and assign owner and group to it. Use the commands:
| Блок кода |
|---|
|
mkdir –p /var/lib/postgresql/tantor-be-15/data/tmp
chown postgres:postgres /var/lib/postgresql/tantor-be-15/data/tmp |
Start Tantor service:
| Блок кода |
|---|
|
systemctl start tantor-be-server-15.service |
Downoad pgagent_15-4.2.2-3.rhel7.x86_64.rpm package from Yum repository.
Install the package:
| Блок кода |
|---|
|
yum install pgagent_15-4.2.2-3.rhel7.x86_64.rpm |
Copy the extension files:
| Блок кода |
|---|
|
cp /usr/pgsql-15/share/extension/pgagent* /opt/tantor/db/15/share/postgresql/extension/ |
Switch user to postgres:
Connect to the database:
Change default password for database administrator:
| Блок кода |
|---|
|
alter user postgres with password 'xxXX1234'; |
Create required extensions by running the requests:
| Блок кода |
|---|
|
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; |
To exit, enter the commands:
To configure pgAgent user in the OS, run the commands:
| Блок кода |
|---|
|
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 |
Create /etc/sudoers.d/iw-pgagent file with the following content:
| Блок кода |
|---|
|
# allow pgagent to execute any command
pgagent ALL = (postgres) NOPASSWD: ALL
Defaults:pgagent !requiretty |
You can do this with the commands:
| Блок кода |
|---|
|
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 |
Change permissions, owner and group for /etc/sudoers.d/iw-pgagent file by running:
| Блок кода |
|---|
|
chmod 440 /etc/sudoers.d/iw-pgagent
chown root:root /etc/sudoers.d/iw-pgagent |
Edit /etc/pgagent/pgagent_15.conf configuration file with the commands:
| Блок кода |
|---|
|
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 |
Enable pgAgent service, start it and check its status. Use the commands:
| Блок кода |
|---|
|
systemctl enable pgagent_15
systemctl start pgagent_15
systemctl status pgagent_15 |
Create /u02 directory:
Create directories for tablespaces and change owner and group to postgres:
| Блок кода |
|---|
|
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 database logs and in /var/log/pgagent_15.log