首页 > 解决方案 > 当我在终端中输入 mongod 时,我的 MongoDB 不工作

问题描述

我输入 mongod 来创建一个新的数据库,但我得到了这个错误,知道这里发生了什么吗?

mongod
2018-08-28T18:06:36.824+0100 I CONTROL  [initandlisten] MongoDB starting : pid=41812 port=27017 dbpath=/data/db 64-bit host=Ruairidhs-MacBook-Pro.local
2018-08-28T18:06:36.825+0100 I CONTROL  [initandlisten] db version v3.6.3
2018-08-28T18:06:36.825+0100 I CONTROL  [initandlisten] git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
2018-08-28T18:06:36.825+0100 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2n  7 Dec 2017
2018-08-28T18:06:36.825+0100 I CONTROL  [initandlisten] allocator: system
2018-08-28T18:06:36.825+0100 I CONTROL  [initandlisten] modules: none
2018-08-28T18:06:36.825+0100 I CONTROL  [initandlisten] build environment:
2018-08-28T18:06:36.825+0100 I CONTROL  [initandlisten]     distarch: x86_64
2018-08-28T18:06:36.825+0100 I CONTROL  [initandlisten]     target_arch: x86_64
2018-08-28T18:06:36.825+0100 I CONTROL  [initandlisten] options: {}
2018-08-28T18:06:36.825+0100 I STORAGE  [initandlisten] exception in initAndListen: DBPathInUse: Unable to lock the lock file: /data/db/mongod.lock (Resource temporarily unavailable). Another mongod instance is already running on the /data/db directory, terminating
2018-08-28T18:06:36.825+0100 I CONTROL  [initandlisten] now exiting
2018-08-28T18:06:36.825+0100 I CONTROL  [initandlisten] shutting down with code:100

标签: mongodb

解决方案


打开一个新的终端窗口,执行top,根据错误,你已经有一个mongod的实例在运行,所以你需要找到它并终止它。


推荐阅读