centos 7 postgresql无法启动

时间:2016-03-02 10:13:27

标签: centos7 postgresql-9.4

我安装了Centos 7,64位。安装postgresql-9.4。 使用命令

初始化postgresql
/usr/pgsql-9.4/bin/postgresql94-setup initdb

然后使用此命令启动postgresql

systemctl start postgresql-9.4

并显示如下错误:

service failed because the control process exited with error code. See "systemctl status postgresql-9.4.service" and "journalctl -xe" for details.

输入命令

systemctl status postgresql-9.4.service
● postgresql-9.4.service - PostgreSQL 9.4 database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql-9.4.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Wed 2016-03-02 18:09:27 CST; 1min 59s ago
  Process: 31266 ExecStart=/usr/pgsql-9.4/bin/pg_ctl start -D ${PGDATA} -s -w -t 300 (code=exited, status=1/FAILURE)
  Process: 31261 ExecStartPre=/usr/pgsql-9.4/bin/postgresql94-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)

Mar 02 18:09:26 localhost.localdomain pg_ctl[31266]: < 2016-03-02 18:09:26.862 CST >LOG:  could not bind IPv6 socket: Address already in use
Mar 02 18:09:26 localhost.localdomain pg_ctl[31266]: < 2016-03-02 18:09:26.862 CST >HINT:  Is another postmaster already running on...retry.
Mar 02 18:09:26 localhost.localdomain pg_ctl[31266]: < 2016-03-02 18:09:26.862 CST >LOG:  could not bind IPv4 socket: Address already in use
Mar 02 18:09:26 localhost.localdomain pg_ctl[31266]: < 2016-03-02 18:09:26.862 CST >HINT:  Is another postmaster already running on...retry.
Mar 02 18:09:26 localhost.localdomain pg_ctl[31266]: < 2016-03-02 18:09:26.862 CST >WARNING:  could not create listen socket for "localhost"
Mar 02 18:09:26 localhost.localdomain pg_ctl[31266]: < 2016-03-02 18:09:26.862 CST >FATAL:  could not create any TCP/IP sockets
Mar 02 18:09:27 localhost.localdomain systemd[1]: postgresql-9.4.service: control process exited, code=exited status=1
Mar 02 18:09:27 localhost.localdomain systemd[1]: Failed to start PostgreSQL 9.4 database server.
Mar 02 18:09:27 localhost.localdomain systemd[1]: Unit postgresql-9.4.service entered failed state.
Mar 02 18:09:27 localhost.localdomain systemd[1]: postgresql-9.4.service failed.

1 个答案:

答案 0 :(得分:0)

1 - 安装psmisc软件包以在Postgres上提供killall

#yum install psmisc

2 - 执行杀戮

#killall -9 postgres

3 - 开始/停止

#systemctl stop postgresql- 9.4
#systemctl start postgresql- 9.4

4 - 检查服务是否正在执行,

#ps -aux | grep postgres