MongoDB --dbpath giving access to old data - mongodb

I have mongo installed on my local machine. When I start the database by running mongod I got this error (that is fairly common, and this site has solutions to workarounds):
$ mongod
mongod --help for help and startup options
2015-01-01T22:31:17.350-0600 [initandlisten] MongoDB starting : pid=2835 port=27017 dbpath=/data/db 64-bit host=hermes
2015-01-01T22:31:17.351-0600 [initandlisten] db version v2.6.4
2015-01-01T22:31:17.351-0600 [initandlisten] git version: nogitversion
2015-01-01T22:31:17.351-0600 [initandlisten] build info: Darwin minimavericks.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2015-01-01T22:31:17.351-0600 [initandlisten] allocator: tcmalloc
2015-01-01T22:31:17.351-0600 [initandlisten] options: {}
2015-01-01T22:31:17.351-0600 [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
2015-01-01T22:31:17.351-0600 [initandlisten] dbexit:
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: going to close listening sockets...
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: going to flush diaglog...
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: going to close sockets...
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: waiting for fs preallocator...
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: lock for final commit...
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: final commit...
2015-01-01T22:31:17.351-0600 [initandlisten] shutdown: closing all files...
2015-01-01T22:31:17.352-0600 [initandlisten] closeAllFiles() finished
2015-01-01T22:31:17.355-0600 [initandlisten] dbexit: really exiting now
I created a directory in my development environment at /my/curent/directory/data/db and started mongo again with $ mongod --dbpath /my/curent/directory/data/db, this time producing:
2015-01-01T22:32:31.282-0600 [initandlisten] options: { storage: { dbPath: "./data/db" } }
2015-01-01T22:32:31.319-0600 [initandlisten] journal dir=./data/db/journal
2015-01-01T22:32:31.320-0600 [initandlisten] recover : no journal files present, no recovery needed
2015-01-01T22:32:31.383-0600 [FileAllocator] allocating new datafile ./data/db/local.ns, filling with zeroes...
2015-01-01T22:32:31.383-0600 [FileAllocator] creating directory ./data/db/_tmp
2015-01-01T22:32:31.482-0600 [FileAllocator] done allocating datafile ./data/db/local.ns, size: 16MB, took 0.098 secs
2015-01-01T22:32:31.842-0600 [FileAllocator] allocating new datafile ./data/db/local.0, filling with zeroes...
2015-01-01T22:32:32.756-0600 [FileAllocator] done allocating datafile ./data/db/local.0, size: 64MB, took 0.914 secs
2015-01-01T22:32:33.215-0600 [initandlisten] build index on: local.startup_log properties: { v: 1, key: { _id: 1 }, name: "_id_", ns: "local.startup_log" }
2015-01-01T22:32:33.216-0600 [initandlisten] added index to empty collection
2015-01-01T22:32:33.216-0600 [initandlisten] command local.$cmd command: create { create: "startup_log", size: 10485760, capped: true } ntoreturn:1 keyUpdates:0 numYields:0 reslen:37 1852ms
2015-01-01T22:32:33.216-0600 [initandlisten] waiting for connections on port 27017
2015-01-01T22:33:31.402-0600 [clientcursormon] mem (MB) res:33 virt:2635
2015-01-01T22:33:31.402-0600 [clientcursormon] mapped (incl journal view):160
2015-01-01T22:33:31.402-0600 [clientcursormon] connections:0
It's great. Using the mongo shell, I can access my collections that I was working with in this directory, but I can also see all of my other databases from weeks prior (when this directory did not exist) using show dbs. What purpose does the --dbpath option serve if not to isolate where data is stored? Is something weird happening here?

MongoDB requires a data directory to store all data. MongoDB’s default data directory path is \data\db.
To use an alternate dbpath, specify the path in the configuration file (e.g. C:\Program Files\MongoDB\mongod.cfg) or on the command line with the --dbpath option.
Read more about MongoDB Installation
If you are using windows then create data\db folder under C drive.
If you are using your own directory for data then pass full path of the folder as --dbpath argument value.

If MongoDB’s default data directory path "\data\db" is correct but accessing old data means just check your Task Manager.
End all mongo command and restart your mongodb. I tried it, working well

Related

MongoDB, change db path, not working

I upgraded from debian 6 to debian 8. After that I upgraded MongoDB from ~2.5 to 3.2.9. They seemed to have changed the db path since I could not see any of my databases. I upgraded the dbpath. Stil I can't see any of my databases.
seprst#SESTOWS011:/data/db$ ls
graddays graddays.0 graddays.ns journal local local.0 local.ns mongod.lock mypdb mypdb.0 mypdb.ns
seprst#SESTOWS011:/data/db$ sudo service mongod stop
seprst#SESTOWS011:/data/db$ mongod --dbpath /data/db
2016-08-17T12:02:26.468+0200 I CONTROL [initandlisten] MongoDB starting : pid=22283 port=27017 dbpath=/data/db 64-bit host=SESTOWS011
2016-08-17T12:02:26.468+0200 I CONTROL [initandlisten] db version v3.2.9
2016-08-17T12:02:26.468+0200 I CONTROL [initandlisten] git version: 22ec9e93b40c85fc7cae7d56e7d6a02fd811088c
2016-08-17T12:02:26.468+0200 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.0.1t 3 May 2016
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] allocator: tcmalloc
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] modules: none
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] build environment:
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] distmod: debian71
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] distarch: x86_64
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] target_arch: x86_64
2016-08-17T12:02:26.469+0200 I CONTROL [initandlisten] options: { storage: { dbPath: "/data/db" } }
2016-08-17T12:02:26.513+0200 I - [initandlisten] Detected data files in /data/db created by the 'mmapv1' storage engine, so setting the ac tive storage engine to 'mmapv1'.
2016-08-17T12:02:26.530+0200 I JOURNAL [initandlisten] journal dir=/data/db/journal
2016-08-17T12:02:26.545+0200 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2016-08-17T12:02:26.590+0200 I JOURNAL [initandlisten] warning couldn't write to / rename file /data/db/journal/prealloc.0: couldn't open file / data/db/journal/prealloc.0 for writing errno:9 Bad file descriptor
2016-08-17T12:02:26.590+0200 I STORAGE [initandlisten] exception in initAndListen: 13516 couldn't open file /data/db/journal/j._0 for writing er rno:9 Bad file descriptor, terminating
2016-08-17T12:02:26.590+0200 I CONTROL [initandlisten] now exiting
2016-08-17T12:02:26.590+0200 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2016-08-17T12:02:26.590+0200 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27017.sock
2016-08-17T12:02:26.590+0200 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2016-08-17T12:02:26.590+0200 I NETWORK [initandlisten] shutdown: going to close sockets...
2016-08-17T12:02:26.591+0200 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2016-08-17T12:02:26.591+0200 I STORAGE [initandlisten] shutdown: final commit...
2016-08-17T12:02:26.591+0200 I STORAGE [initandlisten] shutdown: closing all files...
2016-08-17T12:02:26.591+0200 I STORAGE [initandlisten] closeAllFiles() finished
2016-08-17T12:02:26.591+0200 I CONTROL [initandlisten] dbexit: rc: 100
seprst#SESTOWS011:/data/db$ sudo service mongod start
seprst#SESTOWS011:/data/db$ mongo
MongoDB shell version: 3.2.9
connecting to: test
Server has startup warnings:
2016-08-17T12:02:40.540+0200 I CONTROL [initandlisten]
2016-08-17T12:02:40.540+0200 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2016-08-17T12:02:40.540+0200 I CONTROL [initandlisten] ** We suggest setting it to 'never'
2016-08-17T12:02:40.540+0200 I CONTROL [initandlisten]
> show dbs
local 0.000GB
>
Any suggestions?
there is formatting issue with comment so posting as answer
ps -xa | grep mongod
open config file cat /etc/mongod.conf
for me it's dbPath: /var/lib/mongodb
you can check your settings.
to make changes permanent at your own risk
sudo service mongod stop
sudo ln -s /data/db/ /var/lib/mongodb
sudo chown mongodb:mongodb /data/db/
sudo service mongod start
//test if mongodb user can access new location:
sudo -u mongodb -s cd /data/db/

