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

前端 未结 28 1445
执念已碎
执念已碎 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

    This is what I did to fix the problem:

    $sudo mkdir -p /data/db

    $export PATH=/usr/local/Cellar/mongodb/3.0.7/bin:$PATH

    $sudo chown -R id -u /data/db

    and then to start mongo...

    $mongod

    0 讨论(0)
  • 2020-11-29 15:11

    I use this method to solve the problem:

    sudo chown -R mongodb:mongodb /data/db
    
    0 讨论(0)
  • 2020-11-29 15:11

    On a Fedora 18 with Mongo 2.2.4 instance I was able to get around a similar error by disabling SELinux by calling setenforce 0 as root.

    BTW, this was a corporate environment, not an Amazon EC2 instance, but the symptoms were similar.

    0 讨论(0)
  • 2020-11-29 15:11

    You could try by these ways. 1st.

    sudo chown -R mongod:mongod /data/db

    but at some times,this is not useful. 2nd. if the above way is not useful,you can try to do this:

    mkdir /data/db #as the database storage path

    nohup mongod --dbpath /data/db &

    or type:

    mongod --dbpath /data/db

    to get the output stream

    0 讨论(0)
  • 2020-11-29 15:11

    If you literally want a one line equivalent to the commands in your original question, you could alias:

    mongo --eval "db.getSiblingDB('admin').shutdownServer()"
    

    https://stackoverflow.com/a/11777141/7160782

    0 讨论(0)
  • 2020-11-29 15:12

    I had the same problem.

    I solved it by changing selinux status to permissive with below command:

    setenforce 0
    
    0 讨论(0)
提交回复
热议问题