错误:1053 (ERROR_SERVICE_REQUEST_TIMEOUT) - 服务未及时响应启动或控制请求。
Error: 1053 (ERROR_SERVICE_REQUEST_TIMEOUT) - The service did not respond to the start or control request in a timely fashion.
ID: mongodb/invalid-windows-service-name
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| MongoDB 5.0 | active | — | — | — |
| MongoDB 6.0 | active | — | — | — |
| Windows Server 2019 | active | — | — | — |
| Windows Server 2022 | active | — | — | — |
根因分析
Windows 上的 MongoDB 作为服务启动时未能在默认的 30 秒超时内启动,通常是由于配置文件损坏、系统资源不足或端口冲突。
English
MongoDB on Windows failed to start as a service within the default 30-second timeout, often due to a corrupted configuration file, insufficient system resources, or a port conflict.
官方文档
https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-windows/解决方案
-
检查 MongoDB 日志文件(例如 C:\Program Files\MongoDB\Server\6.0\log\mongod.log)以获取具体错误。常见修复:使用 `netstat -ano | findstr :27017` 确保端口 27017 未被占用,或更正服务中的配置文件路径。
-
删除并重新创建 MongoDB 服务,使用显式参数:`sc delete MongoDB` 然后 `mongod.exe --config "C:\Program Files\MongoDB\Server\6.0\bin\mongod.cfg" --install --serviceName MongoDB`。
-
通过注册表临时增加服务启动超时时间(HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control, ServicesPipeTimeout = 60000)以允许更多启动时间,然后诊断日志。
无效尝试
常见但无效的做法:
-
85% 失败
The service will eventually time out again if the root issue (e.g., port conflict or corrupt config) is not addressed.
-
90% 失败
The same configuration file or port conflict remains, causing the same timeout.
-
70% 失败
This bypasses the service manager but leaves the system without automatic restart on boot, and may miss environment-specific settings.