MongoDB wont start after clean Linux install - linux

I have a problem with my MongoDB installation on Linux. I just need to install MongoDB local.
I started with a outdated version (2.4.9), so I used these command lines to delete the entire old version:
sudo apt-get purge mongodb mongodb-clients mongodb-server mongodb-dev
sudo apt-get purge mongodb-10gen
sudo apt-get autoremove
So at this moment I had no version of MongoDB installed on my Linux Mint Qaina 17
I went to the website: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/
Did the following command lines, just like the websites told me to do:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
sudo apt-get update
sudo apt-get install -y mongodb-org
sudo service mongod start
At this moment I have MongoDB 2.6.5 installed. The latest version.
After I got none error, I restart my terminal.
This is my result in terminal after I typed: sudo mongod
mongod --help for help and startup options
2014-10-31T19:24:30.653+0100 [initandlisten] MongoDB starting : pid=2749 port=27017 dbpath=/data/db 64-bit host=XXX-pc
2014-10-31T19:24:30.653+0100 [initandlisten] db version v2.6.5
2014-10-31T19:24:30.653+0100 [initandlisten] git version: e99d4fcb4279c0279796f237aa92fe3b64560bf6
2014-10-31T19:24:30.653+0100 [initandlisten] build info: Linux build8.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-10-31T19:24:30.653+0100 [initandlisten] allocator: tcmalloc
2014-10-31T19:24:30.654+0100 [initandlisten] options: {}
2014-10-31T19:24:30.728+0100 [initandlisten] journal dir=/data/db/journal
2014-10-31T19:24:30.729+0100 [initandlisten] recover : no journal files present, no recovery needed
2014-10-31T19:24:30.894+0100 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2014-10-31T19:24:30.894+0100 [initandlisten] ERROR: addr already in use
2014-10-31T19:24:30.895+0100 [initandlisten] now exiting
2014-10-31T19:24:30.895+0100 [initandlisten] dbexit:
2014-10-31T19:24:30.896+0100 [initandlisten] shutdown: going to close listening sockets...
2014-10-31T19:24:30.896+0100 [initandlisten] shutdown: going to flush diaglog...
2014-10-31T19:24:30.896+0100 [initandlisten] shutdown: going to close sockets...
2014-10-31T19:24:30.896+0100 [initandlisten] shutdown: waiting for fs preallocator...
2014-10-31T19:24:30.896+0100 [initandlisten] shutdown: lock for final commit...
2014-10-31T19:24:30.896+0100 [initandlisten] shutdown: final commit...
2014-10-31T19:24:30.969+0100 [initandlisten] shutdown: closing all files...
2014-10-31T19:24:30.970+0100 [initandlisten] closeAllFiles() finished
2014-10-31T19:24:30.970+0100 [initandlisten] journalCleanup...
2014-10-31T19:24:30.970+0100 [initandlisten] removeJournalFiles
2014-10-31T19:24:31.028+0100 [initandlisten] shutdown: removing fs lock...
2014-10-31T19:24:31.029+0100 [initandlisten] dbexit: really exiting now
Could anybody tell me what the problem is? I had the same problem on a

Thanks for your quick response!
Result:
sudo lsof -i :27017
[sudo] password for XXX:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mongod 1294 mongodb 8u IPv4 11020 0t0 TCP localhost:27017 (LISTEN)
and
sudo service mongod status
mongod start/running, process 1294
When I go to my webbrowser and type
http://localhost:27017/mydb
I get a "It looks like you are trying to access MongoDB over HTTP on the native driver port." Am I missing something here?

2014-10-31T19:24:30.894+0100 [initandlisten] ERROR: listen(): bind()
failed errno:98 Address already in use for socket: 0.0.0.0:27017
2014-10-31T19:24:30.894+0100 [initandlisten] ERROR: addr already in
use 2014-10-31T19:24:30.895+0100 [initandlisten] now exiting
means that some process is already bound to port 27017.
You can find out which one with lsof -i :27017 (running with superuser priviledge, with sudo for instance)
It is probably the mongod service installed (and started) with the mongod package.
You can verify this with sudo service mongod status

Related

Weird MongoDB login error after backend shut down

