我在 Ubuntu 22.04 上安装了 PostgreSQL 和 PostGIS。
我可以从 QGIS 访问 PostGIS-Layers 并使用它们。
当我使用以下命令检查 PostgreSQL 的状态时:sudo systemctl status postgresql
它返回:Active: active (exited)
。
我的 apache 有以下状态:Active: active (running)
。我预计 PostgreSQL 也会有同样的状态。
那么这是什么exited
意思?
日志文件说:
postgres@postgres FATAL: password authentication failed for user "postgres"
postgres@postgres DETAIL: User "postgres" has no password assigned.
Run Code Online (Sandbox Code Playgroud)
但我使用其他数据库名和用户名,而不是 postgres。那我可以忽略这个吗?
该postgresql
服务是“伞”服务,其目的是启动或停止指定的服务,postgresql@version-instance
这些服务是您感兴趣的实际服务。
要获取这些状态,请运行sudo systemctl status 'postgresql*'
例如,在我的 Ubuntu 22.04 系统上,我有 3 个正在运行的 postgres 实例,其输出如下。可以看到实际的PostgreSQL实例对应的服务状态为active(正在运行)。
\n$ sudo systemctl status 'postgresql*'\n\xe2\x97\x8f postgresql.service - PostgreSQL RDBMS\n Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabl>\n Active: active (exited) since Wed 2022-12-07 11:45:54 CET; 3h 13min ago\n Process: 1258 ExecStart=/bin/true (code=exited, status=0/SUCCESS)\n Main PID: 1258 (code=exited, status=0/SUCCESS)\n CPU: 1ms\n\nd\xc3\xa9c. 07 11:45:54 cyan systemd[1]: Starting PostgreSQL RDBMS...\nd\xc3\xa9c. 07 11:45:54 cyan systemd[1]: Finished PostgreSQL RDBMS.\n\n\xe2\x97\x8f postgresql@15-main.service - PostgreSQL Cluster 15-main\n Loaded: loaded (/lib/systemd/system/postgresql@.service; enabled-runtime; vendor pres>\n Active: active (running) since Wed 2022-12-07 11:45:54 CET; 3h 13min ago\n Process: 1006 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 15-main start>\n Main PID: 1173 (postgres)\n Tasks: 6 (limit: 9397)\n Memory: 30.8M\n CPU: 1.208s\n CGroup: /system.slice/system-postgresql.slice/postgresql@15-main.service\n \xe2\x94\x9c\xe2\x94\x801173 /usr/lib/postgresql/15/bin/postgres -D /var/lib/postgresql/15/main -c >\n \xe2\x94\x9c\xe2\x94\x801186 "postgres: 15/main: checkpointer " "" "" "" "" "" "" "" "" "" "" "" "">\n \xe2\x94\x9c\xe2\x94\x801187 "postgres: 15/main: background writer " "" "" "" "" "" "" "" "" "" "" >\n \xe2\x94\x9c\xe2\x94\x801190 "postgres: 15/main: walwriter " "" "" "" "" "" "" "" "" "" "" "" "" "">\n \xe2\x94\x9c\xe2\x94\x801192 "postgres: 15/main: autovacuum launcher " "" "" "" "" "" "" "" "" "" ">\n \xe2\x94\x94\xe2\x94\x801193 "postgres: 15/main: logical replication launcher " "" "" "" "" "" "" ">\n\nd\xc3\xa9c. 07 11:45:51 cyan systemd[1]: Starting PostgreSQL Cluster 15-main...\nd\xc3\xa9c. 07 11:45:54 cyan systemd[1]: Started PostgreSQL Cluster 15-main.\n\n\xe2\x97\x8f postgresql@14-main.service - PostgreSQL Cluster 14-main\n Loaded: loaded (/lib/systemd/system/postgresql@.service; enabled-runtime; vendor pres>\n Active: active (running) since Wed 2022-12-07 11:45:54 CET; 3h 13min ago\n Process: 1005 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 14-main start>\n Main PID: 1170 (postgres)\n Tasks: 7 (limit: 9397)\n Memory: 28.7M\n CPU: 1.338s\n CGroup: /system.slice/system-postgresql.slice/postgresql@14-main.service\n \xe2\x94\x9c\xe2\x94\x801170 /usr/lib/postgresql/14/bin/postgres -D /var/lib/postgresql/14/main -c >\n \xe2\x94\x9c\xe2\x94\x801191 "postgres: 14/main: checkpointer " "" "" "" "" "" "" "" "" "" "" "" "">\n \xe2\x94\x9c\xe2\x94\x801194 "postgres: 14/main: background writer " "" "" "" "" "" "" "" "" "" "" >\n \xe2\x94\x9c\xe2\x94\x801195 "postgres: 14/main: walwriter " "" "" "" "" "" "" "" "" "" "" "" "" "">\n \xe2\x94\x9c\xe2\x94\x801196 "postgres: 14/main: autovacuum launcher " "" "" "" "" "" "" "" "" "" ">\n \xe2\x94\x9c\xe2\x94\x801197 "postgres: 14/main: stats collector " "" "" "" "" "" "" "" "" "" "" "">\n \xe2\x94\x94\xe2\x94\x801198 "postgres: 14/main: logical replication launcher " "" "" "" "" "" "" ">\n\nd\xc3\xa9c. 07 11:45:51 cyan systemd[1]: Starting PostgreSQL Cluster 14-main...\nd\xc3\xa9c. 07 11:45:54 cyan systemd[1]: Started PostgreSQL Cluster 14-main.\n\n postgresql@11-main.service - PostgreSQL Cluster 11-main\n Loaded: loaded (/lib/systemd/system/postgresql@.service; enabled-runtime; vendor pres>\n Active: active (running) since Wed 2022-12-07 11:45:54 CET; 3h 13min ago\n Process: 1004 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 11-main start>\n Main PID: 1169 (postgres)\n Tasks: 7 (limit: 9397)\n Memory: 36.0M\n CPU: 3.656s\n CGroup: /system.slice/system-postgresql.slice/postgresql@11-main.service\n \xe2\x94\x9c\xe2\x94\x801169 /usr/lib/postgresql/11/bin/postgres -D /var/lib/postgresql/11/main -c >\n \xe2\x94\x9c\xe2\x94\x801200 "postgres: 11/main: checkpointer " "" "" "" "" "" "" "" "" "" "" "" >\n \xe2\x94\x9c\xe2\x94\x801201 "postgres: 11/main: background writer " "" "" "" "" "" "" "" "" "" ">\n \xe2\x94\x9c\xe2\x94\x801202 "postgres: 11/main: walwriter " "" "" "" "" "" "" "" "" "" "" "" "" >\n \xe2\x94\x9c\xe2\x94\x801203 "postgres: 11/main: autovacuum launcher " "" "" "" "" "" "" "" "" "">\n \xe2\x94\x9c\xe2\x94\x801204 "postgres: 11/main: stats collector " "" "" "" "" "" "" "" "" "" "" >\n \xe2\x94\x94\xe2\x94\x801205 "postgres: 11/main: logical replication launcher " "" "" "" "" "" "">\n\nd\xc3\xa9c. 07 11:45:51 cyan systemd[1]: Starting PostgreSQL Cluster 11-main...\nd\xc3\xa9c. 07 11:45:54 cyan systemd[1]: Started PostgreSQL Cluster 11-main.\n
Run Code Online (Sandbox Code Playgroud)\n