2016-03-02 179 views
0

我安裝了Centos 7,64位。安裝postgresql-9.4。 用命令初始化PostgreSQL的centos 7 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. 

回答

0

- 安裝包Psmisc做,得到killall上的Postgres

#百勝安裝Psmisc做

- 運行殺

#killall -9 postgres的

- 開始/停止

#systemctl停止postgresql- 9.4
#systemctl啓動postgresql- 9.4

- 要檢查該服務是否在執行,

#PS -aux | grep postgres