PostgreSQL 9.2 服务不断失败
PostgreSQL 9.2 service continually failing
我有一个 CentOS 7 minimal VM 运行ning PGSQL 来做一些测试,但不知何故,一段时间后,PGSQL 服务似乎失败或损坏,我完全无法重新启动它.我基本上致力于使用 WAL 文件实现时间点恢复,我已经成功了。我不得不重建安装和数据库超过三次,这似乎总是在 之后发生我已经设法让 WAL 归档在新版本上再次工作。我没有对 postgresql.conf
或 pg_hba.conf
文件进行疯狂的更改,而且数据库也没有那么大(40 个表中的数据少于 2GB),所以我无法想象我是怎么做到的似乎一直在破坏数据目录或服务。我喜欢关于如何解决或解决此错误的一些想法。这是我 运行 systemctl status postgresql-9.2
:
时的输出
Job for postgresql-9.2.service failed because the control process exited with error code. See "systemctl status postgresql-9.2.service" and "journalctl -xe" for details.
[root@localhost bin]# systemctl status postgresql-9.2
● postgresql-9.2.service - PostgreSQL 9.2 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-9.2.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2020-01-15 13:09:35 EST; 3min 34s ago
Process: 14407 ExecStart=/usr/pgsql-9.2/bin/pg_ctl start -D ${PGDATA} -s -w -t 300 (code=exited, status=1/FAILURE)
Process: 14578 ExecStartPre=/usr/pgsql-9.2/bin/postgresql92-check-db-dir ${PGDATA} (code=exited, status=1/FAILURE)
Main PID: 10787 (code=exited, status=0/SUCCESS)
Jan 15 13:09:35 localhost.localdomain systemd[1]: Starting PostgreSQL 9.2 database s....
Jan 15 13:09:35 localhost.localdomain systemd[1]: postgresql-9.2.service: control pr...1
Jan 15 13:09:35 localhost.localdomain systemd[1]: Failed to start PostgreSQL 9.2 dat....
Jan 15 13:09:35 localhost.localdomain systemd[1]: Unit postgresql-9.2.service entere....
Jan 15 13:09:35 localhost.localdomain systemd[1]: postgresql-9.2.service failed.
下面是 journalctl -xe
命令显示的内容:
-- Unit postgresql-9.2.service has begun starting up.
Jan 15 13:09:35 localhost.localdomain postgresql92-check-db-dir[14578]: "/var/lib/pgsql/9.2/data/" is missing or empty.
Jan 15 13:09:35 localhost.localdomain postgresql92-check-db-dir[14578]: Use "/usr/pgsql-9.2/bin/postgresql92-setup initdb" to initialize the database cluster.
Jan 15 13:09:35 localhost.localdomain postgresql92-check-db-dir[14578]: See /usr/share/doc/postgresql92-9.2.24/README.rpm-dist for more information.
Jan 15 13:09:35 localhost.localdomain polkitd[715]: Unregistered Authentication Agent for unix-process:14572:4358382 (system bus name :1.215, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Jan 15 13:09:35 localhost.localdomain systemd[1]: postgresql-9.2.service: control process exited, code=exited status=1
Jan 15 13:09:35 localhost.localdomain systemd[1]: Failed to start PostgreSQL 9.2 database server.
-- Subject: Unit postgresql-9.2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit postgresql-9.2.service has failed.
--
-- The result is failed.
Jan 15 13:09:35 localhost.localdomain systemd[1]: Unit postgresql-9.2.service entered failed state.
Jan 15 13:09:35 localhost.localdomain systemd[1]: postgresql-9.2.service failed.
Jan 15 13:16:01 localhost.localdomain anacron[14339]: Job `cron.daily' started
Jan 15 13:16:01 localhost.localdomain run-parts(/etc/cron.daily)[14590]: starting logrotate
Jan 15 13:16:01 localhost.localdomain run-parts(/etc/cron.daily)[14595]: finished logrotate
Jan 15 13:16:01 localhost.localdomain run-parts(/etc/cron.daily)[14597]: starting man-db.cron
Jan 15 13:16:04 localhost.localdomain run-parts(/etc/cron.daily)[17612]: finished man-db.cron
Jan 15 13:16:04 localhost.localdomain anacron[14339]: Job `cron.daily' terminated
Jan 15 13:16:04 localhost.localdomain anacron[14339]: Normal exit (1 job run)
我找不到任何特定于 PGSQL 的日志(/var/log/
中没有任何与 PGSQL 相关的内容,数据目录中也没有任何内容),因此故障排除变得非常困难。感谢您的帮助!
疑难解答提示:
找到 PostgreSQL 日志(可能在 /var/lib/pgsql/9.2/data
下的某处)并阅读它。
尝试以用户 postgres
和
的身份手动启动 PostgreSQL
postgres -D /path/to/the/data/directory
看看你得到了什么。
使用旧版 9.2 以外的 PostgreSQL 版本。
我有一个 CentOS 7 minimal VM 运行ning PGSQL 来做一些测试,但不知何故,一段时间后,PGSQL 服务似乎失败或损坏,我完全无法重新启动它.我基本上致力于使用 WAL 文件实现时间点恢复,我已经成功了。我不得不重建安装和数据库超过三次,这似乎总是在 之后发生我已经设法让 WAL 归档在新版本上再次工作。我没有对 postgresql.conf
或 pg_hba.conf
文件进行疯狂的更改,而且数据库也没有那么大(40 个表中的数据少于 2GB),所以我无法想象我是怎么做到的似乎一直在破坏数据目录或服务。我喜欢关于如何解决或解决此错误的一些想法。这是我 运行 systemctl status postgresql-9.2
:
Job for postgresql-9.2.service failed because the control process exited with error code. See "systemctl status postgresql-9.2.service" and "journalctl -xe" for details.
[root@localhost bin]# systemctl status postgresql-9.2
● postgresql-9.2.service - PostgreSQL 9.2 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-9.2.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Wed 2020-01-15 13:09:35 EST; 3min 34s ago
Process: 14407 ExecStart=/usr/pgsql-9.2/bin/pg_ctl start -D ${PGDATA} -s -w -t 300 (code=exited, status=1/FAILURE)
Process: 14578 ExecStartPre=/usr/pgsql-9.2/bin/postgresql92-check-db-dir ${PGDATA} (code=exited, status=1/FAILURE)
Main PID: 10787 (code=exited, status=0/SUCCESS)
Jan 15 13:09:35 localhost.localdomain systemd[1]: Starting PostgreSQL 9.2 database s....
Jan 15 13:09:35 localhost.localdomain systemd[1]: postgresql-9.2.service: control pr...1
Jan 15 13:09:35 localhost.localdomain systemd[1]: Failed to start PostgreSQL 9.2 dat....
Jan 15 13:09:35 localhost.localdomain systemd[1]: Unit postgresql-9.2.service entere....
Jan 15 13:09:35 localhost.localdomain systemd[1]: postgresql-9.2.service failed.
下面是 journalctl -xe
命令显示的内容:
-- Unit postgresql-9.2.service has begun starting up.
Jan 15 13:09:35 localhost.localdomain postgresql92-check-db-dir[14578]: "/var/lib/pgsql/9.2/data/" is missing or empty.
Jan 15 13:09:35 localhost.localdomain postgresql92-check-db-dir[14578]: Use "/usr/pgsql-9.2/bin/postgresql92-setup initdb" to initialize the database cluster.
Jan 15 13:09:35 localhost.localdomain postgresql92-check-db-dir[14578]: See /usr/share/doc/postgresql92-9.2.24/README.rpm-dist for more information.
Jan 15 13:09:35 localhost.localdomain polkitd[715]: Unregistered Authentication Agent for unix-process:14572:4358382 (system bus name :1.215, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
Jan 15 13:09:35 localhost.localdomain systemd[1]: postgresql-9.2.service: control process exited, code=exited status=1
Jan 15 13:09:35 localhost.localdomain systemd[1]: Failed to start PostgreSQL 9.2 database server.
-- Subject: Unit postgresql-9.2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit postgresql-9.2.service has failed.
--
-- The result is failed.
Jan 15 13:09:35 localhost.localdomain systemd[1]: Unit postgresql-9.2.service entered failed state.
Jan 15 13:09:35 localhost.localdomain systemd[1]: postgresql-9.2.service failed.
Jan 15 13:16:01 localhost.localdomain anacron[14339]: Job `cron.daily' started
Jan 15 13:16:01 localhost.localdomain run-parts(/etc/cron.daily)[14590]: starting logrotate
Jan 15 13:16:01 localhost.localdomain run-parts(/etc/cron.daily)[14595]: finished logrotate
Jan 15 13:16:01 localhost.localdomain run-parts(/etc/cron.daily)[14597]: starting man-db.cron
Jan 15 13:16:04 localhost.localdomain run-parts(/etc/cron.daily)[17612]: finished man-db.cron
Jan 15 13:16:04 localhost.localdomain anacron[14339]: Job `cron.daily' terminated
Jan 15 13:16:04 localhost.localdomain anacron[14339]: Normal exit (1 job run)
我找不到任何特定于 PGSQL 的日志(/var/log/
中没有任何与 PGSQL 相关的内容,数据目录中也没有任何内容),因此故障排除变得非常困难。感谢您的帮助!
疑难解答提示:
找到 PostgreSQL 日志(可能在
/var/lib/pgsql/9.2/data
下的某处)并阅读它。尝试以用户
的身份手动启动 PostgreSQLpostgres
和postgres -D /path/to/the/data/directory
看看你得到了什么。
使用旧版 9.2 以外的 PostgreSQL 版本。