本地计算机上的 postgresql-x64-9.6 服务启动然后停止。某些服务在未使用时会自动停止
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/45559610/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The postgresql-x64-9.6 service on local computer started and then stopped. Some services stop automatically if they are not in use
提问by user3931984
Postgresql service not starting in services.msc. it is showing below message while starting PostgreSQL service in Window server 2008 R2.
Postgresql 服务未在 services.msc 中启动。在 Window server 2008 R2 中启动 PostgreSQL 服务时显示以下消息。
" The postgresql-x64-9.6 service on local computer started and then stopped. Some services stop automatically if they are not in use by other services or programs."
“本地计算机上的 postgresql-x64-9.6 服务启动然后停止。如果其他服务或程序未使用某些服务,它们会自动停止。”
回答by Abodesegun Ezekiel
I had this same issue. and i followed @Craig Ringer's advice. when i check the event viewer i got this error.2018-06-18 12:34:11.222 GMT [4200] FATAL: lock file "postmaster.pid" already exists
2018-06-18 12:34:11.222 GMT [4200] HINT: Is another postmaster (PID 6172) running in data directory "C:/Program Files/PostgreSQL/10/data"?
so i deleted the "postmaster.pid" file in my postgreSQL data directory, start the service again and this time around, the service started properly.
This error might be due to incomplete shutdown of the postgreSQL service.
我有同样的问题。我听从了@Craig Ringer 的建议。当我检查事件查看器时出现此错误。2018-06-18 12:34:11.222 GMT [4200] FATAL: lock file "postmaster.pid" already exists
2018-06-18 12:34:11.222 GMT [4200] HINT: Is another postmaster (PID 6172) running in data directory "C:/Program Files/PostgreSQL/10/data"?
所以我删除了 postgreSQL 数据目录中的“postmaster.pid”文件,再次启动服务,这一次,服务正常启动。此错误可能是由于 postgreSQL 服务未完全关闭所致。
回答by Zatin
For some reasons postgresql process is still running in the background.
由于某些原因,postgresql 进程仍在后台运行。
You can encounter this problem if your system forcefully shutdowns down. Solution:
如果您的系统强行关闭,您可能会遇到此问题。解决方案:
Windows + X (Open task Manager - Processes)
Find all running postgresql services and 'End Task'.
Windows + X(打开任务管理器 - 进程)
找到所有正在运行的 postgresql 服务和“结束任务”。
After all processes have ended. You can reopen task manager to ensure no postgres services is running.
在所有过程结束后。您可以重新打开任务管理器以确保没有 postgres 服务正在运行。
- Restart Postgresql server
- 重启 Postgresql 服务器
回答by Hugh
I have an additional answer to the ones here as to why the somewhat misleading error message can occur, which is now a newer version, 12.2 vs 9.6, ("The postgresql-x64-12 - PostgreSQL 12 Server service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.)
我对这里的人有一个额外的答案,即为什么会出现有些误导性的错误消息,它现在是一个较新的版本,12.2 与 9.6,(“本地计算机上的 postgresql-x64-12 - PostgreSQL 12 服务器服务已启动,然后已停止。如果其他服务或程序未使用某些服务,则它们会自动停止。)
Apparently, errors in the pg_hba.conf file will cause the error message above to appear, and the service failed to start.
显然,pg_hba.conf 文件中的错误会导致出现上述错误消息,并且服务无法启动。
In my case, I had edited the file and failed to comment out (#) a comment properly. After much Googling, I never saw that mentioned but DID finally remember to double-check my edits, and there the problem was a simple mistake.
就我而言,我编辑了该文件,但未能正确注释掉 (#) 注释。经过多次谷歌搜索,我从来没有看到提到过,但 DID 终于记得仔细检查我的编辑,问题是一个简单的错误。
I fixed it and the service now starts, no problem.
我修复了它,服务现在启动了,没问题。
-Windows 10 x64 Enterprise 1909 18363.752 -PostgreSQL 12.2 (Windows)
-Windows 10 x64 企业版 1909 18363.752 -PostgreSQL 12.2 (Windows)
回答by Giri
Came across the same error with Postgresql-9.4
in Windows-10.
Postgresql-9.4
在 Windows-10 中遇到同样的错误。
In my case I have a few manual config updates made in postgresql.conf
file, and had to validate the syntax of the configuration changes made in the postgresql.conf
file. I've followed the below steps that fixed the issue.
就我而言,我在postgresql.conf
文件中进行了一些手动配置更新,并且必须验证在postgresql.conf
文件中所做的配置更改的语法。我已按照以下步骤解决了该问题。
- Delete the
postmaster.pid
file in%POSTGRESQL-HOME%/9.4/Data/
directory - Provide correct syntax (or references) in
postgresql.conf
andpg_hba.conf
files - Restart the Postgresql service
- 删除目录中的
postmaster.pid
文件%POSTGRESQL-HOME%/9.4/Data/
- 在
postgresql.conf
和pg_hba.conf
文件中提供正确的语法(或引用) - 重启 Postgresql 服务
回答by Danny
Solved my problem. I have hard coded the path for the hba_file
in the postgresql.conf
. That works. For some reason there is a path name prefix from windows which causes to search in the wrong path for the pg_hba.conf
file. Now this works and I can start the service and open the database.
解决了我的问题。我已经硬编码hba_file
了postgresql.conf
. 这样可行。由于某种原因,windows 中有一个路径名前缀,这会导致在错误的路径中搜索pg_hba.conf
文件。现在这有效,我可以启动服务并打开数据库。
回答by Snidhi Sofpro
Encountered this error on postgresql-x64-10, with the following logged on the Windows Event viewer (Windows logs -> Application):
在 postgresql-x64-10 上遇到此错误,在 Windows 事件查看器(Windows 日志 -> 应用程序)上记录以下内容:
- Info: Waiting for server startup...
- Error: postgres: could not access directory ".../PostgreSQL_10_data": No such file or directory
- Error: Run initdb or pg_basebackup to initialize a PostgreSQL data directory.
- Error: Timed out waiting for server startup
- 信息:等待服务器启动...
- 错误:postgres:无法访问目录“.../PostgreSQL_10_data”:没有那个文件或目录
- 错误:运行 initdb 或 pg_basebackup 以初始化 PostgreSQL 数据目录。
- 错误:等待服务器启动超时
The problem in this case turned out to be that the data directory identified in the error was on a portable disk that had gotten disconnected. Once the disk was connected back to the system, the postgres service started fine.
在这种情况下,问题被证明是错误中标识的数据目录位于已断开连接的便携式磁盘上。一旦磁盘连接回系统,postgres 服务就可以正常启动。