Linux postgresql服务未在RHEL 7上运行

Linux postgresql服务未在RHEL 7上运行,linux,postgresql,systemd,postgresql-8.4,rhel7,Linux,Postgresql,Systemd,Postgresql 8.4,Rhel7,我们有一个运行在RHEL6/32位和RHEL6/64位上的应用程序。此应用程序从一开始就使用postgresql 8.4。现在,我们希望在RHEL7/64位上为该应用程序提供支持。RHEL7在其yum列表中附带了默认的postgresql9.2,该版本正在安装中,其相关服务也在正常运行。但在RHEL7上安装postgresql 8.4之后,这些服务似乎从未运行过。请查看以下日志: [root@linpubn218 postgres]# service postgresql status post

我们有一个运行在RHEL6/32位和RHEL6/64位上的应用程序。此应用程序从一开始就使用postgresql 8.4。现在,我们希望在RHEL7/64位上为该应用程序提供支持。RHEL7在其yum列表中附带了默认的postgresql9.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可以安装在RHEL7上吗?RHEL7是基于systemd的操作系统?如果是,那么我应该怎么做才能删除上述错误?

通常,权限会导致此类错误

su - postgres
之后:

chmod 700 -R <data_directory>
chmod 700-R

您还应该检查SELinux。

我注意到在
/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"

然后重新加载
systemctl

# systemctl daemon-reload
#/etc/init.d/postgresql-8.4 start
Starting postgresql-8.4 (via systemctl):                   [  OK  ]

以防万一,您是否在与v9.2不同的端口上运行v8.4?我已从安装RHEL7的新系统中卸载了所有postgresql实例。之后,我尝试新安装postgresql 8.4,它使用默认端口5432I,并检查了权限(700)和SELinux状态(已禁用)。不过,这对我来说并不管用。我没有获取此行指向的资源:postgresql-8.4的作业。服务失败,因为超出了配置的资源限制。其他日志显示PID文件/var/run/postmaster-8.4.PID在启动后不可读(尚未?)。我看不到任何var/run/postmaster-8.4.pid文件。尽管存在另外两个名为postmaster-8.4.5432.pid和postmaster.7654.pid的文件。postgresql 8.4真的可以安装在RHEL7上吗?您是否尝试过
yum安装libstdc++.i686
i准备好了一些人用这个libstdc++.x86\u 64解决了他们的问题。我更新了这个软件包,但是运气不好。同样的问题。
# systemctl daemon-reload
#/etc/init.d/postgresql-8.4 start
Starting postgresql-8.4 (via systemctl):                   [  OK  ]