Postgreslq 服务处于活动状态但已停止

Postgreslq 服务处于活动状态但已停止

在 Ubuntu 20.04 上,我有一个 Postgresql 服务处于活动状态,但未运行

~$ sudo systemctl status postgresql
[sudo] password di ______: 
● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
     Active: active (exited) since Tue 2020-12-01 08:18:18 CET; 4h 9min ago
    Process: 1318 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
   Main PID: 1318 (code=exited, status=0/SUCCESS)

dic 01 08:18:18 ThinkPad-T440 systemd[1]: Starting PostgreSQL RDBMS...
dic 01 08:18:18 ThinkPad-T440 systemd[1]: Finished PostgreSQL RDBMS.

为什么它会停下来?

我该如何解决这个问题?

谢谢

答案1

它按预期工作。postgresql是一种用于启动不同 PostgreSQL 实例的服务,每个实例都是一个不同的服务。

用于sudo systemctl status 'postgresql*'查看所有 PostgreSQL 服务的状态。

例子:

$ sudo systemctl status 'postgresql*'
* postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor prese
   Active: active (exited) since Wed 2020-12-02 15:42:08 CET; 9h ago
 Main PID: 1880 (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/postgresql.service

Dec 02 15:42:08 cyan systemd[1]: Starting PostgreSQL RDBMS...
Dec 02 15:42:08 cyan systemd[1]: Started PostgreSQL RDBMS.

* [email protected] - PostgreSQL Cluster 11-main
   Loaded: loaded (/lib/systemd/system/[email protected]; indirect; vendor pre
   Active: active (running) since Wed 2020-12-02 15:42:08 CET; 9h ago
 Main PID: 1166 (postgres)
    Tasks: 7 (limit: 4915)
   CGroup: /system.slice/system-postgresql.slice/[email protected]
           |-1166 /usr/lib/postgresql/11/bin/postgres -D /var/lib/postgresql/11/
           |-1337 postgres: 11/main: checkpointer   
           |-1338 postgres: 11/main: background writer   
           |-1339 postgres: 11/main: walwriter   
           |-1340 postgres: 11/main: autovacuum launcher   
           |-1341 postgres: 11/main: stats collector   
           `-1342 postgres: 11/main: logical replication launcher   

Dec 02 15:42:05 cyan systemd[1]: Starting PostgreSQL Cluster 11-main...
Dec 02 15:42:08 cyan systemd[1]: Started PostgreSQL Cluster 11-main.

相关内容