Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mongodb- connecting to test hanging and mongo shell not starting

I'm trying to run mongodb (2.2.6 shell) on newly installed windows7 OS and cygwin.

-I downloaded 2.2.6 version from mongodb website, unzipped it in C: and created folder C:\data\db with write permissions. Now, I start cygwin and CD'ed to bin folder and run ./mongod.exe, everything goes fine and log says its waiting for connections on 27017

$ ./mongod.exe
C:\mongodb-win32-x86_64-2008plus-2.2.6\bin\mongod.exe --help for help and startup options
Mon Nov 11 16:50:32 [initandlisten] MongoDB starting : pid=3748 port=27017 dbpath=\data\db\ 64-bit host=E7F0921C5EBD33
Mon Nov 11 16:50:32 [initandlisten] db version v2.2.6, pdfile version 4.5
Mon Nov 11 16:50:32 [initandlisten] git version: d626379119a6de9f2fb390780cf2fc336dfd540d
Mon Nov 11 16:50:32 [initandlisten] build info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
Mon Nov 11 16:50:32 [initandlisten] options: {}
Mon Nov 11 16:50:32 [initandlisten] journal dir=/data/db/journal
Mon Nov 11 16:50:32 [initandlisten] recover begin
Mon Nov 11 16:50:32 [initandlisten] info no lsn file in journal/ directory
Mon Nov 11 16:50:32 [initandlisten] recover lsn: 0
Mon Nov 11 16:50:32 [initandlisten] recover /data/db/journal/j._0
Mon Nov 11 16:50:32 [initandlisten] recover cleaning up
Mon Nov 11 16:50:32 [initandlisten] removeJournalFiles
Mon Nov 11 16:50:32 [initandlisten] recover done
Mon Nov 11 16:50:32 [initandlisten] waiting for connections on port 27017
Mon Nov 11 16:50:32 [websvr] admin web console waiting for connections on port 28017

I now open another cygwin window and cd to bin folder and run ./mongo to start monogodb shell. The mongod log shows that it received a request and connection is open

Mon Nov 11 16:50:55 [initandlisten] connection accepted from 127.0.0.1:53143 #1 (1 connection now open)

But mongodb shell window hangs while connecting to test db and shell prompt dosent appear.

$ ./mongo
MongoDB shell version: 2.2.6
connecting to: test

I checked below and processes are running, port is open too.

$  ps -ef | grep mongo
 user     860    5556 pty0     10:50:32 /cygdrive/c/mongodb-win32-x86_64-2008                             plus-2.2.6/bin/mongod
 user    6500    5680 pty1     10:50:55 /cygdrive/c/mongodb-win32-x86_64-2008                             plus-2.2.6/bin/mongo


$ netstat -ano | findstr 27017
  TCP    0.0.0.0:27017          0.0.0.0:0              LISTENING       3748
  TCP    127.0.0.1:27017        127.0.0.1:53143        ESTABLISHED     3748
  TCP    127.0.0.1:53143        127.0.0.1:27017        ESTABLISHED     580

I also checked http://localhost:28017/ and can see that its running.

db version v2.2.6, pdfile version 4.5
git hash: d626379119a6de9f2fb390780cf2fc336dfd540d
sys info: windows sys.getwindowsversion(major=6, minor=1, build=7601, platform=2, service_pack='Service Pack 1') BOOST_LIB_VERSION=1_49
uptime: 2153 seconds

To troubleshoot, I verified that write permissions are enabled for C:\data\db folders, deleted mongod.lock file and tried restart with repair option and it dint help, deleted all mongodb folders, restarted computer and installed fresh copy but still have same problem

Any ideas on why this is happening and how to fix it?

like image 209
rVr Avatar asked Nov 11 '13 17:11

rVr


1 Answers

MongoDB's shell is known not to work within cygwin:

https://jira.mongodb.org/browse/SERVER-4423

Please just run mongod.exe (server) and mongo.exe (shell) as normal without cygwin.

like image 174
Tyler Brock Avatar answered Sep 18 '22 17:09

Tyler Brock