mongodb suddenly stopped to work

I've had mongo running for a while on my dev server running Centos 6.5 and mongo 2.6.4.
But then I needed to install mysql for a different project and now suddenly mongo doesn't work.
I tried to re-install it and upgrade it to 2.6.5 at the same time. I've tried to start it and restart it:
# sudo service mongod restart
Stopping mongod: [FAILED]
Starting mongod: [FAILED]
Repairing it said I missed /data/db which I then created. The repair responds like this:
# sudo mongod --repair
2014-10-24T15:52:14.710-0400 [initandlisten] MongoDB starting : pid=1182 port=27017 dbpath=/data/db 64-bit host=myhost
2014-10-24T15:52:14.710-0400 [initandlisten] db version v2.6.5
2014-10-24T15:52:14.710-0400 [initandlisten] git version: e99d4fcb4279c0279796f237aa92fe3b64560bf6
2014-10-24T15:52:14.710-0400 [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-24T15:52:14.710-0400 [initandlisten] allocator: tcmalloc
2014-10-24T15:52:14.710-0400 [initandlisten] options: { repair: true }
2014-10-24T15:52:14.726-0400 [initandlisten] repairDatabase local
2014-10-24T15:52:14.726-0400 [initandlisten] allocating new ns file /data/db/_tmp_repairDatabase_0/local.ns, filling with zeroes...
2014-10-24T15:52:14.843-0400 [FileAllocator] allocating new datafile /data/db/_tmp_repairDatabase_0/local.0, filling with zeroes...
2014-10-24T15:52:14.843-0400 [FileAllocator] creating directory /data/db/_tmp_repairDatabase_0/_tmp
2014-10-24T15:52:14.879-0400 [FileAllocator] done allocating datafile /data/db/_tmp_repairDatabase_0/local.0, size: 64MB, took 0.017 secs
2014-10-24T15:52:14.897-0400 [initandlisten] finished checking dbs
2014-10-24T15:52:14.897-0400 [initandlisten] dbexit:
2014-10-24T15:52:14.897-0400 [initandlisten] shutdown: going to close listening sockets...
2014-10-24T15:52:14.897-0400 [initandlisten] shutdown: going to flush diaglog...
2014-10-24T15:52:14.897-0400 [initandlisten] shutdown: going to close sockets...
2014-10-24T15:52:14.897-0400 [initandlisten] shutdown: waiting for fs preallocator...
2014-10-24T15:52:14.897-0400 [initandlisten] shutdown: closing all files...
2014-10-24T15:52:14.897-0400 [initandlisten] closeAllFiles() finished
2014-10-24T15:52:14.897-0400 [initandlisten] shutdown: removing fs lock...
2014-10-24T15:52:14.897-0400 [initandlisten] dbexit: really exiting now
Starting it again, and fails.
did this:
#semanage port -a -t mongodb_port_t -p tcp 27017
Killed
Trying to enter the mongo shell responds with this:
# mongo
MongoDB shell version: 2.6.5
connecting to: test
2014-10-24T15:59:40.243-0400 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2014-10-24T15:59:40.244-0400 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
I'm out of ideas. Any suggestions?

Unable to start mongod service

I installed mongodb using the information in this link. However, when I user the service mongod start command I get the following error. Can someone help me troubleshoot?
[Piyush#localhost ~]$ service mongod start
/etc/init.d/mongod: line 54: ulimit: open files: cannot modify limit: Operation not permitted
/etc/init.d/mongod: line 56: ulimit: max user processes: cannot modify limit: Operation not permitted
Starting mongod: runuser: using restricted shell /bin/false
runuser: cannot set groups: Operation not permitted
[FAILED]
[Piyush#localhost ~]$ sudo service mongod start
[sudo] password for Piyush:
Starting mongod: [FAILED]
I tried using --repair command. I get the following output for that:
[Piyush#localhost ~]$ sudo mongod --repair
2014-09-24T00:05:06.089-0400 [initandlisten] MongoDB starting : pid=2807 port=27017 dbpath=/data/db 64-bit host=localhost.localdomain
2014-09-24T00:05:06.089-0400 [initandlisten] db version v2.6.4
2014-09-24T00:05:06.089-0400 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910
2014-09-24T00:05:06.089-0400 [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-09-24T00:05:06.089-0400 [initandlisten] allocator: tcmalloc
2014-09-24T00:05:06.090-0400 [initandlisten] options: { repair: true }
2014-09-24T00:05:06.106-0400 [initandlisten] finished checking dbs
2014-09-24T00:05:06.106-0400 [initandlisten] dbexit:
2014-09-24T00:05:06.106-0400 [initandlisten] shutdown: going to close listening sockets...
2014-09-24T00:05:06.106-0400 [initandlisten] shutdown: going to flush diaglog...
2014-09-24T00:05:06.106-0400 [initandlisten] shutdown: going to close sockets...
2014-09-24T00:05:06.106-0400 [initandlisten] shutdown: waiting for fs preallocator...
2014-09-24T00:05:06.106-0400 [initandlisten] shutdown: closing all files...
2014-09-24T00:05:06.106-0400 [initandlisten] closeAllFiles() finished
2014-09-24T00:05:06.107-0400 [initandlisten] shutdown: removing fs lock...
2014-09-24T00:05:06.107-0400 [initandlisten] dbexit: really exiting now
[EDIT 1]_____________________________________________________________________________
In the log file I see:
[root#localhost ~]# cat /var/log/mongodb/mongod.log.2014-09-24T16-00-32
2014-09-24T11:54:23.636-0400 ***** SERVER RESTARTED *****
2014-09-24T11:54:23.665-0400 [initandlisten] MongoDB starting : pid=3004 port=27017 dbpath=/var/lib/mongo 64-bit host=localhost.localdomain
2014-09-24T11:54:23.665-0400 [initandlisten] db version v2.6.4
2014-09-24T11:54:23.665-0400 [initandlisten] git version: 3a830be0eb92d772aa855ebb711ac91d658ee910
2014-09-24T11:54:23.665-0400 [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-09-24T11:54:23.665-0400 [initandlisten] allocator: tcmalloc
2014-09-24T11:54:23.665-0400 [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-09-24T11:54:23.680-0400 [initandlisten] journal dir=/var/lib/mongo/journal
2014-09-24T11:54:23.680-0400 [initandlisten] recover : no journal files present, no recovery needed
2014-09-24T11:54:23.680-0400 [initandlisten]
2014-09-24T11:54:23.680-0400 [initandlisten] ERROR: Insufficient free space for journal files
2014-09-24T11:54:23.680-0400 [initandlisten] Please make at least 3379MB available in /var/lib/mongo/journal or use --smallfiles
2014-09-24T11:54:23.680-0400 [initandlisten]
2014-09-24T11:54:23.681-0400 [initandlisten] exception in initAndListen: 15926 Insufficient free space for journals, terminating
2014-09-24T11:54:23.681-0400 [initandlisten] dbexit:
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: going to close listening sockets...
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: going to flush diaglog...
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: going to close sockets...
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: waiting for fs preallocator...
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: lock for final commit...
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: final commit...
2014-09-24T11:54:23.681-0400 [initandlisten] shutdown: closing all files...
2014-09-24T11:54:23.681-0400 [initandlisten] closeAllFiles() finished
2014-09-24T11:54:23.681-0400 [initandlisten] journalCleanup...
2014-09-24T11:54:23.681-0400 [initandlisten] removeJournalFiles
2014-09-24T11:54:23.684-0400 [initandlisten] shutdown: removing fs lock...
2014-09-24T11:54:23.684-0400 [initandlisten] dbexit: really exiting now
The --repair flag is meant to repair a corrupt database, not to solve any permission problems
You obviously didn't follow the instructions of the link too closely, because he did start the service as root. ;) sudo may only allow certain parts of the init scripts to be executed with superuser rights by the user calling it. Others may (though they shouldn't) silently fail. As for init scripts at least: sudo != being root.
To fix the problem: sudo chown mongod -R /var/log/mongodb/ && sudo chown mongod -R /var/run/mongodb && sudo chown mongod -R /var/lib/mongo Then become root and try to run mongo manually with sudo -u mongod mongod --dbpath /var/lib/mongo --logpath /var/log/mongodb/mongod.log. In case there are other problems left, mongodb will tell you. Fix those until starting mongodb manually as written above works flawless, then use the initscript from that point on.
Edit: corrected the --dbpath option as per comment

Setup And Running MongoDB [duplicate]

This question already has answers here:
Mongod complains that there is no /data/db folder
(28 answers)
Closed 8 years ago.
I am using MongoDB on OSX. I am following along with a book.
MongoDB: The Definitive Guide, Second Edition
I have MongoDB installed and running. I have made a few collections with some values in them.
I installed using Homebrew
When I run mongo in the terminal my shell starts and I can use it fine.
When I run mongod I get an error stating a do not have a data/db directory. I know this is because the default location for mongo to store data is inside that directory but homebrew sets its own path up.
When I run
Home:~ ThisIsMe$ mongo
MongoDB shell version: 2.6.3
connecting to: test
> db.serverCmdLineOpts()
{
"argv" : [
"/usr/local/opt/mongodb/bin/mongod",
"--config",
"/usr/local/etc/mongod.conf"
],
"parsed" : {
"config" : "/usr/local/etc/mongod.conf",
"net" : {
"bindIp" : "127.0.0.1"
},
"storage" : {
"dbPath" : "/usr/local/var/mongodb"
},
"systemLog" : {
"destination" : "file",
"logAppend" : true,
"path" : "/usr/local/var/log/mongodb/mongo.log"
}
},
"ok" : 1
}
>
I get those file paths where homebrew set my mongo up at.
I want to make sure everything is set up correctly. Do I need to add something else to be able to run mongod without errors? I am under the impression I should be able to run mongod then go to http://localhost:28017/ to see information about my mongo.
But I cannot get mongod to run without the errors about data/db
Home:~ ThisIsMe$ mongod
mongod --help for help and startup options
2014-07-24T13:09:07.817-0500 [initandlisten] MongoDB starting : pid=1668 port=27017 dbpath=/data/db 64-bit host=NichoDiaz
2014-07-24T13:09:07.817-0500 [initandlisten]
2014-07-24T13:09:07.817-0500 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2014-07-24T13:09:07.817-0500 [initandlisten] db version v2.6.3
2014-07-24T13:09:07.817-0500 [initandlisten] git version: nogitversion
2014-07-24T13:09:07.817-0500 [initandlisten] build info: Darwin minimavericks.local 13.2.0 Darwin Kernel Version 13.2.0: Thu Apr 17 23:03:13 PDT 2014; root:xnu-2422.100.13~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2014-07-24T13:09:07.818-0500 [initandlisten] allocator: tcmalloc
2014-07-24T13:09:07.818-0500 [initandlisten] options: {}
2014-07-24T13:09:07.818-0500 [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
2014-07-24T13:09:07.818-0500 [initandlisten] dbexit:
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: going to close listening sockets...
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: going to flush diaglog...
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: going to close sockets...
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: waiting for fs preallocator...
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: lock for final commit...
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: final commit...
2014-07-24T13:09:07.818-0500 [initandlisten] shutdown: closing all files...
2014-07-24T13:09:07.818-0500 [initandlisten] closeAllFiles() finished
2014-07-24T13:09:07.818-0500 [initandlisten] dbexit: really exiting now
Home:~ ThisIsMe$
It's there in the error message:
ERROR: dbpath (/data/db) does not exist.
Create this directory or give existing directory in --dbpath.
You need to create the /data and /data/db directories and make certain that the user running mongod can write to both of those directories. That's where mongod is going to write your database data. It's not created by default. Alternatively you could create your data directory elsewhere and then pass it in using --dbpath.

Double MongoDb Version

Problem with MongoDB Version
I installed Mongo Db follow this Link
http://www.mkyong.com/mongodb/how-to-install-mongodb-on-mac-os-x/
After i updated with Brew
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/
mongod --help for help and startup options
2014-04-28T10:49:46.475+0200 [initandlisten] MongoDB starting : pid=2197 port=27017 dbpath=/data/db 64-bit host=Foo.local
2014-04-28T10:49:46.475+0200 [initandlisten]
2014-04-28T10:49:46.475+0200 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2014-04-28T10:49:46.475+0200 [initandlisten] db version v2.6.0
2014-04-28T10:49:46.475+0200 [initandlisten] git version: nogitversion
2014-04-28T10:49:46.475+0200 [initandlisten] build info: Darwin minimavericks.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2014-04-28T10:49:46.476+0200 [initandlisten] allocator: tcmalloc
2014-04-28T10:49:46.476+0200 [initandlisten] options: {}
2014-04-28T10:49:46.476+0200 [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
2014-04-28T10:49:46.476+0200 [initandlisten] dbexit:
2014-04-28T10:49:46.476+0200 [initandlisten] shutdown: going to close listening sockets...
2014-04-28T10:49:46.476+0200 [initandlisten] shutdown: going to flush diaglog...
2014-04-28T10:49:46.476+0200 [initandlisten] shutdown: going to close sockets...
2014-04-28T10:49:46.476+0200 [initandlisten] shutdown: waiting for fs preallocator...
2014-04-28T10:49:46.476+0200 [initandlisten] shutdown: lock for final commit...
2014-04-28T10:49:46.476+0200 [initandlisten] shutdown: final commit...
2014-04-28T10:49:46.476+0200 [initandlisten] shutdown: closing all files...
2014-04-28T10:49:46.477+0200 [initandlisten] closeAllFiles() finished
2014-04-28T10:49:46.477+0200 [initandlisten] shutdown: removing fs lock...
2014-04-28T10:49:46.477+0200 [initandlisten] couldn't remove fs lock errno:9 Bad file descriptor
2014-04-28T10:49:46.477+0200 [initandlisten] dbexit: really exiting now
➜ ~ mongo --version
MongoDB shell version: 2.6.0
but if i do this:
> use foo
switched to db foo
> use foo
switched to db foo
> foo.version()
2.4.9
How can I clean my double Installation?
I want 2.6.0
#monkeyUser,
Running two different MongoDB instances is not an issue per-se provided they use different data directories. In your case, looks like you have two MongoDB installation with same data directory configured for both. If you intend to keep both the instances you'll need to change the dbPath for one of them to point at some other directory.
If you do not intend to run two instances and only the latest instance, uninstall the previously installed instance using same steps from the blog post but executing them in reverse order (bottom up) and in inverted sense i.e. if blog has a step to create a directory /data/db, you would execute this steps as "deleting the data directory /data/db". Once you have removed one of the instances, second instances should come up fine.