0

When I tried to start MongoDB with the mongod command I got the following.

garrett@mint-desktop ~ $ mongod
mongod --help for help and startup options
Sun Jan 10 14:50:55.049 [initandlisten] MongoDB starting : pid=23327 port=27017 dbpath=/data/db/ 64-bit host=mint-desktop
Sun Jan 10 14:50:55.050 [initandlisten] db version v2.4.9
Sun Jan 10 14:50:55.050 [initandlisten] git version: nogitversion
Sun Jan 10 14:50:55.050 [initandlisten] build info: Linux orlo 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 17:37:58 UTC 2013 x86_64 BOOST_LIB_VERSION=1_54
Sun Jan 10 14:50:55.050 [initandlisten] allocator: tcmalloc
Sun Jan 10 14:50:55.050 [initandlisten] options: {}
Sun Jan 10 14:50:55.050 [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
Sun Jan 10 14:50:55.050 dbexit: 
Sun Jan 10 14:50:55.050 [initandlisten] shutdown: going to close listening sockets...
Sun Jan 10 14:50:55.050 [initandlisten] shutdown: going to flush diaglog...
Sun Jan 10 14:50:55.050 [initandlisten] shutdown: going to close sockets...
Sun Jan 10 14:50:55.050 [initandlisten] shutdown: waiting for fs preallocator...
Sun Jan 10 14:50:55.050 [initandlisten] shutdown: lock for final commit...
Sun Jan 10 14:50:55.050 [initandlisten] shutdown: final commit...
Sun Jan 10 14:50:55.050 [initandlisten] shutdown: closing all files...
Sun Jan 10 14:50:55.050 [initandlisten] closeAllFiles() finished
Sun Jan 10 14:50:55.050 dbexit: really exiting now

I then ran sudo mkdir /data/db and now I'm getting this.

garrett@mint-desktop ~ $ mongod
mongod --help for help and startup options
Sun Jan 10 14:52:24.797 [initandlisten] MongoDB starting : pid=23762 port=27017 dbpath=/data/db/ 64-bit host=mint-desktop
Sun Jan 10 14:52:24.797 [initandlisten] db version v2.4.9
Sun Jan 10 14:52:24.797 [initandlisten] git version: nogitversion
Sun Jan 10 14:52:24.797 [initandlisten] build info: Linux orlo 3.2.0-58-generic #88-Ubuntu SMP Tue Dec 3 17:37:58 UTC 2013 x86_64 BOOST_LIB_VERSION=1_54
Sun Jan 10 14:52:24.797 [initandlisten] allocator: tcmalloc
Sun Jan 10 14:52:24.797 [initandlisten] options: {}
Sun Jan 10 14:52:24.798 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
Sun Jan 10 14:52:24.798 dbexit: 
Sun Jan 10 14:52:24.798 [initandlisten] shutdown: going to close listening sockets...
Sun Jan 10 14:52:24.798 [initandlisten] shutdown: going to flush diaglog...
Sun Jan 10 14:52:24.798 [initandlisten] shutdown: going to close sockets...
Sun Jan 10 14:52:24.798 [initandlisten] shutdown: waiting for fs preallocator...
Sun Jan 10 14:52:24.798 [initandlisten] shutdown: lock for final commit...
Sun Jan 10 14:52:24.798 [initandlisten] shutdown: final commit...
Sun Jan 10 14:52:24.798 [initandlisten] shutdown: closing all files...
Sun Jan 10 14:52:24.798 [initandlisten] closeAllFiles() finished
Sun Jan 10 14:52:24.798 [initandlisten] shutdown: removing fs lock...
Sun Jan 10 14:52:24.798 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
Sun Jan 10 14:52:24.798 dbexit: really exiting now

Any ideas?

2
Contributors
2
Replies
10
Views
1 Year
Discussion Span
Last Post by cereal
0

Okay so I fixed that and now I'm getting this.
Sun Jan 10 14:57:42.529 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
Sun Jan 10 14:57:42.529 [websvr] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:28017
Sun Jan 10 14:57:42.529 [initandlisten] ERROR: addr already in use

So now I'm having to start MongoDB with using mongod --port 28018 instead of the default 28017. How can I figure out what's using the port that MongoDB is also wanting to use? Thanks.

0

You can run netstat with these options:

sudo netstat -tulpn |grep -E ':[0-9]{5}'

Or simply search for a specific port number:

sudo netstat -tulpn |grep :28017

It should return something like:

...
tcp    0    0 0.0.0.0:17500    0.0.0.0:*    LISTEN    3374/dropbox
...

You can get more information about the process by checking the identifier in the /proc/ directory:

ls -lh /proc/3374/exe

this should return the path. More information here:

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.