Глава 35. Устранение неполадок
Postgres Pro предоставляет возможность выгружать состояние серверного процесса путём включения параметра конфигурации crash_info, что может быть полезно для диагностики и отладки. Затем можно сгенерировать файл состояния выгрузки, отправив сигнал 40
(также называемый сигналом выгрузки для диагностики):
kill -40 идентификатор_процесса
Здесь идентификатор_процесса
— идентификатор серверного процесса, для которого нужно выгрузить состояние.
В результате Postgres Pro выгрузит состояние в файл в каталоге $PGDATA/crash_info
по умолчанию или в каталоге, указанном в параметре конфигурации crash_info_location. Имя файла генерируется по следующему шаблону: crash_
. Источники данных для выгрузки состояния можно задать в параметре конфигурации crash_info_dump.ид_файла
_pidид_процесса
.state
В примере ниже показано, как создать и просмотреть файл состояния для серверного процесса с PID 23111
:
-- Создание файла состояния kill -40 23111 -- Исследование каталога crash_info и его содержимого SELECT pg_ls_dir('crash_info'); -- Чтение содержимого файла состояния SELECT pg_read_file('crash_info/crash_1722943138419104_pid23111.state');
Chapter 35. Troubleshooting
Postgres Pro offers the ability to dump the state of a backend process, which can be useful for diagnostic and debugging purposes, by enabling the crash_info configuration parameter. Then the dump state file can be generated by sending the signal 40
(also known as the diagnostic dump signal):
kill -40 backend_pid
Here backend_pid
is the process ID of the backend process to dump.
As a result, Postgres Pro will write the state dump to a file in the $PGDATA/crash_info
directory by default or in the directory specified in the crash_info_location configuration parameter. The file will be named following this pattern: crash_
. You can set the data sources to provide data for a crash dump in the crash_info_dump configuration parameter. file_id
_pidpid
.state
The below example shows how to generate and inspect the state dump file for the backend with PID 23111
:
-- Generate the state dump file kill -40 23111 -- Inspect crash_info directory and its contents SELECT pg_ls_dir('crash_info'); -- Read the contents of the state dump file SELECT pg_read_file('crash_info/crash_1722943138419104_pid23111.state');