Double MongoDb Version - mongodb

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.

Related

Mongo DB can't start, keeps quitting on me

I am a total mongo newbie who is very confused, frustrated and frankly lost...
I have tried installing / uninstalling mongo, then reinstalling. AT one point it seemed to be working as I followed a tutorial but ultimately wouldn't after I returned to use it in a node app I am trying to create. Now that I have it installed I created the /data/db but it keeps failing when I go to run "mongod"
name$ mongod
2015-06-28T15:13:34.503-0400 E NETWORK [initandlisten] listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017
2015-06-28T15:13:34.503-0400 E NETWORK [initandlisten] addr already in use
2015-06-28T15:13:34.513-0400 I JOURNAL [initandlisten] journal dir=/data/db/journal
2015-06-28T15:13:34.513-0400 I JOURNAL [initandlisten] recover : no journal files present, no recovery needed
2015-06-28T15:13:34.541-0400 I JOURNAL [durability] Durability thread started
2015-06-28T15:13:34.541-0400 I JOURNAL [journal writer] Journal writer thread started
2015-06-28T15:13:34.541-0400 I CONTROL [initandlisten] MongoDB starting : pid=4041 port=27017 dbpath=/data/db 64-bit host=Vickens-MBP.home
2015-06-28T15:13:34.541-0400 I CONTROL [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2015-06-28T15:13:34.541-0400 I CONTROL [initandlisten]
2015-06-28T15:13:34.541-0400 I CONTROL [initandlisten]
2015-06-28T15:13:34.541-0400 I CONTROL [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2015-06-28T15:13:34.542-0400 I CONTROL [initandlisten] db version v3.0.4
2015-06-28T15:13:34.542-0400 I CONTROL [initandlisten] git version: nogitversion
2015-06-28T15:13:34.542-0400 I CONTROL [initandlisten] build info: Darwin yosemitevm.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2015-06-28T15:13:34.542-0400 I CONTROL [initandlisten] allocator: system
2015-06-28T15:13:34.542-0400 I CONTROL [initandlisten] options: {}
2015-06-28T15:13:34.551-0400 I CONTROL [initandlisten] now exiting
2015-06-28T15:13:34.551-0400 I NETWORK [initandlisten] shutdown: going to close listening sockets...
2015-06-28T15:13:34.551-0400 I NETWORK [initandlisten] shutdown: going to flush diaglog...
2015-06-28T15:13:34.551-0400 I NETWORK [initandlisten] shutdown: going to close sockets...
2015-06-28T15:13:34.551-0400 I STORAGE [initandlisten] shutdown: waiting for fs preallocator...
2015-06-28T15:13:34.552-0400 I STORAGE [initandlisten] shutdown: final commit...
2015-06-28T15:13:34.555-0400 I JOURNAL [initandlisten] journalCleanup...
2015-06-28T15:13:34.555-0400 I JOURNAL [initandlisten] removeJournalFiles
2015-06-28T15:13:34.556-0400 I JOURNAL [initandlisten] Terminating durability thread ...
2015-06-28T15:13:34.663-0400 I JOURNAL [journal writer] Journal writer thread stopped
2015-06-28T15:13:34.663-0400 I JOURNAL [durability] Durability thread stopped
2015-06-28T15:13:34.664-0400 I STORAGE [initandlisten] shutdown: closing all files...
2015-06-28T15:13:34.665-0400 I STORAGE [initandlisten] closeAllFiles() finished
2015-06-28T15:13:34.665-0400 I STORAGE [initandlisten] shutdown: removing fs lock...
2015-06-28T15:13:34.665-0400 I CONTROL [initandlisten] dbexit: rc: 48
Looks like something is running on 0.0.0.0:27017,
run command to kill that process first
kill $(lsof -t -i:27017)
then start you mongo server
sudo rm /var/lib/mongodb/mongod.lock
mongod --repair
sudo service mongodb start

Can't get MongoDB to start?

Version 2.67 of MongoDB is installed. When I run MongoD in Terminal (mac os x 10.95), here is the message I get. (BTW, I have tried Sudo)![Error][1]
Alis-MacBook-Air:~ alitaghikhani$ mongod
mongod --help for help and startup options
2015-02-08T19:00:43.915-0500 [initandlisten] MongoDB starting : pid=40591 port=27017 dbpath=/data/db 64-bit host=Alis-MacBook-Air.local
2015-02-08T19:00:43.916-0500 [initandlisten]
2015-02-08T19:00:43.916-0500 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
2015-02-08T19:00:43.916-0500 [initandlisten] db version v2.6.7
2015-02-08T19:00:43.916-0500 [initandlisten] git version: nogitversion
2015-02-08T19:00:43.916-0500 [initandlisten] build info: Darwin minimavericks.local 13.4.0 Darwin Kernel Version 13.4.0: Sun Aug 17 19:50:11 PDT 2014; root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64 BOOST_LIB_VERSION=1_49
2015-02-08T19:00:43.916-0500 [initandlisten] allocator: tcmalloc
2015-02-08T19:00:43.916-0500 [initandlisten] options: {}
2015-02-08T19:00:43.919-0500 [initandlisten] exception in initAndListen: 10310 Unable to lock file: /data/db/mongod.lock. Is a mongod instance already running?, terminating
2015-02-08T19:00:43.919-0500 [initandlisten] dbexit:
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: going to close listening sockets...
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: going to flush diaglog...
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: going to close sockets...
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: waiting for fs preallocator...
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: lock for final commit...
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: final commit...
2015-02-08T19:00:43.919-0500 [initandlisten] shutdown: closing all files...
2015-02-08T19:00:43.920-0500 [initandlisten] closeAllFiles() finished
2015-02-08T19:00:43.920-0500 [initandlisten] dbexit: really exiting now
If it is the first time you are running MongoDB, make sure you have you have owner permission to create mongod.lock file to create in /data/db path.
sudo chown -R `id -u` /data/db
first try:
mongo localhost
to see if there already a mongod instance running. if not, you should delete the mongod.lock
sudo rm /data/db/mongod.lock
if means you had an unclear shutdown of mongod.
Important: this assumes you don't have anything important in the DB because it seems it's running on your macbook air.

MongoDB running locally but when trying to access remotely it failed

Able to run MongoDB locally but when trying to access remotely it failed. Havent done any firewall setup. What could be the issue? How to do troubleshoot?
Also the MongoDB status show running
service mongod status
mongod (pid 25342) is running...
But when trying to restart the service it says
service mongod restart
Stopping mongod: [ OK ]
Starting mongod: [FAILED]
But still the process is running
Update
Tried mongod --repair here is the update
2015-01-10T10:46:33.109-0500 [initandlisten] MongoDB starting : pid=29018 port=2 7017 dbpath=/data/db 64-bit host=ns4008927.ip-192-99-3.net
2015-01-10T10:46:33.109-0500 [initandlisten] db version v2.6.6
2015-01-10T10:46:33.109-0500 [initandlisten] git version: 608e8bc319627693b04cc7 da29ecc300a5f45a1f
2015-01-10T10:46:33.109-0500 [initandlisten] build info: Linux build10.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_LI B_VERSION=1_49
2015-01-10T10:46:33.109-0500 [initandlisten] allocator: tcmalloc
2015-01-10T10:46:33.109-0500 [initandlisten] options: { repair: true }
2015-01-10T10:46:33.112-0500 [initandlisten] finished checking dbs
2015-01-10T10:46:33.112-0500 [initandlisten] dbexit:
2015-01-10T10:46:33.112-0500 [initandlisten] shutdown: going to close listening sockets...
2015-01-10T10:46:33.112-0500 [initandlisten] shutdown: going to flush diaglog...
2015-01-10T10:46:33.112-0500 [initandlisten] shutdown: going to close sockets...
2015-01-10T10:46:33.112-0500 [initandlisten] shutdown: waiting for fs preallocat or...
2015-01-10T10:46:33.112-0500 [initandlisten] shutdown: closing all files...
2015-01-10T10:46:33.112-0500 [initandlisten] closeAllFiles() finished
2015-01-10T10:46:33.112-0500 [initandlisten] shutdown: removing fs lock...
2015-01-10T10:46:33.112-0500 [initandlisten] dbexit: really exiting now
You need to remove this line from mongo's config file (on Ubuntu, mine is at /etc/mongod.conf):
bind_ip = 127.0.0.1
Or, if it's YAML,
bindIp: 127.0.0.1
Source: http://docs.mongodb.org/manual/reference/configuration-options/
"Changed in version 2.6.0: The deb and rpm packages include a default configuration file that sets net.bindIp to 127.0.0.1."
The default value for bindIp/bind_ip is "all interfaces" - so that's where the deletion comes in handy.

sudo service mongod start failed on RHEL system

I have followed the instructions on MongoDB's website to install MongoDB on RHEL systems. Whenever I use the command sudo service mongod start I get the message Starting mongod: [FAILED]. Does anyone know what I am doing wrong? I already changed the permissions to the /var/lib/mongo and /var/log/mongodb directories.
In addition, this is what my log file reads for the last time I tried to start mongoDB
2014-11-28T16:52:42.532-0600 ***** SERVER RESTARTED *****
2014-11-28T16:52:42.535-0600 [initandlisten] MongoDB starting : pid=2846 port=27017 dbpath=/var/lib/mongo$
2014-11-28T16:52:42.535-0600 [initandlisten] db version v2.6.5
2014-11-28T16:52:42.535-0600 [initandlisten] git version: e99d4fcb4279c0279796f237aa92fe3b64560bf6
2014-11-28T16:52:42.535-0600 [initandlisten] build info: Linux build8.nj1.10gen.cc 2.6.32-431.3.1.el6.x86$
2014-11-28T16:52:42.535-0600 [initandlisten] allocator: tcmalloc
2014-11-28T16:52:42.535-0600 [initandlisten] options: { config: "/etc/mongod.conf", net: { bindIp: "127.0$
2014-11-28T16:52:42.535-0600 [initandlisten] exception in initAndListen: 10310 Unable to lock file: /var/$
2014-11-28T16:52:42.535-0600 [initandlisten] dbexit:
2014-11-28T16:52:42.535-0600 [initandlisten] shutdown: going to close listening sockets...
2014-11-28T16:52:42.535-0600 [initandlisten] shutdown: going to flush diaglog...
2014-11-28T16:52:42.535-0600 [initandlisten] shutdown: going to close sockets...
2014-11-28T16:52:42.535-0600 [initandlisten] shutdown: waiting for fs preallocator...
2014-11-28T16:52:42.535-0600 [initandlisten] shutdown: lock for final commit...
2014-11-28T16:52:42.535-0600 [initandlisten] shutdown: final commit...
2014-11-28T16:52:42.536-0600 [initandlisten] shutdown: closing all files...
2014-11-28T16:52:42.536-0600 [initandlisten] closeAllFiles() finished
2014-11-28T16:52:42.536-0600 [initandlisten] dbexit: really exiting now
that looks very similar to the output when you have a mongo already running.
probably you have a startup script installed in /etc/init.d/mongod
Your log file is clipped. Please include an unclipped version where we can see the entire line. From what's there, mongod couldn't lock something, which likely means you already have a mongod running in that directory or the permissions aren't set to allow mongod to take the lock.

mongodb: Is there any way of stoping mongod from trying to set a lock on mongod.lock?

Because of the size of the mongodb database I'm trying to build and because I needed a filesystem that can handle parallel writes, I moved it on a cluster that has lustreFS, which fulfills these needs.
The problem is that I can't start mongod, so I can't connect anything to the database, because mongod can't get a lock on mongod.lock. I don't have root or sudo permissions but this does not seem to be the problem here because permissions are not mentioned, as you can see:
[user#host mongo]$ ./mongod --dbpath=path-to-db
2014-07-28T20:29:58.600+0300 [initandlisten] MongoDB starting : pid=54974 port=27017 dbpath=path-to-db 64-bit host=hostname
2014-07-28T20:29:58.600+0300 [initandlisten]
2014-07-28T20:29:58.600+0300 [initandlisten] ** WARNING: /proc/sys/vm/zone_reclaim_mode is 1
2014-07-28T20:29:58.600+0300 [initandlisten] ** We suggest setting it to 0
2014-07-28T20:29:58.600+0300 [initandlisten] ** http://www.kernel.org/doc/Documentation/sysctl/vm.txt
2014-07-28T20:29:58.600+0300 [initandlisten] db version v2.6.3
2014-07-28T20:29:58.601+0300 [initandlisten] git version: 255f67a66f9603c59380b2a389e386910bbb52cb
2014-07-28T20:29:58.601+0300 [initandlisten] build info: Linux build12.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-07-28T20:29:58.601+0300 [initandlisten] allocator: tcmalloc
2014-07-28T20:29:58.601+0300 [initandlisten] options: { storage: { dbPath: "path-to-db" } }
2014-07-28T20:29:58.614+0300 [initandlisten] exception in initAndListen: 10310 Unable to lock file: path-to-db/mongod.lock. Is a mongod instance already running?, terminating
2014-07-28T20:29:58.615+0300 [initandlisten] dbexit:
2014-07-28T20:29:58.615+0300 [initandlisten] shutdown: going to close listening sockets...
2014-07-28T20:29:58.615+0300 [initandlisten] shutdown: going to flush diaglog...
2014-07-28T20:29:58.615+0300 [initandlisten] shutdown: going to close sockets...
2014-07-28T20:29:58.615+0300 [initandlisten] shutdown: waiting for fs preallocator...
2014-07-28T20:29:58.615+0300 [initandlisten] shutdown: lock for final commit...
2014-07-28T20:29:58.615+0300 [initandlisten] shutdown: final commit...
2014-07-28T20:29:58.615+0300 [initandlisten] shutdown: closing all files...
2014-07-28T20:29:58.615+0300 [initandlisten] closeAllFiles() finished
2014-07-28T20:29:58.615+0300 [initandlisten] dbexit: really exiting now
Could you please tell me if there's any way around that lock? And no, there weren't any other mongod instances running.
Solution: File locking was being disabled by cluster admins. After file locking was enabled, mongod started and accepted connections as it should.