合 PG体系结构之进程结构(Process Architecture)
进程结构(Process Architecture)
PostgreSQL是一个客户端/服务器类型的关系数据库管理系统,具有多进程架构,运行在单个主机上。
1 2 3 4 5 6 7 8 9 10 11 12 | [root@lhrpg /]# ps -ef|grep postgres postgres 14092 1 0 09:46 ? 00:00:00 /usr/pgsql-12/bin/postmaster -D /var/lib/pgsql/12/data/ postgres 14093 14092 0 09:46 ? 00:00:00 postgres: logger postgres 14095 14092 0 09:46 ? 00:00:00 postgres: checkpointer postgres 14096 14092 0 09:46 ? 00:00:00 postgres: background writer postgres 14097 14092 0 09:46 ? 00:00:00 postgres: walwriter postgres 14098 14092 0 09:46 ? 00:00:00 postgres: autovacuum launcher postgres 14099 14092 0 09:46 ? 00:00:00 postgres: archiver postgres 14100 14092 0 09:46 ? 00:00:00 postgres: stats collector postgres 14101 14092 0 09:46 ? 00:00:00 postgres: logical replication launcher postgres 14121 14092 0 09:47 ? 00:00:00 postgres: postgres postgres 172.17.0.1(14877) idle postgres 14139 14092 0 09:47 ? 00:00:00 postgres: postgres postgres 172.17.0.1(14911) idle |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | [pg13@lhrrepmgr64361 ~]$ ps -ef|grep postgres pg13 6806 11347 0 14:32 ? 00:00:00 postgres: pgpool postgres 172.72.6.66(38816) idle pg13 11347 0 0 Apr29 ? 00:00:19 /pg13/pg13/bin/postgres -D /pg13/pgdata pg13 11348 11347 0 Apr29 ? 00:00:00 postgres: logger pg13 11354 11347 0 Apr29 ? 00:00:07 postgres: checkpointer pg13 11355 11347 0 Apr29 ? 00:00:01 postgres: background writer pg13 11357 11347 0 Apr29 ? 00:00:07 postgres: stats collector pg13 18895 11347 0 11:17 ? 00:00:03 postgres: walwriter pg13 18896 11347 0 11:17 ? 00:00:00 postgres: autovacuum launcher pg13 18897 11347 0 11:17 ? 00:00:00 postgres: archiver last was 0000000C0000000100000022.partial pg13 18898 11347 0 11:17 ? 00:00:00 postgres: logical replication launcher pg13 18909 11347 0 11:17 ? 00:00:03 postgres: walsender repmgr 172.72.6.62(51722) streaming 1/22349A48 pg13 18920 11347 0 11:17 ? 00:00:03 postgres: walsender repmgr 172.72.6.63(51920) streaming 1/22349A48 pg13 18916 11347 0 11:17 ? 00:00:04 postgres: repmgr repmgr 172.72.6.62(51742) idle pg13 18935 11347 0 11:17 ? 00:00:05 postgres: repmgr repmgr 172.72.6.63(51970) idle pg13 18936 11347 0 11:17 ? 00:00:00 postgres: repmgr repmgr 172.72.6.64(59288) idle pg13 11362 11347 0 Apr29 ? 00:00:35 postgres: repmgr repmgr 172.72.6.61(59970) idle [pg13@lhrrepmgr64361 ~]$ pstree -p 11347 postgres(11347)─┬─postgres(6806) ├─postgres(11348) ├─postgres(11354) ├─postgres(11355) ├─postgres(11357) ├─postgres(11362) ├─postgres(18895) ├─postgres(18896) ├─postgres(18897) ├─postgres(18898) ├─postgres(18909) ├─postgres(18916) ├─postgres(18920) ├─postgres(18935) └─postgres(18936) |
https://www.interdb.jp/pg/pgsql02.html
多个进程协同管理一个数据库集群通常被称为“PostgreSQL server”,它包含以下类型的进程:
- postgres 服务器进程:postgres服务器进程是所有与数据库集群管理相关进程的父进程。
- backend 进程: 每个backend进程处理由连接的客户机发出的所有查询和语句。
- background 进程: 不同的background 进程执行不同特性的进程(例如,VACUUM进程和CHECKPOINT进程),用于数据库管理。
- replication associated 进程: 与复制相关的进程负责执行流复制。
- background worker 进程:background worker process进程可以执行用户实现的任何处理。
PostgreSQL进程架构示例