2

我们有一个在 RHEL6/32 位和 RHEL6/64 位上运行的应用程序。此应用程序从一开始就使用 postgresql 8.4。现在,我们希望在 RHEL7/64 位上为这个应用程序提供支持。RHEL7 在它的 yum 列表中带有默认的 postgresql 9.2,它正在被安装,它的相关服务也正常运行。但是在 RHEL7 上安装 postgresql 8.4 后,服务似乎永远不会运行。请在以下日志中找到:

[root@linpubn218 postgres]# service postgresql status
postgresql.service - SYSV: PostgreSQL database server.
   Loaded: loaded (/etc/rc.d/init.d/postgresql)
      Active: failed (Result: resources) since Mon 2016-07-25 12:40:28 IST; 2h 0min ago
           Docs: man:systemd-sysv-generator(8)

Jul 25 12:40:26 linpubn218.gl.avaya.com systemd[1]: Starting SYSV: PostgreSQL database server....
Jul 25 12:40:28 linpubn218.gl.avaya.com postgresql[26957]: Starting postgresql service: [  OK  ]
Jul 25 12:40:28 linpubn218.gl.avaya.com systemd[1]: PID file /var/run/postmaster-8.4.pid not readable (yet?) after start.
Jul 25 12:40:28 linpubn218.gl.avaya.com systemd[1]: Failed to start SYSV: PostgreSQL database server..
Jul 25 12:40:28 linpubn218.gl.avaya.com systemd[1]: Unit postgresql.service entered failed state.
Jul 25 12:40:28 linpubn218.gl.avaya.com systemd[1]: postgresql.service failed.
Jul 25 14:33:45 linpubn218.gl.avaya.com systemd[1]: Unit postgresql.service cannot be reloaded because it is inactive.
Jul 25 14:33:45 linpubn218.gl.avaya.com systemd[1]: Unit postgresql.service cannot be reloaded because it is inactive.

查看 journalctl -xe 中的日志后

[root@linpubn218 postgres]# journalctl -xe
Jul 25 14:39:21 linpubn218.gl.avaya.com yum[29260]: Installed: postgresql84-libs-8.4.17-1PGDG.rhel6.x86_64
Jul 25 14:39:45 linpubn218.gl.avaya.com yum[29275]: Installed: postgresql84-8.4.17-1PGDG.rhel6.x86_64
Jul 25 14:40:01 linpubn218.gl.avaya.com useradd[29316]: failed adding user 'postgres', exit code: 9
Jul 25 14:40:02 linpubn218.gl.avaya.com CROND[29320]: (root) CMD (/usr/lib64/sa/sa1 1 1)
Jul 25 14:40:02 linpubn218.gl.avaya.com systemd[1]: Reloading.
Jul 25 14:40:03 linpubn218.gl.avaya.com systemd[1]: Configuration file /usr/lib/systemd/system/auditd.service is marked world-inaccessible. This has no effect as config
Jul 25 14:40:03 linpubn218.gl.avaya.com yum[29309]: Installed: postgresql84-server-8.4.17-1PGDG.rhel6.x86_64
Jul 25 14:42:05 linpubn218.gl.avaya.com polkitd[819]: Registered Authentication Agent for unix-process:29459:43987285 (system bus name :1.292 [/usr/bin/pkttyagent --not
Jul 25 14:42:05 linpubn218.gl.avaya.com systemd[1]: Starting SYSV: PostgreSQL database server....
Jul 25 14:42:06 linpubn218.gl.avaya.com runuser[29473]: pam_unix(runuser-l:session): session closed for user postgres
Jul 25 14:42:08 linpubn218.gl.avaya.com postgresql[29464]: Starting postgresql service: [  OK  ]
Jul 25 14:42:08 linpubn218.gl.avaya.com systemd[1]: PID file /var/run/postmaster-8.4.pid not readable (yet?) after start.
Jul 25 14:42:08 linpubn218.gl.avaya.com systemd[1]: Failed to start SYSV: PostgreSQL database server..

postgresql 8.4 可以安装在基于 systemd 的操作系统 RHEL7 上吗?如果是,那么我应该怎么做才能消除上述错误?

4

2 回答 2

1

我注意到/etc/init.d/postgresql-8.4有一个声明的变量:

pidfile="/var/run/postmaster-${PGMAJORVERSION}.${PGPORT}.pid"

但在systemctl,PIDfile中不一样:

# systemctl show postgresql-8.4.service -p PIDFile PIDFile=/var/run/postmaster-8.4.pid

所以,要解决问题编辑/etc/init.d/postgresql-8.4和替换

pidfile="/var/run/postmaster-${PGMAJORVERSION}.${PGPORT}.pid"

pidfile="/var/run/postmaster-${PGMAJORVERSION}.pid"

然后重新加载systemctl

# systemctl daemon-reload
#/etc/init.d/postgresql-8.4 start
Starting postgresql-8.4 (via systemctl):                   [  OK  ]
于 2016-11-02T09:46:48.770 回答
0

通常权限会导致此类错误

su - postgres

在那之后:

chmod 700 -R <data_directory>

你也应该检查 SELinux。

于 2016-07-25T11:53:24.480 回答