Yesterday, OVH services went down, so a backend of an app of my own stopped working completely. Today, I tried starting up my app to see if everything was ok, and I was glad to see that the backend is already working, but... my app didn't show any data.
So I connected via PuTTy to my VPS to see my Node app was correctly working. I saw in pm2 (process manager for Node) that my app's instance was perfectly online. But in the Parse logs, I could see this error:
{"message":"error getting auth for sessionToken","name":"MongoError" // more redundant error messages saying pretty much the same}
I could perfectly check that the current problem, is that my Node app can't connect the Mongo server, though the credentials are the same...
Some aclarations:
The app backend and the MongoDB are stored in the same VPS.
The Mongo credentials are the same; they didn't change at all.
Tried restarting the node instance, but it won't change anything.
So, what's going on? How can I restart the mongo services and try again? And in case I need it... how can I change my mongo credentials?
Thank you!
EDIT: When I write "mongod" (it's a mongo service, right?) I get the following unexpected error:
mongod --help for help and startup options
2017-11-10T12:21:56.933+0100 [initandlisten] MongoDB starting : pid=7255 port=27017 dbpath=/data/db 64-bit host=vps332549
2017-11-10T12:21:56.934+0100 [initandlisten] db version v2.6.10
2017-11-10T12:21:56.935+0100 [initandlisten] git version: nogitversion
2017-11-10T12:21:56.935+0100 [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2017-11-10T12:21:56.935+0100 [initandlisten] build info: Linux lgw01-12 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 BOOST_LIB_VERSION=1_58
2017-11-10T12:21:56.935+0100 [initandlisten] allocator: tcmalloc
2017-11-10T12:21:56.935+0100 [initandlisten] options: {}
2017-11-10T12:21:56.936+0100 [initandlisten] exception in initAndListen: 10296
*********************************************************************
ERROR: dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
2017-11-10T12:21:56.936+0100 [initandlisten] dbexit:
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: going to close listening sockets...
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: going to flush diaglog...
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: going to close sockets...
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: waiting for fs preallocator...
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: lock for final commit...
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: final commit...
2017-11-10T12:21:56.936+0100 [initandlisten] shutdown: closing all files...
2017-11-10T12:21:56.937+0100 [initandlisten] closeAllFiles() finished
2017-11-10T12:21:56.937+0100 [initandlisten] dbexit: really exiting now
EDIT:
Tried to do what the first answer said, though you can see here the result is not anywhere near good; the service just won't start, I don't know why. Also, how can I know where is my db root?
root#vps332549:~# service mongod status
● mongod.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
root#vps332549:~# service mongod restart
Failed to restart mongod.service: Unit mongod.service not found.
root#vps332549:~# mongod --dbpath=data/db/
2017-11-11T16:46:56.568+0100 [initandlisten] MongoDB starting : pid=6980 port=27017 dbpath=data/db/ 64-bit host=vps332549
2017-11-11T16:46:56.573+0100 [initandlisten] db version v2.6.10
2017-11-11T16:46:56.573+0100 [initandlisten] git version: nogitversion
2017-11-11T16:46:56.573+0100 [initandlisten] OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
2017-11-11T16:46:56.573+0100 [initandlisten] build info: Linux lgw01-12 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC 2015 x86_64 BOOST_LIB_VERSION=1_58
2017-11-11T16:46:56.573+0100 [initandlisten] allocator: tcmalloc
2017-11-11T16:46:56.573+0100 [initandlisten] options: { storage: { dbPath: "data/db/" } }
2017-11-11T16:46:56.573+0100 [initandlisten] exception in initAndListen: 10296
*********************************************************************
ERROR: dbpath (data/db/) does not exist.
Create this directory or give existing directory in --dbpath.
See http://dochub.mongodb.org/core/startingandstoppingmongo
*********************************************************************
, terminating
2017-11-11T16:46:56.573+0100 [initandlisten] dbexit:
2017-11-11T16:46:56.573+0100 [initandlisten] shutdown: going to close listening sockets...
2017-11-11T16:46:56.573+0100 [initandlisten] shutdown: going to flush diaglog...
2017-11-11T16:46:56.573+0100 [initandlisten] shutdown: going to close sockets...
2017-11-11T16:46:56.573+0100 [initandlisten] shutdown: waiting for fs preallocator...
2017-11-11T16:46:56.573+0100 [initandlisten] shutdown: lock for final commit...
2017-11-11T16:46:56.574+0100 [initandlisten] shutdown: final commit...
2017-11-11T16:46:56.574+0100 [initandlisten] shutdown: closing all files...
2017-11-11T16:46:56.574+0100 [initandlisten] closeAllFiles() finished
2017-11-11T16:46:56.574+0100 [initandlisten] dbexit: really exiting now
root#vps332549:~# service mongod restart
Failed to restart mongod.service: Unit mongod.service not found.
root#vps332549:~# service mongod start
Failed to start mongod.service: Unit mongod.service not found.
root#vps332549:~#
If you have already set up mongod as a service, then you should be able to check if it is running or not:
$ service mongod status
If it is simply inactive, just restart your service:
# service mongod restart
If it is not registered as a service, then the mongod command expects a dbpath parameter:
$ mongod --dbpath=data/db/
where data/db/ is the path to the data directory of your database.

Cannot start mongo db

I have did the mongodb installation process mentioned in the following link https://docs.mongodb.com/manual/installation/ but i can't start the mongodb this is my log kindly tell me the possible way to start mongo db
C:\>"C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe"
2017-03-12T12:42:55.378+0530 I CONTROL [initandlisten] MongoDB starting : pid=5
400 port=27017 dbpath=C:\data\db\ 64-bit host=vimals
2017-03-12T12:42:55.379+0530 I CONTROL [initandlisten] targetMinOS: Windows 7/W
indows Server 2008 R2
2017-03-12T12:42:55.380+0530 I CONTROL [initandlisten] db version v3.4.2
2017-03-12T12:42:55.381+0530 I CONTROL [initandlisten] git version: 3f76e40c105
fc223b3e5aac3e20dcd026b83b38b
2017-03-12T12:42:55.382+0530 I CONTROL [initandlisten] OpenSSL version: OpenSSL
1.0.1u-fips 22 Sep 2016
2017-03-12T12:42:55.382+0530 I CONTROL [initandlisten] allocator: tcmalloc
2017-03-12T12:42:55.383+0530 I CONTROL [initandlisten] modules: enterprise
2017-03-12T12:42:55.384+0530 I CONTROL [initandlisten] build environment:
2017-03-12T12:42:55.385+0530 I CONTROL [initandlisten] distmod: windows-64
2017-03-12T12:42:55.385+0530 I CONTROL [initandlisten] distarch: x86_64
2017-03-12T12:42:55.386+0530 I CONTROL [initandlisten] target_arch: x86_64
2017-03-12T12:42:55.387+0530 I CONTROL [initandlisten] options: {}
2017-03-12T12:42:55.389+0530 I STORAGE [initandlisten] exception in initAndList
en: 98 Unable to create/open lock file: C:\data\db\mongod.lock The process canno
t access the file because it is being used by another process.. Is a mongod inst
ance already running?, terminating
2017-03-12T12:42:55.390+0530 I NETWORK [initandlisten] shutdown: going to close
listening sockets...
2017-03-12T12:42:55.390+0530 I NETWORK [initandlisten] shutdown: going to flush
diaglog...
2017-03-12T12:42:55.391+0530 I CONTROL [initandlisten] now exiting
2017-03-12T12:42:55.392+0530 I CONTROL [initandlisten] shutting down with code:
100
Looks as if your database file is locked by another process, did you try restarting the machine?
Just for notes.
In my case, after I create db with:
sudo mkdir -p /data/db
I also have to do this:
sudo chmod 777 /data/db
Then the environment is up for running by entering:
mongod
to enter the mongoldb shell.

Mongodb not starting on ubuntu 14.04

I am trying to install and start mongodb locally:
I go through these steps (as shown in history):
1819 sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
1820 echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
1821 sudo apt-get update
1822 sudo apt-get install -y mongodb-org
1823 sudo service mongod start
But I get the following error log in /var/log/mongodb/mongodb.log
2016-01-05T22:51:21.869+0000 I CONTROL [main] ***** SERVER RESTARTED *****
2016-01-05T22:51:21.874+0000 I CONTROL [initandlisten] MongoDB starting : pid=5394 port=27017 dbpath=/var/lib/mongodb 64-bit host=ip-172-31-45-129
2016-01-05T22:51:21.874+0000 I CONTROL [initandlisten] db version v3.2.0
2016-01-05T22:51:21.874+0000 I CONTROL [initandlisten] git version: 45d947729a0315accb6d4f15a6b06be6d9c19fe7
2016-01-05T22:51:21.874+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2016-01-05T22:51:21.874+0000 I CONTROL [initandlisten] allocator: tcmalloc
2016-01-05T22:51:21.874+0000 I CONTROL [initandlisten] modules: none
2016-01-05T22:51:21.874+0000 I CONTROL [initandlisten] build environment:
2016-01-05T22:51:21.874+0000 I CONTROL [initandlisten] distmod: ubuntu1404
2016-01-05T22:51:21.874+0000 I CONTROL [initandlisten] distarch: x86_64
2016-01-05T22:51:21.874+0000 I CONTROL [initandlisten] target_arch: x86_64
2016-01-05T22:51:21.874+0000 I CONTROL [initandlisten] options: { config: "/etc/mongodb.conf", net: { bindIp: "127.0.0.1" }, storage: { dbPath: "/var/lib/mongodb", journal: { enabled: true } }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongodb.log" } }
2016-01-05T22:51:21.895+0000 E NETWORK [initandlisten] Failed to unlink socket file /tmp/mongodb-27017.sock errno:1 Operation not permitted
2016-01-05T22:51:21.895+0000 I - [initandlisten] Fatal Assertion 28578
2016-01-05T22:51:21.895+0000 I - [initandlisten]
***aborting after fassert() failure
I previously had a mongodb installed which worked fine but stopped me from connecting to it after some changes I made to other services that were using mongodb. So I tried to remove that instance of mongodb and tried reinstalling, after which I am facing this issue.
I also try to look for the file: /tmp/mongodb-27017.sock but it does not exist on my system.
I had the same problem after installing MongoDB the same way, also got the error message 'Failed to unlink socket file /tmp/mongodb-27017.sock...'.
After doing a bit more digging I realised that the installation hadn't created the path /data/db, so here's what I did:
create the full path (the flag -p creates parent folders if they don't exist)
sudo mkdir -p /data/db
recursively change ownership of the folder /data/db to mongodb
sudo chown -R mongodb:mongodb /data/db
edit: if you're planning on running different instances of mongodb from different project folders, you, and not mongodb, should be the owner of the contents of /data/db, otherwise it will give you an error of the type exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock
Remove the temporary socket file
sudo rm /tmp/mongodb-27017.sock
Initialise the mongod service
sudo service mongod start
After this it was running smoothly in my system. I could start it or stop it and it would not give me any more errors.
Hope this helps :)

I'm not able to start mongo because of no space left on disk to create lock file, but I have lots of space on disk

I have instalation of mongo on my PC with arch linux (64 bit machine).
Before start I had move mongo database files on new location with plenty (11 Gb) space. But if i run mongod, it fails because of no space left on device. If I run this as root, ti works. Where is my potential problem? Im totaly newbie in mongo.
mongo version
$ mongod --version
db version v3.0.7
git version: nogitversion
mongo conf
$ cat /etc/mongodb.conf
# See http://www.mongodb.org/display/DOCS/File+Based+Configuration for format details
# Run mongod --help to see a list of options
bind_ip = 127.0.0.1
quiet = true
#dbpath = /var/lib/mongodb
dbpath = /home/data/mongodb
logpath = /var/log/mongodb/mongod.log
logappend = true
$
check free space
$ sudo -u mongodb df -h /home/data/mongodb/
Souborový systém Velikost Užito Volno Uži% Připojeno do
/dev/sda3 208G 187G 11G 95% /home
$
check privileges
$ sudo -u mongodb ls -lisa /home/data/mongodb
celkem 12
3547175 4 drwx------ 2 mongodb daemon 4096 28. lis 21.38 .
3538945 4 drwxr-xr-x 5 postgres root 4096 28. lis 21.14 ..
3544083 4 -rw-r--r-- 1 mongodb root 69 28. lis 21.17 storage.bson
$ sudo -u mongodb ls /home/data/mongodb/
storage.bson
problem
$ sudo -u mongodb mongod --repair
2015-11-29T16:24:08.722+0100 I STORAGE [initandlisten] exception in initAndListen: 39 Unable to write process id 4565 to file: /data/db/mongod.lock errno:28 No space left on device, terminating
2015-11-29T16:24:08.722+0100 I CONTROL [initandlisten] now exiting
2015-11-29T16:24:08.722+0100 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2015-11-29T16:24:08.722+0100 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2015-11-29T16:24:08.722+0100 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2015-11-29T16:24:08.722+0100 I NETWORK [initandlisten] shutdown: going to close sockets...
2015-11-29T16:24:08.722+0100 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2015-11-29T16:24:08.722+0100 I STORAGE [initandlisten] shutdown: closing all files...
2015-11-29T16:24:08.722+0100 I STORAGE [initandlisten] closeAllFiles() finished
2015-11-29T16:24:08.722+0100 I CONTROL [initandlisten] dbexit: rc: 100
$
as root
$sudo mongod --repair
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] MongoDB starting : pid=4610 port=27017 dbpath=/data/db 64-bit host=optiplex
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten]
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten]
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten]
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten]
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] db version v3.0.7
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] git version: nogitversion
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] build info: Linux flo 4.2.3-1-ARCH #1 SMP PREEMPT Sat Oct 3 18:52:50 CEST 2015 x86_64 BOOST_LIB_VERSION=1_59
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] allocator: tcmalloc
2015-11-29T16:25:56.792+0100 I CONTROL [initandlisten] options: { repair: true }
2015-11-29T16:25:56.793+0100 I STORAGE [initandlisten] finished checking dbs
2015-11-29T16:25:56.793+0100 I CONTROL [initandlisten] now exiting
2015-11-29T16:25:56.793+0100 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2015-11-29T16:25:56.793+0100 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2015-11-29T16:25:56.793+0100 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2015-11-29T16:25:56.793+0100 I NETWORK [initandlisten] shutdown: going to close sockets...
2015-11-29T16:25:56.793+0100 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2015-11-29T16:25:56.793+0100 I STORAGE [initandlisten] shutdown: closing all files...
2015-11-29T16:25:56.793+0100 I STORAGE [initandlisten] closeAllFiles() finished
2015-11-29T16:25:56.793+0100 I STORAGE [initandlisten] shutdown: removing fs lock...
2015-11-29T16:25:56.793+0100 I CONTROL [initandlisten] dbexit: rc: 0
in log i have no new records...
Thanks for your help.

