我正在尝试针对 PostgreSQL 数据库设置运行 Ruby on Rails 的 Windows XP 测试代理。我已经使用默认设置安装了适用于 Windows 的 PostgreSQL 9.2。但是,当我尝试从服务控制面板启动服务时,会出现以下错误消息(与我尝试将其设置为哪个用户无关):
The postgres-9.2 -PostgreSQL Server 9.2 service on Local Computer started and then stopped. Some services
stop automatically if they have work to do, for example, the Performance Logs and Alerts service.
如果我尝试从命令行启动它(无论是 cmd.exe 还是 git bash 都无关紧要):
E:\PostgreSQL\9.2\bin\pg_ctl.exe start -D E:\PostgreSQL\9.2\data
它将声称:
server starting
但是它将无法启动(rake db:migrate 将报告服务器未运行,任务管理器中缺少 postgresql 进程,服务在服务列表中列为关闭,并且
E:\PostgreSQL\9.2\bin\pg_ctl.exe stop -D E:\PostgreSQL\9.2\data
将报告
pg_ctl: PID file "E:/PostgreSQL/9.2/data/postmaster.pid" does not exist Is server running?
尝试通过 pg_ctl 将其作为服务器启动时:
E:\PostgreSQL\9.2\bin\pg_ctl.exe runservice -D E:\PostgreSQL\9.2\data
失败:
pg_ctl: could not start service PostgreSQL: error code 1063
编辑:
pg_hba 的内容:
# TYPE DATABASE USER ADDRESS METHOD
local all all all trust
# IPv4 local connections:
host all all all trust
host all all 127.0.0.1/32 trust
# IPv6 local connections:
#host all all ::1/128 trust
# Allow replication connections from localhost, by a user with the
# replication privilege.
#host replication all all trust
#host replication postgres 127.0.0.1/32 trust
#host replication postgres ::1/128 trust
根据以下评论检查 pg_log:
2012-10-28 22:47:44 PDT LOG: local connections are not supported by this build
2012-10-28 22:47:44 PDT CONTEXT: line 78 of configuration file "E:/PostgreSQL/9.2/data/pg_hba.conf"
2012-10-28 22:47:44 PDT FATAL: could not load pg_hba.conf
第 78 行是
local all all all trust
作为服务运行时(无论是通过 pg_ctl runservice 还是从服务控制面板),仍然会发生相同的错误。然而 pg_ctl start 现在启动 postgres 没有发生任何事件。
我会选择“足够好”
PS:事件日志条目只是说“等待服务器启动超时”