Unable to create/open lock file: /data/mongod.lock errno:13 Permission denied

前端 未结 28 1565
执念已碎
执念已碎 2020-11-29 14:39

How to I get mongo to use a mounted drive on ec2? I really do not understand. I attached a volume on ec2 formatted the drive as root and start as root and yet as root I ca

28条回答
  •  醉梦人生
    2020-11-29 15:10

    My mongo (3.2.9) was installed on Ubuntu, and my log file had the following lines:

    2016-09-28T11:32:07.821+0100 E STORAGE  [initandlisten] WiredTiger (13) [1475058727:821829][6785:0x7fa9684ecc80], file:WiredTiger.wt, connection: /var/lib/mongodb/WiredTiger.turtle: handle-open: open: Permission denied 
    2016-09-28T11:32:07.822+0100 I -        [initandlisten] Assertion: 28595:13: Permission denied 
    2016-09-28T11:32:07.822+0100 I STORAGE  [initandlisten] exception in initAndListen: 28595 13: Permission denied, terminating
    

    2016-09-28T11:32:07.822+0100 I CONTROL [initandlisten] dbexit: rc: 100

    So the problem was in permissions on /var/lib/mongodb folder.

    sudo chown -R mongodb:mongodb /var/lib/mongodb/
    sudo chmod -R 755 /var/lib/mongodb
    
    • Restart the server

    Fixed it, although I do realise that may be not too secure (it's my own dev box I'm in my case), bit following the change both db and authentication worked.

提交回复
热议问题