postmaster内容
使用cat -n 命令可以查看postmaster.pid
文件内容:
)
根据每一行进行解释,并给出对应的源代码说明
- 13795: 代表Postgres主进程的PID
-
/usr/local/pgsql/data: 代表数据目录
-
1529235109: 代表postmaster文件的创建时间。
-
5432: 代表数据库监听端口,在postgresql.conf中对应
port = 5432
来自源代码说明:
/* The socket number we are listening for connections on */
int PostPortNumber;
- 1
- 2
- /tmp: 代表是unix socket的监听目录,在postgresql.conf中对应
unix_socket_directory = '/tmp'
来自源代码说明:
/* The directory names for Unix socket(s) */
char *Unix_socket_directories;
- 1
- 2
- *** **: 代表数据库监听地址,对应postgresql.conf的
listen_addresses = '\* '
来自源代码说明:
/* The TCP listen address(es) */
char *ListenAddresses;
- 1
- 2
- 5432001 163840:代表的是共享内存的地址(shared memory segments中的key和shmid)。
输入ipcs
可以查看:
注: postmaster.pid显示的是key转成10进制后的数字。
- ready 代表主进程状态
typedef enum
{
PM_INIT, /* postmaster starting */
PM_STARTUP, /* waiting for startup subprocess */
PM_RECOVERY, /* in archive recovery mode */
PM_HOT_STANDBY, /* in hot standby mode */
PM_RUN, /* normal "database is alive" state */
PM_WAIT_BACKUP, /* waiting for online backup mode to end */
PM_WAIT_READONLY, /* waiting for read only backends to exit */
PM_WAIT_BACKENDS, /* waiting for live backends to exit */
PM_SHUTDOWN, /* waiting for checkpointer to do shutdown
* ckpt */
PM_SHUTDOWN_2, /* waiting for archiver and walsenders to
* finish */
PM_WAIT_DEAD_END, /* waiting for dead_end children to exit */
PM_NO_CHILDREN /* all important children have exited */
} PMState;