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

前端 未结 14 1765
轻奢々
轻奢々 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:12

    If your system is using SELinux, make sure that you use the right context for the directory you created:

    ls -dZ /data/db/
    ls -dZ /var/lib/mongo/
    

    and clone the context with:

    chcon -R --reference=/var/lib/mongo /data/db
    

提交回复
热议问题