问题概述
Linux 下启动PostgreSQL服务时,遇见的这个问题,
在修改配置后,输入指令:
[root@localhost data]# systemctl restart postgresql
重启失败,查看状态,报错,
如下图:
具体内容如下:
[root@localhost data]# systemctl restart postgresql
[root@localhost data]# systemctl stop postgresql
[root@localhost data]# systemctl status postgresql
● postgresql.service - postgreSQL Server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
Active: inactive (dead)
[root@localhost data]# systemctl start postgresql
Job for postgresql.service failed because the control process exited with error code. See "systemctl status postgresql.service" and "journalctl -xe" for details.
[root@localhost data]# systemctl status postgresql
● postgresql.service - postgreSQL Server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
Active: activating (auto-restart) (Result: exit-code) since 二 2024-06-11 16:24:01 CST; 1s ago
Process: 14259 ExecStart=/usr/local/postgresql/bin/pg_ctl -D /usr/local/postgresql/data -l /usr/local/postgresql/data/logs/pgsql.log start (code=exited, status=1/FAILURE)
6月 11 16:24:01 localhost.localdomain systemd[1]: Failed to start postgreSQL Server.
6月 11 16:24:01 localhost.localdomain systemd[1]: Unit postgresql.service entered failed state.
6月 11 16:24:01 localhost.localdomain systemd[1]: postgresql.service failed.
解决办法
关于这个问题,其实很简单,
导致服务启动失败的原因,是因为PostgreSQL的进程ID冲突导致的,
因为变更了配置,PostgreSQL认为服务已变更,所以就冲突了,
只需要删除、修改 PostgreSQL安装目录,/data目录下的 postmaster.pid 即可!
入下图:
停止服务:
[root@localhost data]# systemctl stop postgresql
启动服务:
[root@localhost data]# systemctl start postgresql
查看服务状态(或直接restart,再status):
[root@localhost data]# systemctl status postgresql
启动成功后,状态为 “ active ” ,入下图:
其它补充:
PostgreSQL服务的PID是进程ID,用于标识正在运行PostgreSQL数据库服务的唯一标识符。
在操作系统中,每个进程都有一个唯一的进程ID(PID),这是系统自动分配给进程的身份标识。当程序运行时,系统会自动分配一个PID给该进程。这个PID是临时的,当进程终止后,PID会被系统回收,并可能被分配给新运行的程序。因此,PID不仅是各进程的身份标识,也是操作系统中跟踪和管理进程的重要手段。
在特定的服务中,如MySQL PostgreSQL,PID通常与服务器进程相关联。当启动PostgreSQL服务器时,会创建一个后台进程来处理客户端的连接请求和执行数据库操作。这个后台进程的进程ID就被称为PID。PID对于跟踪和管理服务进程非常重要,因为它允许操作系统和其他管理工具识别、控制和监控正在运行的服务进程。
好了,关于 failed because the control process exited with error code ...(code=exited, status=1/FAILURE) 的解决办法 就写到这儿了,如果还有什么疑问或遇到什么问题欢迎扫码提问,也可以给我留言哦,我会一一详细的解答的。
歇后语:“ 共同学习,共同进步 ”,也希望大家多多关注CSND的IT社区。
作 者: | 华 仔 |
联系作者: | who.seek.me@java98k.vip |
来 源: | 优快云 (Chinese Software Developer Network) |
原 文: | https://blog.youkuaiyun.com/Hello_World_QWP/article/details/139776015 |
版权声明: | 本文为博主原创文章,请在转载时务必注明博文出处! |