无法启动MongoDB副本集:各种错误

时间:2015-02-15 13:27:30

标签: mongodb

首先,我为该组的3个成员设置配置文件并尝试启动它,如下所示:

enter image description here

它抱怨mongod实际上没有--replSet进程。这就是为什么我尝试在不同的终端上启动副本集并获得以下错误的原因:

C:\Users\GeoMash>mongod -replSet m101 -port 27001 -dbpath \data\rs0 -smallfiles
2015-02-15T21:24:46.910+0800 [initandlisten] MongoDB starting : pid=10864 port=27001 dbpath=\data\rs0 64-bit host=GeoMash-PC
2015-02-15T21:24:46.912+0800 [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2015-02-15T21:24:46.912+0800 [initandlisten] db version v2.6.7
2015-02-15T21:24:46.912+0800 [initandlisten] git version: a7d57ad27c382de82e9cb93bf983a80fd9ac9899
2015-02-15T21:24:46.913+0800 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
2015-02-15T21:24:46.913+0800 [initandlisten] allocator: system
2015-02-15T21:24:46.913+0800 [initandlisten] options: { net: { port: 27001 }, replication: { replSet: "m101" }, storage: { dbPath: "\data\rs0", smallFiles: true } }
2015-02-15T21:24:46.916+0800 [initandlisten] exception in initAndListen: 13627 Unable to create/open lock file: \data\rs0\mongod.lock The process cannot access the file because it is being used by another process.. Is a mongod instance already running?, terminating
2015-02-15T21:24:46.916+0800 [initandlisten] dbexit:
2015-02-15T21:24:46.916+0800 [initandlisten] shutdown: going to close listening sockets...
2015-02-15T21:24:46.917+0800 [initandlisten] shutdown: going to flush diaglog...
2015-02-15T21:24:46.917+0800 [initandlisten] shutdown: going to close sockets...
2015-02-15T21:24:46.917+0800 [initandlisten] shutdown: waiting for fs preallocator...
2015-02-15T21:24:46.918+0800 [initandlisten] shutdown: lock for final commit...
2015-02-15T21:24:46.918+0800 [initandlisten] shutdown: final commit...
2015-02-15T21:24:46.918+0800 [initandlisten] shutdown: closing all files...
2015-02-15T21:24:46.918+0800 [initandlisten] closeAllFiles() finished
2015-02-15T21:24:46.919+0800 [initandlisten] dbexit: really exiting now

1 个答案:

答案 0 :(得分:1)

您的问题是您正在使用另一个mongod进程正在使用的dbPath启动mongod。正如错误消息所示:

exception in initAndListen: 13627 Unable to create/open lock file: \data\rs0\mongod

看一下你正在运行的进程并确保你没有隐藏某个地方的mongod。在您停止进程之后,使用正确的replSet选项

启动您的三个mongod