Cannot Run Mongo as Service

My Environment
CentOS (I'm not sure the exact version since it's on iPage's VPS server.)
My Goal
Start mongod as a service:
sudo service mongod start
(Once I get this working, I want to get mongod to start when the server reboots via chkconfig:
sudo /sbin/chkconfig --level 345 mongod on
)
What Happens
It comes back with [FAILED] and I get this message in my logs:
2014-08-27T03:17:40.126+0000 ***** SERVER RESTARTED *****
2014-08-27T03:17:40.132+0000 [initandlisten] MongoDB starting : pid=3950 port=27017 dbpath=/var/lib/mongo 64-bit host=162-144-108-42.ipage.com
2014-08-27T03:17:40.132+0000 [initandlisten] db version v2.6.4
2014-08-27T03:17:40.132+0000 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910
2014-08-27T03:17:40.132+0000 [initandlisten] build info: Linux build7.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-08-27T03:17:40.132+0000 [initandlisten] allocator: tcmalloc
2014-08-27T03:17:40.132+0000 [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0.0.1" }, processManagement: { fork: true, pidFilePath: "/var/run/mongodb/mongod.pid" }, storage: { dbPath: "/var/lib/mongo" }, systemLog: { destination: "file", logAppend: true, path: "/var/log/mongodb/mongod.log" } }
2014-08-27T03:17:40.133+0000 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /var/lib/mongo/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2014-08-27T03:17:40.133+0000 [initandlisten] dbexit:
2014-08-27T03:17:40.133+0000 [initandlisten] shutdown: going to close listening sockets...
2014-08-27T03:17:40.133+0000 [initandlisten] shutdown: going to flush diaglog...
2014-08-27T03:17:40.133+0000 [initandlisten] shutdown: going to close sockets...
2014-08-27T03:17:40.133+0000 [initandlisten] shutdown: waiting for fs preallocator...
2014-08-27T03:17:40.133+0000 [initandlisten] shutdown: lock for final commit...
2014-08-27T03:17:40.133+0000 [initandlisten] shutdown: final commit...
2014-08-27T03:17:40.133+0000 [initandlisten] shutdown: closing all files...
2014-08-27T03:17:40.133+0000 [initandlisten] closeAllFiles() finished
2014-08-27T03:17:40.133+0000 [initandlisten] shutdown: removing fs lock...
2014-08-27T03:17:40.133+0000 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
2014-08-27T03:17:40.133+0000 [initandlisten] dbexit: really exiting now
What I've Tried:
Grepping the current processes doesn't find any mongod process:
ps aux | grep mongod
Removing the mongod.lock file doesn't help:
sudo rm mongod.lock
Changing the owner of the database doesn't help:
sudo chown -R my_username /var/lib/mongo
This looks like a permissions issue:
2014-08-27T03:17:40.133+0000 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /var/lib/mongo/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
Look if the user which mongo is running has the permission to write on that folder, assuming you're already removed the .lock file.
You are using chown with your username, but it seems that user must be mongo, not your username. Check the ownwer when the service tries to startup.
I was able to verify running sudo chown -R mongodb /var/lib/mongo works on my CentOS system. My /etc/init.d/mongod script runs the mongod process as user mongod. When I did a sudo chown -R root /var/lib/mongo I received the same Permission denied error, but when I set the directory permissions as mongod (sudo chown -R mongodb /var/lib/mongo) running sudo service mongod start works

Resources