mongodb- connecting to test hanging and mongo shell not starting
Asked Answered
M

1

6

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?

Marcmarcano answered 11/11, 2013 at 17:36 Comment(6)
MongoDB doesn't require or use Cygwin. Could you repeat the steps in a normal command prompt?Senescent
(And are you really using MongoDB 2.2 rather than 2.4+?)Senescent
I tried using command prompt and it works. Before upgrading to windows7, I used cygwin to access mongodb on vista and it worked fine. I just tested on windows server 2008 R2 and it worked fine using cygwin. Is this problem with windows 7 only?Marcmarcano
Just use a normal Windows command prompt. Or, just start it from Windows explorer.Senescent
I am having this problem too, but it's not locked up. If you type "show collections" it will actually show the collections. The problem is just that the command prompt is not appearing for some reason.Potentiometer
I am having the exact same problem have you found fix for this issue ?Houseman
M
5

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.

Metamorphose answered 11/11, 2013 at 19:7 Comment(2)
For me it says mangod command not found but its working when i type in cmd prompt. Could you please tell me what could be the issue ?Tohubohu
@Tohubohu It is mongod with an o (not a) after m.Coletta

© 2022 - 2024 — McMap. All rights reserved.