1. 程式人生 > >Unable to create/open lock file: /data/mongod.lock解決方法

Unable to create/open lock file: /data/mongod.lock解決方法

StackOverflow上面的答案,對我最有用的一個。

I was struggling with this issue, and realized that if you list you list your destination folder with ls -lahZ it will give you the security context, the context for the mongo data folder should be set like: "sudo chcon -R -u system_u -t mongod_var_lib_t /folder/data" this besides the
obvious permissions and user:group combination. Hope it helps. – jmdiego Feb 18 '15 at 7:17

具體操作步驟如下。

ls -lahZ /data/db

[root@db opt]# ls -lahZ /srv/mongodb/
drwxr-xr-x. mongod mongod system_u:object_r:unlabeled_t:s0 .
drwxr-xr-x. root   root   system_u:object_r:var_t:s0       ..
drwxr-xr-x. mongod mongod unconfined_u:object_r:unlabeled_t:s0 log
-rw-r--r--. mongod mongod unconfined_u:object_r:unlabeled_t:s0 mongod.lock

檢視mongo預設的資料儲存路徑屬性。

[[email protected] opt]# ls -lahZ /var/lib/mongo/
drwxr-xr-x. mongod mongod system_u:object_r:mongod_var_lib_t:s0 .
drwxr-xr-x. root   root   system_u:object_r:var_lib_t:s0   ..
-rw-------. mongod mongod system_u:
object_r:mongod_var_lib_t:s0 admin.0
-rw-------. mongod mongod system_u:object_r:mongod_var_lib_t:s0 admin.ns drwxr-xr-x. root root unconfined_u:object_r:mongod_var_lib_t:s0 back drwxr-xr-x. mongod mongod system_u:object_r:mongod_var_lib_t:s0 journal -rw-------. mongod mongod system_u:object_r:mongod_var_lib_t:s0 local.0 -rw-------. mongod mongod system_u:object_r:mongod_var_lib_t:s0 local.ns -rw-r--r--. mongod mongod system_u:object_r:mongod_var_lib_t:s0 storage.bson drwxr-xr-x. mongod mongod system_u:object_r:mongod_var_lib_t:s0 _tmp

修改目標目錄。

[root@db opt]# chcon -R -u system_u -t mongod_var_lib_t /data/db/

啟動mongodb。

[root@db opt]# service mongod start
Starting mongod (via systemctl):  
[  確定  ]

相關推薦

Unable to create/open lock file: /data/mongod.lock解決方法

StackOverflow上面的答案,對我最有用的一個。 I was struggling with this issue, and realized that if you list you list your destination folder with

安卓ADB Unable to chmod ***: Read-only file system問題的解決方法

安卓ADB Unable to chmod *: Read-only file system問題的解決方法 Read-only file system : adb remount 或者 mount -o rw,remount yaffs2 /system U

Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instanc

I was having the same problem on a Ubuntu ec2 instance. I was following this amazon article on page 7: Mongodb path in /etc/mongodb.conf was set to /v

ORA-09925 Unable to create audit trail file 問題解決

問題描述: Oracle資料庫啟動例項時出現ora-09925、ora-01075的錯誤 問題分析: 檢視日誌/u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log,如下: 導致這個錯誤的原因要麼是dump目

ios編譯ffmpeg出現xcrun -sdk iphoneos clang is unable to create an executable file解決方法

使用https://github.com/kewlbear/FFmpeg-iOS-build-script的指令碼一鍵編譯ffmpeg。 出現 building arm64... xcrun -sdk iphoneos clang is unable to create an executa

Linux下編譯ffmpeg報錯gcc is unable to create an executable file C compiler test failed.

程式碼報錯資訊: [[email protected] ffmpeg-3.2.2]# ./configure --enable-shared --prefix=/usr/local/ffmpeg gcc is unable to create an executable

ORA-09925: Unable to create audit trail file Linux-x86_64 問題處理

在使用非ORACLE使用者登入資料庫時出現如報錯: [[email protected] ~]$ sqlplus "/as sysdba" SQL*Plus: Release 10.2.0.4.0 - Production on Wed Feb 1 15:55:

ora-09925 unable to create audit trail file

一.殺重複程序 1. ps -ef | grep smon 2.kill -9 22728 3.conn /as sysdba 二.修改oracle許可權 chmod 6755 $ORACLE_HOME/bin/oracle ls -lrt $ORACLE_

FFMPEG系列三:linux下編譯ffmpeg報錯gcc is unable to create an executable file C compiler test failed.

linux編譯ffmpeg過程報錯gcc is unable to create an executable file C compiler test failed.網上找了一圈,關於這個問題的答

pip安裝出現Fatal error in launcher: Unable to create process using '"'的解決辦法

python2 情況 是否 bubuko inf img where class 控制 python中使用pip安裝模塊時,出現:Fatal error in launcher: Unable to create process using ‘"‘ 原因:系統中可能有多處安

MyEclipse打開JSP文件報"Failed to create the part's controls"解決方法

ati file setting editor 技術 figure str 其他 clean   HTML代碼放到JSP中的,打不開了,在網上找了半天解決方法,總算解決了。 方法1. 在"開始"-->"運行"---->"cmd"進入命令提示行後,再進入myec

MyEclipse打開JSP文件報"Failed to create the part's controls"解決方法匯總

project 文件夾 window per win 而且 configure work 有時 有時候,打開別人的開發環境中導過來的項目的JSP文件,會出現“Failed to create the part‘s controls”的錯誤! 解決的

Unable to lock the lock file: /data/db/mongod.lock (Resource temporarily unavailable). Another mongo

錯誤:Unable to lock the lock file: /data/db/mongod.lock (Resource temporarily unavailable). Another mongod instance is already running on the /data/db

git提交代碼出現錯誤fatal: Unable to create '項目路徑/.git/index.lock': File exists.

log stack sts exists 下一個 flow code .cn create git提交代碼出現錯誤fatal: Unable to create ‘項目路徑/.git/index.lock‘: File exists. 具體出錯代碼如下: 具體原因不詳

Unable to create 'E:/.git/index.lock': File exists.

Unable to create 'E:/code/fund/at-fundsys/at-fundsys/.git/index.lock': File exists. Another git process seems to be running in this repository, e.g. a

使用git add命令時遇到 fatal: Unable to create index.lock File exists 錯誤的解決辦法

$ git add . fatal: Unable to create 'D:/Git/ocr/.git/index.lock': File exists. Another git process seems to be running in this repository, e.g. an ed

Git出現Unable to create 'E:/xxx/.git/index.lock': File exists.的解決辦法

初次使用git,在執行完"git add readme.txt"命令後,在執行commit時,由於命令寫錯,沒有寫提交日誌,再次更正提交就出現上述錯誤:Unable to create 'E:/xxx/.git/index.lock': File exists 解決方案:

ArcCatalog連接ArcSDE連接報:unable to create new database connection file,permission is denied

sde rcc href connect database 連接 art .com new 參考博文:鏈接 另外,若機器ip變更,sde是否受影響的問題 ArcCatalog連接ArcSDE連接報:unable to create new database conne

【Error】fatal: Unable to create '.../.git/index.lock':

使用git add時遇到錯誤: fatal: Unable to create '/Volumes/APFS-case-sensitive/Tech/Pwn/[email protected]/.git/index.lock': File exists. Another gi

loadrunner---執行LR報程式碼錯誤:Unable to create file

報錯資訊 <b>Warning</b>:  touch(): Unable to create file /app/80/api/web/monitor/1.0/Runtime/log/201511/20151110.log because Per