Abr*_*m P 0 postgresql service windows-xp
我正在尝试针对PostgreSQL数据库设置运行Ruby on Rails的Windows XP测试代理.我已经安装了PostgreSQL 9.2 for Windows,默认设置.但是,当我尝试从服务控制面板启动服务时,会出现以下错误消息(与我尝试将其设置为的用户无关):
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.
Run Code Online (Sandbox Code Playgroud)
如果我尝试从命令行启动它(cmd.exe或git bash无关紧要):
E:\PostgreSQL\9.2\bin\pg_ctl.exe start -D E:\PostgreSQL\9.2\data
Run Code Online (Sandbox Code Playgroud)
它会声称:
server starting
Run Code Online (Sandbox Code Playgroud)
但是它将无法启动(rake db:migrate将报告服务器未运行,任务管理器中缺少postgresql进程,服务在服务列表中列为向下,并且
E:\PostgreSQL\9.2\bin\pg_ctl.exe stop -D E:\PostgreSQL\9.2\data
Run Code Online (Sandbox Code Playgroud)
会报告
pg_ctl: PID file "E:/PostgreSQL/9.2/data/postmaster.pid" does not exist Is server running?
Run Code Online (Sandbox Code Playgroud)
尝试通过pg_ctl将其作为服务器启动时:
E:\PostgreSQL\9.2\bin\pg_ctl.exe runservice -D E:\PostgreSQL\9.2\data
Run Code Online (Sandbox Code Playgroud)
失败:
pg_ctl: could not start service PostgreSQL: error code 1063
Run Code Online (Sandbox Code Playgroud)
编辑:
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
Run Code Online (Sandbox Code Playgroud)
根据以下评论检入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
Run Code Online (Sandbox Code Playgroud)
第78行是
local all all all trust
Run Code Online (Sandbox Code Playgroud)
作为服务运行时仍然会出现相同的错误(无论是通过pg_ctl runservice还是从服务控制面板).但是pg_ctl start现在开始postgres而没有发生任何事故.
我会选择"足够好"
PS:事件日志条目只是说"超时等待服务器启动"
更新编辑后的问题:
删除pg_hba.conf开头的行local.它们与UNIX套接字连接有关,PostgreSQL不支持这种连接.然后,除非其他东西也是错误的,你应该能够启动PostgreSQL.很可能你是pg_hba.conf从一个在Mac OS X或Linux上讨论PostgreSQL的网站复制并粘贴了一个local支持连接的网站.
如果Pg在修复后仍无法启动pg_hba.conf,请再次检查日志,看看它还在抱怨什么.
顺便说一句,一般来说,我不建议尝试将PostgreSQL作为服务和pg_ctl来自同一数据目录运行.您可能会遇到难以解决的文件系统权限问题,尤其是在Windows上.
除了@ mvp的建议之外,您可能尝试在Administrators组成员的用户下启动PostgreSQL.这是不允许的,并且会失败.我不同意这个政策,但现在就是这样.
默认情况下,9.2设置为在NetworkService下运行,因此不应该是一个问题.如果您将其配置为在不同的用户帐户下运行,这可能是您的问题,并且在手动运行时也可能是问题.
手动启动时,您更有可能没有数据目录的文件系统权限.
顺便说一句,如果E:\是FAT32,那就是你的问题.不支持FAT32.您必须使用NTFS.
你应该真正关注服务器登录E:\PostgreSQL\9.2\data\pg_log和事件查看器,看看是什么导致它无法启动,而不是在黑暗中刺伤.
| 归档时间: |
|
| 查看次数: |
14112 次 |
| 最近记录: |