mongodb所在的目錄許可權被更改導致mongodb意外down機
啟動報錯:
Tue Apr 15 02:49:13.417 [journal] warning: open of lsn file failed
Tue Apr 15 02:50:25.482 [journal] In File::open(), ::open for '/tol/mongodb/data/journal/lsn' failed with errno:13 Permission denied
Tue Apr 15 02:50:25.482 [journal] warning: open of lsn file failed
Tue Apr 15 02:52:03.172 [journal] In File::open(), ::open for '/tol/mongodb/data/journal/lsn' failed with errno:13 Permission denied
Tue Apr 15 02:52:03.172 [journal] warning: open of lsn file failed
Tue Apr 15 02:53:13.817 [journal] In File::open(), ::open for '/tol/mongodb/data/journal/lsn' failed with errno:13 Permission denied
Tue Apr 15 02:53:13.817 [journal] warning: open of lsn file failed
Tue Apr 15 02:53:56.884 [journal] In File::open(), ::open for '/tol/mongodb/data/journal/lsn' failed with errno:13 Permission denied
Tue Apr 15 02:53:56.884 [journal] warning: open of lsn file failed
Tue Apr 15 02:55:52.733 [journal] In File::open(), ::open for '/tol/mongodb/data/journal/lsn' failed with errno:13 Permission denied
Tue Apr 15 02:55:52.733 [journal] warning: open of lsn file failed
Tue Apr 15 02:55:55.930 [journal] In File::open(), ::open for '/tol/mongodb/data/journal/lsn' failed with errno:13 Permission denied
Tue Apr 15 02:55:55.930 [journal] warning: open of lsn file failed
Tue Apr 15 02:57:37.438 [journal] In File::open(), ::open for '/tol/mongodb/data/journal/lsn' failed with errno:13 Permission denied
Tue Apr 15 02:57:37.438 [journal] warning: open of lsn file failed
Tue Apr 15 02:58:42.993 [journal] In File::open(), ::open for '/tol/mongodb/data/journal/lsn' failed with errno:13 Permission denied
Tue Apr 15 02:58:42.993 [journal] warning: open of lsn file failed
Tue Apr 15 02:59:03.107 [journal] In File::open(), ::open for '/tol/mongodb/data/journal/lsn' failed with errno:13 Permission denied
Tue Apr 15 02:59:03.107 [journal] warning: open of lsn file failed
Tue Apr 15 03:00:01.257 [conn837] CMD: drop koolearn.tmp.mr.link_694
Tue Apr 15 03:00:01.285 [conn837] CMD: drop koolearn.tmp.mr.link_694_inc
Tue Apr 15 03:00:01.379 [conn837] build index koolearn.tmp.mr.link_694_inc { 0: 1 }
Tue Apr 15 03:00:01.669 [conn837] mr failed, removing collection :: caused by :: boost::filesystem::create_directory: Permission den
ied: "/tol/mongodb/data/_tmp/esort.1397502001.1410"
Tue Apr 15 03:00:01.672 [journal] In File::open(), ::open for '/tol/mongodb/data/journal/lsn' failed with errno:13 Permission denied
Tue Apr 15 03:00:01.672 [journal] warning: open of lsn file failed
+++查看許可權,發現都變成mysql的了
[root@localhost tol]# ll -h
total 28K
drwx------ 2 mysql mysql 16K Jun 8 2013 lost+found
drwxr-xr-x 5 mysql mysql 4.0K Jun 24 2013 mongodb
drwxrwxr-x 3 mysql mysql 4.0K Apr 14 05:38 mongo_dump
更改一下許可權:
[root@localhost tol]# chown -R mongodb:mongodb /tol/mongo*
[root@localhost tol]# ls -lh
total 28K
drwx------ 2 mysql mysql 16K Jun 8 2013 lost+found
drwxr-xr-x 5 mongodb mongodb 4.0K Jun 24 2013 mongodb
drwxrwxr-x 3 mongodb mongodb 4.0K Apr 14 05:38 mongo_dump
+++再次啟動:
[mongodb@localhost ~]$ nohup mongod --auth --dbpath=/tol/mongodb/data/ --logpath=/tol/mongodb/log/mongo.log --logappend --port=27017 > /tol/mongodb/log/start_mongodb.log 2>&1 &
[1] 26948
[mongodb@localhost ~]$ mongo
MongoDB shell version: 2.4.4
connecting to: koolearn
Tue Apr 15 17:46:01.367 JavaScript execution failed: Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112
exception: connect failed
[mongodb@localhost ~]$
+++檢查發現是因為mongo意外down掉導致mongod.lock檔案異常,直接刪掉這個檔案就可以
[mongodb@localhost mongodb]$ locate mongod.lock
/tol/mongodb/data/mongod.lock
[mongodb@localhost data]$ mv mongod.lock ../
++再次啟動就可以正常串連了
[mongodb@localhost ~]$ mongo -u xxxxxxx -p xxxx ]XXX
MongoDB shell version: 2.4.4
>
>
>