mongodb 无法启动mongodb服务
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30143414/
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
Can't start mongodb service
提问by Radislav
I just instaled mongo 3. And tried to run it as windows server but receive error
我刚刚安装了 mongo 3。并尝试将其作为 Windows 服务器运行但收到错误
The MongoDB 3.0 service terminated with the following service-specific error:
Cannot create another system semaphore.
Can't find any info about that error and mongodb.
找不到有关该错误和 mongodb 的任何信息。
采纳答案by razon
Check mongodb logs. In my case mongodb could not find directory from mongod.cfg
检查 mongodb 日志。在我的情况下,mongodb 无法从 mongod.cfg 中找到目录
回答by ADOConnection
In my case it appered to be mongod.lock issue after unexpected shutdown.
在我的情况下,意外关闭后似乎是 mongod.lock 问题。
Detected unclean shutdown - E:\MongoDb\Databases\mongod.lock is not empty.
I deleted E:\MongoDb\Databases\mongod.lock and mongo successfuly started.
我删除了 E:\MongoDb\Databases\mongod.lock 并且 mongo 成功启动。
回答by AndyT
After installing the .msi on Windows 10 in Program Files, I created the service for a different data location C:\Mongo\Data\DB
在 Windows 10 上的 Program Files 中安装 .msi 后,我为不同的数据位置 C:\Mongo\Data\DB 创建了服务
The Service installed correctly but didn't start with error "Cannot create another system semaphore" because:
该服务已正确安装但未以错误“无法创建另一个系统信号量”启动,因为:
I hadn't created the required folder structure.Simple as that - d'oh!
我没有创建所需的文件夹结构。就这么简单——天啊!
Hope this helps someone.
希望这可以帮助某人。
回答by Bravo Yeung
In Windows:
在Windows 中:
there is an effective method to solve this issue.
有一个有效的方法可以解决这个问题。
Firstly, try to delete the file storage.bson
under the folder "D:\mongodb\data", or the corresponding path in your PC.
首先,尝试删除storage.bson
“D:\mongodb\data”文件夹下的文件,或者你电脑中对应路径下的文件。
If the issue still exists, try following steps in order.
如果问题仍然存在,请尝试按顺序执行以下步骤。
For example mongoDB version 3.6 is installed, and the install path of MongoDB is "D:\Program Files\MongoDB".
比如安装了mongoDB 3.6版本,MongoDB的安装路径为“D:\Program Files\MongoDB”。
Create folder D:\mongodb\logs
, then create file mongodb.log
inside this folder.
创建文件夹D:\mongodb\logs
,然后mongodb.log
在该文件夹中创建文件。
Run cmd.exe as administrator,
以管理员身份运行 cmd.exe ,
D:\Program Files\MongoDB\Server.6\bin>taskkill /F /IM mongod.exe
D:\Program Files\MongoDB\Server.6\bin>mongod.exe --logpath D:\mongodb\logs\mongodb.log --logappend --dbpath D:\mongodb\data --directoryperdb --serviceName MongoDB --remove
D:\Program Files\MongoDB\Server.6\bin>mongod --logpath "D:\mongodb\logs\mongodb.log" --logappend --dbpath "D:\mongodb\data" --directoryperdb --serviceName "MongoDB" --serviceDisplayName "MongoDB" --install
Remove these two files mongod.lock
and storage.bson
under the folder "D:\mongodb\data".
删除这两个文件mongod.lock
并storage.bson
在文件夹“D:\mongodb\data”下。
Then type net start MongoDB
in the cmd using administrator privilege, the issue will be solved.
然后net start MongoDB
用管理员权限输入cmd,问题就解决了。
回答by Josh C
This happened for me a couple times because my Mac crashed which resulted in unclean shutdown of Parallels and my Mongo instance. mongod.lock was not empty.
这对我来说发生了几次,因为我的 Mac 崩溃了,导致 Parallels 和我的 Mongo 实例不正常关闭。mongod.lock 不为空。
This was on a development server so I didn't have backups. I was able to repair by using
这是在开发服务器上,所以我没有备份。我能够通过使用修复
mongod --repair --repairpath <path to your mongo data>
More instructions here
更多说明在这里
回答by Thom Howard
Also check permissions for dbpath and logpath. In my case I had configured mongo as a service running as Network Service, but, hadn't given Network Service write access to those directories.
还要检查 dbpath 和 logpath 的权限。在我的情况下,我已将 mongo 配置为作为网络服务运行的服务,但是,没有授予网络服务对这些目录的写访问权限。
回答by Justin
In case this helps anyone else, for me it was that I had started mongod.exe manually in a command prompt window so the windows service couldn't run mongod.exe on the same port already in use. Doh!
如果这对其他人有帮助,对我来说是因为我在命令提示符窗口中手动启动了 mongod.exe,因此 Windows 服务无法在已使用的同一端口上运行 mongod.exe。哦!
回答by Etienne
I had the same problem and in my case the config was wrong. This error from event viewer is not very helpful and mostly confusing so everyone should check mongo logs first.
我遇到了同样的问题,就我而言,配置是错误的。来自事件查看器的这个错误不是很有帮助,而且大多令人困惑,所以每个人都应该先检查 mongo 日志。
回答by Artur Musin
Didn't have enough space on disc C: where MongoDB was installed. After making some space -- mongod.exe successfully started.
安装 MongoDB 的光盘 C: 上没有足够的空间。腾出一些空间后——mongod.exe 成功启动。
回答by prasad mangle
In my case, another instance of MongoDB was running in command prompt on the same port.
就我而言,MongoDB 的另一个实例在同一端口上的命令提示符下运行。