2012-04-08 54 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