Mongodb service not running - mongodb

I'm working on this automatic drink dispenser and ran into an issue when I downloaded the Mongo 3.0.7 I tried to run it but I keep getting this error:
I got the idea from this website. http://yujiangtham.com/2014/05/30/build-your-very-own-drink-mixing-robot-part-2/
2016-02-02T15:56:42.585-0500 E NETWORK [initandlisten] listen():
bind() failed errno:48 Address already in use for socket:
0.0.0.0:27017
2016-02-02T15:56:42.585-0500 E NETWORK [initandlisten] addr already
in use 2016-02-02T15:56:42.593-0500 W - [initandlisten]
Detected unclean shutdown - /data/db/mongod.lock is not empty.
2016-02-02T15:56:42.593-0500 I STORAGE [initandlisten] exception in
initAndListen: 98 Unable to lock file: /data/db/mongod.lock errno:35
Resource temporarily unavailable. Is a mongod instance already
running?, terminating
2016-02-02T15:56:42.593-0500 I CONTROL [initandlisten] dbexit: rc:
100
I need help on how to run this. The website I'm using as a reference is
http://yujiangtham.com/2014/05/30/build-your-very-own-drink-mixing-robot-part-2/

It is stating that Mongo is already running. If you are certain it is not, then the lock file still exists from a previous unclean shutdown.
ps aux | grep mongo
if that returns nothing, it will mean the lock file still exists. looking at your error, the file is /data/db/mongod.lock
rm /data/db/mongod.lock
Should get rid of it so you'll be able to start the mongo service running again.

Try running pkill mongod to kill the process

Related

Mongod Error: 98 Unable to lock file: /data/db/mongod.lock Resource temporarily unavailable. Is a mongod instance already running?

2017-06-12T13:06:18.407+0300 I STORAGE [initandlisten]
exception in initAndListen: 98 Unable to lock file: /data/db/mongod.lock Resource temporarily unavailable. Is a mongod instance already running?, terminating
2017-06-12T13:06:18.407+0300 I NETWORK [initandlisten]
shutdown: going to close listening sockets...
2017-06-12T13:06:18.407+0300 I NETWORK [initandlisten]
shutdown: going to flush diaglog...
2017-06-12T13:06:18.407+0300 I CONTROL [initandlisten]
now exiting
2017-06-12T13:06:18.407+0300 I CONTROL [initandlisten]
shutting down with code:100
The error clearly says
exception in initAndListen: 98 Unable to lock file:
/data/db/mongod.lock Resource temporarily unavailable. Is a mongod
instance already running?, terminating
An instance of mongod is already running and it held a lock on mongod.lock file. Run ps -eaf | grep mongod to find the running instance. If running, kill the process sudo kill <pID> obtained from above grep command.
Then delete the mongod.lock file as mongod wasn't shutdown gracefully. Post deleting the lock file start the mongod process sudo mongod.
Hope this helps!

MongoDB learning issue

