无法创建/打开锁定文件,权限被拒绝是一个mongod实例已在运行

时间:2018-02-28 12:52:48

标签: bash mongodb terminal

无法创建/打开锁定文件,权限被拒绝是否已经在运行mongod实例?

显示以下错误,

/Users/hackintosh01/.rvm/gems/ruby-2.4.1/bin:/Users/hackintosh01/.rvm/gems/ruby-2.4.1@global/bin:/Users/hackintosh01/.rvm/rubies/ruby-2.4.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Volumes/Mac\ Data/mongodb/bin/:/opt/X11/bin:/Users/hackintosh01/.rvm/bin:/usr/local/mysql/bin
    Hackintoshs-iMac-2:~ hackintosh01$ mongod
    2018-02-28T17:54:21.814+0530 I CONTROL  [initandlisten] MongoDB starting : pid=18926 port=27017 dbpath=/data/db 64-bit host=Hackintoshs-iMac-2.local
    2018-02-28T17:54:21.815+0530 I CONTROL  [initandlisten] db version v3.2.10
    2018-02-28T17:54:21.815+0530 I CONTROL  [initandlisten] git version: 79d9b3ab5ce20f51c272b4411202710a082d0317
    2018-02-28T17:54:21.815+0530 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2j  26 Sep 2016
    2018-02-28T17:54:21.815+0530 I CONTROL  [initandlisten] allocator: system
    2018-02-28T17:54:21.815+0530 I CONTROL  [initandlisten] modules: none
    2018-02-28T17:54:21.815+0530 I CONTROL  [initandlisten] build environment:
    2018-02-28T17:54:21.815+0530 I CONTROL  [initandlisten]     distarch: x86_64
    2018-02-28T17:54:21.815+0530 I CONTROL  [initandlisten]     target_arch: x86_64
    2018-02-28T17:54:21.815+0530 I CONTROL  [initandlisten] options: {}
    2018-02-28T17:54:21.826+0530 I STORAGE  [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
    2018-02-28T17:54:21.826+0530 I CONTROL  [initandlisten] dbexit:  rc: 100
    Hackintoshs-iMac-2:~ hackintosh01$ mongod --dbpath /data/db
    2018-02-28T17:57:24.572+0530 I CONTROL  [initandlisten] MongoDB starting : pid=18935 port=27017 dbpath=/data/db 64-bit host=Hackintoshs-iMac-2.local
    2018-02-28T17:57:24.573+0530 I CONTROL  [initandlisten] db version v3.2.10
    2018-02-28T17:57:24.573+0530 I CONTROL  [initandlisten] git version: 79d9b3ab5ce20f51c272b4411202710a082d0317
    2018-02-28T17:57:24.573+0530 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2j  26 Sep 2016
    2018-02-28T17:57:24.573+0530 I CONTROL  [initandlisten] allocator: system
    2018-02-28T17:57:24.573+0530 I CONTROL  [initandlisten] modules: none
    2018-02-28T17:57:24.573+0530 I CONTROL  [initandlisten] build environment:
    2018-02-28T17:57:24.573+0530 I CONTROL  [initandlisten]     distarch: x86_64
    2018-02-28T17:57:24.573+0530 I CONTROL  [initandlisten]     target_arch: x86_64
    2018-02-28T17:57:24.573+0530 I CONTROL  [initandlisten] options: { storage: { dbPath: "/data/db" } }
    2018-02-28T17:57:24.585+0530 I STORAGE  [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
    2018-02-28T17:57:24.585+0530 I CONTROL  [initandlisten] dbexit:  rc: 100

1 个答案:

答案 0 :(得分:0)

选中/data/db文件夹的权限,现在可以正常使用。

sudo chmod 777 / data / db

<强>更新 将所有权更改为特定用户

  

sudo chown -R&lt; USERNAME&gt; /数据/分贝