22
votes

I have uninstalled and reinstalled mongo (3.0.1), being sure i accepted the network access on windows 8, and yet i still have the same issue of "waiting on 27017".

The commands i sent are the following:

PS C:\Program Files\MongoDB\Server\3.0\bin> .\mongod.exe --dbpath  C:\mongodb\data
2015-04-01T21:33:46.787-0400 I JOURNAL  [initandlisten] journal dir=C:\mongodb\data\journal
2015-04-01T21:33:46.790-0400 I JOURNAL  [initandlisten] recover : no journal files present, no recovery needed
2015-04-01T21:33:46.972-0400 I JOURNAL  [durability] Durability thread started
2015-04-01T21:33:46.973-0400 I JOURNAL  [journal writer] Journal writer thread started
2015-04-01T21:33:47.134-0400 I CONTROL  [initandlisten] MongoDB starting : pid=7436 port=27017 dbpath=C:\mongodb\data 64
-bit host=CookieMunster
2015-04-01T21:33:47.135-0400 I CONTROL  [initandlisten] targetMinOS: Windows 7/Windows Server 2008 R2
2015-04-01T21:33:47.135-0400 I CONTROL  [initandlisten] db version v3.0.1
2015-04-01T21:33:47.136-0400 I CONTROL  [initandlisten] git version: 534b5a3f9d10f00cd27737fbcd951032248b5952
2015-04-01T21:33:47.137-0400 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.1j-fips 15 Oct 2014
2015-04-01T21:33:47.137-0400 I CONTROL  [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, buil
d=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
2015-04-01T21:33:47.139-0400 I CONTROL  [initandlisten] allocator: system
2015-04-01T21:33:47.141-0400 I CONTROL  [initandlisten] options: { storage: { dbPath: "C:\mongodb\data" } }
2015-04-01T21:33:47.148-0400 I INDEX    [initandlisten] allocating new ns file C:\mongodb\data\local.ns, filling with ze
roes...
2015-04-01T21:33:47.587-0400 I STORAGE  [FileAllocator] allocating new datafile C:\mongodb\data\local.0, filling with ze
roes...
2015-04-01T21:33:47.589-0400 I STORAGE  [FileAllocator] creating directory C:\mongodb\data\_tmp
2015-04-01T21:33:47.721-0400 I STORAGE  [FileAllocator] done allocating datafile C:\mongodb\data\local.0, size: 64MB,  t
ook 0.007 secs
2015-04-01T21:33:47.747-0400 I NETWORK  [initandlisten] waiting for connections on port 27017

This is pending and will continue to do see endlessly.

Hitting my head against a wall and any help is wonderful.

Thanks

9
Waiting on 27017 or 28017 ? Please check you question once. - Dev
@dev thanks, corrected. all are 27017. - jason m

9 Answers

50
votes

The waiting for connections message in the console output indicates that the mongod.exe process is running successfully.

http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/?_ga=1.82566930.525730850.1428016333

Next you need to connect to MongoDB through mongo.exe shell using another command promt.

As soon as you are done with that, the waiting message in first console would change to connection accepted.

Hope that helps :)

17
votes

For Mac users, if you have same issue then go open a new terminal window apart from the one already open and waiting for connection, go to /usr/local/bin and type ./mongo

1
votes

Later, to stop MongoDB, press Ctrl + C in the terminal where the mongod instance is running.

1
votes

I have a similar problem.

In my case when I ran MongoDb on docker with the following command and expected entering mongo shell to do some query but I got meesage 'waiting for connections on port 27017' and couldn't do anything.

docker run -p 27017:27017 --name mongo-container mongo 

It seems that I was supposed to launch MongoDb on the background with -d option first and then use docker exec to enter the shell

docker run -p 27017:27017 --name mongo-container mongo -d
docker exec -it mongo-container mongo admin
1
votes

If You are windows go to your root folder C:\Program Files\mongodb\Server\4.0\bin...open cmd as a Administration open cmd then type mongo start your mongodb server.

1
votes
  1. open the control panel search for MongoDB file
  2. Right click on it and select repair option

  3. and click ok for all the options that show

0
votes

It is clearly mentioned in above message that mongoDB is starting.

 2015-04-01T21:33:47.134-0400 I CONTROL  [initandlisten] MongoDB starting : pid=7436 port=27017 dbpath=C:\mongodb\data 64
    -bit host=CookieMunster

If you want to connect to the mongoDB shell, open a new cmd window and write command:

mongo.exe
0
votes

You Keep your first screen(which you are facing issue) open as it is. Now open one more screen and go inside mongodb folder. now execute ./bin/mongod. and you can its connected as below .

2016-11-04T13:44:02.414+0800 I NETWORK  [initandlisten] waiting for connections on port 27017
2016-11-04T13:50:26.990+0800 I NETWORK  [initandlisten] connection accepted from 127.0.0.1:51541 #1 (1 connection now open)
0
votes

It seems your mondodb local server is running. You need to install tool like robo 3T and connect to localhost://27017 to connect to local mongodb.