0

I cannot run mongod in my ubuntu machine. I read some blogs and stackoverflow threads suggesting to change the ownership of the /var/lib/mongodb and /var/log/mongodb folders by,

sudo chown -R mongodb:mongodb /var/lib/mongodb
sudo chown -R mongodb:mongodb /var/log/mongodb

but I still cant run mongod and getting the following error message.

vinayak@vinayak-Lenovo-G500:~$ mongod
2016-03-04T09:31:29.942+0530 I CONTROL  [initandlisten] MongoDB starting : pid=3211 port=27017 dbpath=/data/db 64-bit host=vinayak-Lenovo-G500
2016-03-04T09:31:29.942+0530 I CONTROL  [initandlisten] db version v3.2.3
2016-03-04T09:31:29.942+0530 I CONTROL  [initandlisten] git version: b326ba837cf6f49d65c2f85e1b70f6f31ece7937
2016-03-04T09:31:29.942+0530 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1f 6 Jan 2014
2016-03-04T09:31:29.942+0530 I CONTROL  [initandlisten] allocator: tcmalloc
2016-03-04T09:31:29.942+0530 I CONTROL  [initandlisten] modules: none
2016-03-04T09:31:29.942+0530 I CONTROL  [initandlisten] build environment:
2016-03-04T09:31:29.942+0530 I CONTROL  [initandlisten]     distmod: ubuntu1404
2016-03-04T09:31:29.942+0530 I CONTROL  [initandlisten]     distarch: x86_64
2016-03-04T09:31:29.942+0530 I CONTROL  [initandlisten]     target_arch: x86_64
2016-03-04T09:31:29.942+0530 I CONTROL  [initandlisten] options: {}
2016-03-04T09:31:29.968+0530 E NETWORK  [initandlisten] listen(): bind() failed errno:98 Address already in use for socket: 0.0.0.0:27017
2016-03-04T09:31:29.968+0530 E NETWORK  [initandlisten]   addr already in use
2016-03-04T09:31:29.968+0530 E STORAGE  [initandlisten] Failed to set up sockets during startup.
2016-03-04T09:31:29.968+0530 I CONTROL  [initandlisten] dbexit:  rc: 48
vinayak@vinayak-Lenovo-G500:~$ 

..and I don't think so, my mongodb is corrupted as it is fresh install and I haven't tweaked anything in it.

Please suggest any solution. Thank you.

Community
  • 1
  • 1
Vinay
  • 548
  • 2
  • 12
  • 1
    Possible duplicate of [unable to start mongodb local server](http://stackoverflow.com/questions/6478113/unable-to-start-mongodb-local-server) – Blakes Seven Mar 04 '16 at 04:42

2 Answers2

1

By your stack trace Error " Address already in use for socket: 0.0.0.0:27017" You can try running on a different port e.g mongod --port 12345

Somil
  • 567
  • 5
  • 13
0

Write following thing in the terminal and it would definitely work(it have worked for me in macbook).

sudo killall -15 mongod