MongoDB: exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating

前端 未结 14 1703
轻奢々
轻奢々 2020-12-02 04:37

I created /data/db in root directory and ran ./mongod:

[initandlisten] exception in initAndListen: 20 Attempted to create a lock fi         


        
相关标签:
14条回答
  • 2020-12-02 05:14

    If you are checking your mongodb logs and you are getting such an error then just follow steps as i did. It occurs due to permission issues with your /data/db directory. I am using ubuntu16.04 and I find solution with running two simple commands as follow.

    Step 1: Give permission to /data/db directory:

    sudo chmod -R 0777 /data/db
    

    Step 2: Try to start mongod service as :

    sudo service mongod start
    

    Step 3: Check status of mongod service:

    sudo service mongod status
    
    0 讨论(0)
  • 2020-12-02 05:14

    This worked for me in Ubuntu LTS 20.04:

    $ sudo service mongod start
    
    0 讨论(0)
提交回复
热议问题