postgresql - postgresql pg_ctl 启动超时
问题描述
我的系统在 CentOS 7.4 上运行,我们使用 systemd 服务来启动 postgresql 9.2.21 服务器。postgresql 由以下命令启动:
ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA}
ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o "-p ${PGPORT}" -w -t 300 -l /tmp/log
pg_ctl 返回的 start 间歇性超时。它因“postgresql.service 启动操作超时”而失败。错误。运行systemctl status postgresql显示如下:
â postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
Active: failed (Result: timeout) since Thu 2020-02-13 15:57:02 PST; 52s ago
Process: 1098 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 -l /tmp/log (code=killed, signal=TERM)
Process: 1021 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
Feb 13 23:52:02 server systemd[1]: Starting PostgreSQL database server...
Feb 13 23:52:03 server pg_ctl[1098]: pg_ctl: another server might be running; trying to start server anyway
Feb 13 15:57:02 server systemd[1]: postgresql.service start operation timed out. Terminating.
Feb 13 15:57:02 server systemd[1]: Failed to start PostgreSQL database server.
Feb 13 15:57:02 server systemd[1]: Unit postgresql.service entered failed state.
Feb 13 15:57:02 server systemd[1]: postgresql.service failed.
pg_ctl 的输出日志:
2020-02-13 23:52:05 UTC LOG: database system was interrupted; last known up at 2020-02-13 23:49:55 UTC
2020-02-13 23:52:21 UTC LOG: database system was not properly shut down; automatic recovery in progress
2020-02-13 23:52:21 UTC LOG: record with zero length at 0/1CEDFD8
2020-02-13 23:52:21 UTC LOG: redo is not required
2020-02-13 23:52:21 UTC LOG: database system is ready to accept connections
2020-02-13 23:52:21 UTC LOG: autovacuum launcher started
2020-02-13 23:57:02 UTC LOG: received smart shutdown request
2020-02-13 23:57:02 UTC LOG: autovacuum launcher shutting down
2020-02-13 23:57:02 UTC LOG: shutting down
2020-02-13 23:57:03 UTC LOG: database system is shut down
上面的日志显示数据库已成功启动,我实际上可以 sql 到数据库,直到数据库被 pg_ctl 关闭。根据 pg_ctl 手册页,它会反复尝试连接到服务器。我想知道为什么 pg_ctl 无法连接到服务器并退出,但我可以在启动期间手动执行此操作。
谢谢帕特里克
解决方案
推荐阅读
- swift - 为什么添加新数据时不调用 .childAdded?火力基地
- html - HTML:图像在移动设备上变得非常小
- python - 根据特定键值组合字典列表
- node.js - 当我尝试运行此代码时,出现以下错误
- c++ - GDB - strcmp 不工作:__strcmp_sse2_unaligned
- android - gradlew 更改 React Native 构建的 jcenter() URL
- python - Django'没有名为'suit.apps'的模块错误
- c# - AJAX 发布到 ASP.NET MVC 控制器操作方法 - 空参数
- java - Android:当我关闭应用程序重新启动时,跟踪 Firestore 中的文档数量
- python - 在 .proto 文件中定义 Any.proto