Greetings I am learning mongodb and have encountered with following issue. I am pretty newbie in all of that and dived to into meanstack development after spending some hours messing with setups, I decided to spend some time learning first before doing something and found great corse of mongodb on their official website, following their lessons I cant start mongo server as it says I have already started it somewhere... :)
Error message:
2015-10-13T21:55:01.900+0200 E NETWORK [initandlisten] listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017
2015-10-13T21:55:01.900+0200 E NETWORK [initandlisten] addr already in use
2015-10-13T21:55:01.912+0200 W - [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
2015-10-13T21:55:01.935+0200 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file: /data/db/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2015-10-13T21:55:01.935+0200 I CONTROL [initandlisten] dbexit: rc: 100
Can you please explain how can I find and remove that one or at least shut it down?
There may be already a mongodb instance running. Check it with below command.
ps -ef | grep 'mongo'
You can shutdown existing mongod instance using: http://docs.mongodb.org/master/tutorial/manage-mongodb-processes/#use-shutdown
mongod --shutdown
If no instance is running then go to the data location and remove the lock file.
cd /data/db/
sudo rm mongod.lock
Note: This is only for learning / local machine. This process might not be suitable for production.

MongoDB does not start after installing first time

I am trying to install MongoDB first time on my Windows 7 machine. I am installing it to default location (c:/).
When I execute the mongod.exe first time, I get the message 'the waiting for connections message in the console'. The documentation of MongoDB asks to connect on another cmd prompt and execute mongod.exe again.
When I do this I get the following message:
C:\Program Files\MongoDB\Server\3.0\bin>mongod.exe
2015-09-04T11:31:23.880+0530 I CONTROL Hotfix KB2731284 or later update is not installed, will zero-out data files
2015-09-04T11:31:23.905+0530 W - [initandlisten] Detected unclean shutdown - C:\data\db\mongod.lock is not empty.
2015-09-04T11:31:23.907+0530 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file:
C:\data\db\mongod.lock errno:32 The process cannot access the file because it is being used by another process.. Is a mo
ngod instance already running?, terminating
2015-09-04T11:31:23.907+0530 I CONTROL [initandlisten] dbexit: rc: 100
C:\Program Files\MongoDB\Server\3.0\bin>mongod.exe
2015-09-04T11:33:52.437+0530 I CONTROL Hotfix KB2731284 or later update is not installed, will zero-out data files
2015-09-04T11:33:52.442+0530 W - [initandlisten] Detected unclean shutdown - C:\data\db\mongod.lock is not empty.
2015-09-04T11:33:52.445+0530 I STORAGE [initandlisten] exception in initAndListen: 98 Unable to create/open lock file:
C:\data\db\mongod.lock errno:32 The process cannot access the file because it is being used by another process.. Is a mo
ngod instance already running?, terminating
2015-09-04T11:33:52.445+0530 I CONTROL [initandlisten] dbexit: rc: 100
P.S.: I have created /data/db in C:/.
Well, I just faced the same issue. I installed the fix, but saw nothing but same error. So that's how I got over it: just create a folder structure in your C catalog like this one: C:\data\db. So it worked for me perfectly. I use Windows 7 x64.

Mongodb not working properly : Socket already in use?

I am taking the mongodb university class and having problems getting mongod to work properly. I have been trying for hours to try to get it to work properly, but I keep getting the same error.
When I try to run mongod I am getting this error:
erics-mbp:~ emlandst$ mongod --dbpath data
2015-08-16T18:55:24.186-0400 E NETWORK [initandlisten] listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017
2015-08-16T18:55:24.186-0400 E NETWORK [initandlisten] addr already in use
2015-08-16T18:55:24.186-0400 I STORAGE [initandlisten] exception in initAndListen: 29 Data directory data not found., terminating
2015-08-16T18:55:24.186-0400 I CONTROL [initandlisten] dbexit: rc: 100
If I am correct the server is set to run on port 27017 by default and for some reason it is being blocked. I tried the ps waux | grep mongo and then I killed the instance, but still i get the same error.
I am trying to just delete everything so I can start all over, but I have no idea how to do that. I'm sure it is simple I just don't have a lot of experience. Thank you

Mongodb wont start: addr already in use

when I try to start my database, mongodb is logging the following messages:
2014-08-12T08:42:17.522-0300 [initandlisten] journal dir=/www/mongodb/data/journal
2014-08-12T08:42:17.523-0300 [initandlisten] recover : no journal files present, no recovery needed
2014-08-12T08:42:17.564-0300 [initandlisten] ERROR: listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2014-08-12T08:42:17.564-0300 [initandlisten] ERROR: addr already in use
2014-08-12T08:42:17.567-0300 [initandlisten] now exiting
2014-08-12T08:42:17.567-0300 [initandlisten] dbexit:
2014-08-12T08:42:17.567-0300 [initandlisten] shutdown: going to close listening sockets...
And it wont start.
But then I run the next command nothing is returned:
sudo netstat -ltnp | grep 27017
The server was manually shutdown (db.shutdownServer()) and it is a part of a replica set.
I noticed that the mongod.lock is created in the process, but removing it doesnt solve the problem.
So i guess the error message isnt quite right.
I'm using MongoDB shell version: 2.6.1
Anyone knows what could be the problem?
I had same issue.
In my config file in bindIp I had 2 ports specified, and for some reason mongo tried to run both of them simultaneously.
Leave only one and make sure it is in etc/hosts.