Error:couldn ' t connect to server 127.0.0.1:27017 at Src/mongo/shell/mongo.js__js

Source: Internet
Author: User
Tags mongodb

MongoDB directory permissions have been changed causing mongodb unexpected down machine

Start an error:

Tue APR 02:49:13.417 [Journal] warning:open of LSN file failed
Tue APR 02:50:25.482 [journal] in File::open ():: Open for '/tol/mongodb/data/journal/lsn ' failed with errno:13 Permiss Ion denied
Tue APR 02:50:25.482 [Journal] warning:open of LSN file failed
Tue APR 02:52:03.172 [journal] in File::open ():: Open for '/tol/mongodb/data/journal/lsn ' failed with errno:13 Permiss Ion denied
Tue APR 02:52:03.172 [Journal] warning:open of LSN file failed
Tue APR 02:53:13.817 [journal] in File::open ():: Open for '/tol/mongodb/data/journal/lsn ' failed with errno:13 Permiss Ion denied
Tue APR 02:53:13.817 [Journal] warning:open of LSN file failed
Tue APR 02:53:56.884 [journal] in File::open ():: Open for '/tol/mongodb/data/journal/lsn ' failed with errno:13 Permiss Ion denied
Tue APR 02:53:56.884 [Journal] warning:open of LSN file failed
Tue APR 02:55:52.733 [journal] in File::open ():: Open for '/tol/mongodb/data/journal/lsn ' failed with errno:13 Permiss Ion denied
Tue APR 02:55:52.733 [Journal] warning:open of LSN file failed
Tue APR 02:55:55.930 [journal] in File::open ():: Open for '/tol/mongodb/data/journal/lsn ' failed with errno:13 Permiss Ion denied
Tue APR 02:55:55.930 [Journal] warning:open of LSN file failed
Tue APR 02:57:37.438 [journal] in File::open ():: Open for '/tol/mongodb/data/journal/lsn ' failed with errno:13 Permiss Ion denied
Tue APR 02:57:37.438 [Journal] warning:open of LSN file failed
Tue APR 02:58:42.993 [journal] in File::open ():: Open for '/tol/mongodb/data/journal/lsn ' failed with errno:13 Permiss Ion denied
Tue APR 02:58:42.993 [Journal] warning:open of LSN file failed
Tue APR 02:59:03.107 [journal] in File::open ():: Open for '/tol/mongodb/data/journal/lsn ' failed with errno:13 Permiss Ion denied
Tue APR 02:59:03.107 [Journal] warning:open of LSN file failed
Tue APR 03:00:01.257 [conn837] Cmd:drop koolearn.tmp.mr.link_694
Tue APR 03:00:01.285 [conn837] Cmd:drop Koolearn.tmp.mr.link_694_inc
Tue APR 03:00:01.379 [conn837] Build index koolearn.tmp.mr.link_694_inc {0:1}
Tue APR 03:00:01.669 [conn837] Mr Failed, removing collection:: Caused by:: Boost::filesystem::create_directory:perm Ission den
IED: "/tol/mongodb/data/_tmp/esort.1397502001.1410"
Tue APR 03:00:01.672 [journal] in File::open ():: Open for '/tol/mongodb/data/journal/lsn ' failed with errno:13 Permiss Ion denied
Tue APR 03:00:01.672 [Journal] warning:open of LSN file failed


+++ View permissions, the discovery has become MySQL's

[Root@localhost tol]# Ll-h
Total 28K
drwx------2 MySQL MySQL 16K June 8 2013 Lost+found
Drwxr-xr-x 5 mysql MySQL 4.0K June 2013 MongoDB
Drwxrwxr-x 3 mysql mysql 4.0K Apr 05:38 mongo_dump


Change the permissions:

[Root@localhost tol]# chown-r mongodb:mongodb/tol/mongo*
[Root@localhost tol]# LS-LH
Total 28K
drwx------2 MySQL MySQL 16K June 8 2013 Lost+found
Drwxr-xr-x 5 MongoDB MongoDB 4.0K June 2013 MongoDB
Drwxrwxr-x 3 MongoDB mongodb 4.0K Apr 05:38 mongo_dump


+++ Start again:

[Mongodb@localhost ~]$ nohup mongod--auth--dbpath=/tol/mongodb/data/-- 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 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 ~]$

+++ Check found that because MONGO accidentally down cause Mongod.lock file exception, directly delete this file can be

[Mongodb@localhost mongodb]$ Locate Mongod.lock
/tol/mongodb/data/mongod.lock

[Mongodb@localhost data]$ MV Mongod.lock. /


+ + starts again to connect properly

[Mongodb@localhost ~]$ mongo-u xxxxxxx-p xxxx]xxx
MongoDB Shell version:2.4.4
>
>
>



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.