2012-04-08 87 views
5

postgres在這裏的新手!'service postgresql start'無法在Fedora上啓動postgres服務

我編輯pg_hba.conf時提到here,但是當我嘗試重新啓動postgresql服務時,嘗試失敗。下面是帶有我可以收集的所有信息的命令行輸出。

[[email protected] modules]# service postgresql restart 
Redirecting to /bin/systemctl restart postgresql.service 
Job failed. See system logs and 'systemctl status' for details. 
[[email protected] modules]# systemctl status postgresql.service 
postgresql.service - PostgreSQL database server 
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled) 
     Active: failed since Sun, 08 Apr 2012 21:29:06 +0530; 14s ago 
    Process: 12228 ExecStop=/usr/bin/pg_ctl stop -D ${PGDATA} -s -m fast (code=exited, status=0/SUCCESS) 
    Process: 12677 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=1/FAILURE) 
    Process: 12672 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS) 
    Main PID: 12184 (code=exited, status=0/SUCCESS) 
     CGroup: name=systemd:/system/postgresql.service 
[[email protected] modules]# tail /var/log/messages 
.... 
Apr 8 21:29:06 arunpc systemd[1]: postgresql.service: control process exited, code=exited status=1 
Apr 8 21:29:06 arunpc systemd[1]: Unit postgresql.service entered failed state. 
Apr 8 21:29:06 arunpc pg_ctl[12677]: pg_ctl: could not start server 
Apr 8 21:29:06 arunpc pg_ctl[12677]: Examine the log output. 

FWIW,這裏使用的配置文件(pg_hba.conf中):

# TYPE DATABASE  USER   ADDRESS     METHOD 

# "local" is for Unix domain socket connections only 
local all    postgres        ident sameuser 
local all    all          ident sameuser 
# IPv4 local connections: 
host all    all    127.0.0.1    password 
# IPv6 local connections: 
host all    all    ::1      password 

可能是什麼錯誤嗎?在我編輯之前它曾經工作得很好(因爲這是一個開發機器,所以我精彩地沒有做任何備份)。

我也想得到更詳細的日誌輸出。/var/log/messages文件中的日誌消息確實要求我「檢查日誌輸出」 - 哪個日誌輸出會是這樣?我可以採取哪些其他故障排除步驟?

非常感謝提前!

+2

日誌文件應該在/ var/lib/pgsql/data/pg_log中 – 2012-04-08 21:39:31

回答

6

根據您的啓動腳本,它可能會將postmaster的輸出重定向到一個文件。這通常是PGDATA目錄中的server.log。我想嘗試的東西:

  • 註釋掉pg_hba.conf中的所有內容並重試。如果問題是該文件中的語法錯誤,那麼註釋出錯的行將允許服務器啓動,然後您可以一次取消註釋,直到找到錯誤。

  • 直接從shell啓動postmaster而不發送它到後臺。只需運行postmaster -D <pgdata dir>,它應該會出現一些更有用的日誌。

+0

謝謝。日誌文件位於PGDATA/pg_log目錄中。顯然配置線缺少地址掩碼。 – ARV 2012-04-09 06:52:53

+0

我認爲你的意思是'postgres'不是'postmaster'。 – 2017-06-06 00:28:15