Planet PostgreSQL Planet PostgreSQL -

Greg Sabino Mullane: Postgres Postmaster File Explained

You may have noticed a file called postmaster.pid inside your data directory. This file gets created when Postgres first starts up, and gets removed on a clean shutdown. It seems to contain some random numbers and strings, but what do they all mean? The file will look like this: 2757 /home/greg/pg/17/data 176540940 5432 /tmp * 8675309 12 ready Here is a quick cheat sheet of the contents: Line Example value Meaning Postgres source code 1 2757 The PID of the parent postgres process LOCK_FILE_LINE_PID 2 /home/greg/pg/17/data The data directory LOCK_FILE_LINE_DATA_DIR 3 176540940 Epoch value of when postgres started LOCK_FILE_LINE_START_TIME 4 5432 Port number postgres is listening on LOCK_FILE_LINE_PORT 5 /tmp Unix socket directory LOCK_FILE_LINE_SOCKET_DIR 6 * TCP/IP interfaces being listened on LOCK_FILE_LINE_LISTEN_ADDR 7 8675309       12 Shared memory key and id LOCK_FILE_LINE_SHMEM_KEY 8 ready Current status LOCK_FILE_LINE_PM_STATUS Why is it called postmaster.pid? The word "postmaster" is a relic from the early days of Postgres. This used to be the name of the main executable. While the main executable[...]

postmaster.pid是Postgres启动时创建的文件,包含父进程PID、数据目录、启动时间、监听端口号、Unix套接字目录、TCP/IP接口、共享内存键和ID以及当前状态。该文件用于判断Postgres是否正在运行。

Postgres greg postmaster.pid sabino 启动时间 数据目录 父进程PID

相关推荐 去reddit讨论