Reputation: 51
When I try to access mongod
through http://127.0.0.1:27017/
, I get this error:
It looks like you are trying to access MongoDB over HTTP on the native driver port.
Also, when I try to run mongod
, I get these errors:
Space-O-Mac-Pro:~ cyberspacer$ mongod
2015-09-10T22:12:36.741+0200 E NETWORK [initandlisten] listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017
2015-09-10T22:12:36.741+0200 E NETWORK [initandlisten] addr already in use
2015-09-10T22:12:36.770+0200 W - [initandlisten] Detected unclean shutdown - /data/db/mongod.lock is not empty.
2015-09-10T22:12:36.816+0200 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
2015-09-10T22:12:36.816+0200 I CONTROL [initandlisten] dbexit: rc: 100
Space-O-Mac-Pro:~ cyberspacer$
How do I fix these errors? Do I have to change the URL that mongod
is listening on, 0.0.0.0:27017
, to fix this error: [initandlisten] listen(): bind() failed errno:48 Address already in use for socket: 0.0.0.0:27017
?
Upvotes: 2
Views: 6712
Reputation: 707
try 28017 as port number from a browser to access it if your mongo instance is running on 27017 port number.
Add 1000 to mongod port.
Upvotes: 0
Reputation: 20703
The mongod port isn't meant to be accessed via http. That would be very much like trying to browse the web with a mail client.
You are supposed to access MongoDB via the mongo shell or a client driver.
As for your other problem: it seems like there already is a mongod instance running. For restarting the mongod, do the following
sudo killall mongod && mongod
Upvotes: 2
Reputation: 7021
When you try localhost:27017 on your browser what does it respond ?
Because what you got is like the port is already in use by another process !!
You can force Mongo to work with another port using the option --port and the problem will be resolved ....
If you want to use the default port (27017) you should find out what process is using this port and kill it (perhaps you have a mongo already running on background) ...
Hope this help!
Upvotes: 0