title: Error connecting to mongodb on Cloud 9
body: <p>I try to connect to mongodb <a href="https://docs.c9.io/setting_up_mongodb.html" rel="nofollow">based on the instructions provided here</a>,I get this error instead:</p>
  
  <pre><code>    vamsiampolu1@takenote:~/workspace (master) $ ./mongod
  2014-11-17T09:00:10.101+0000 ** WARNING: --rest is specified without --httpinterface,
  2014-11-17T09:00:10.101+0000 **          enabling http interface
  warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default
  2014-11-17T09:00:10.106+0000 [initandlisten] MongoDB starting : pid=2274 port=27017 dbpath=data 64-bit host=vamsiampolu1-takenote-1084968
  2014-11-17T09:00:10.106+0000 [initandlisten] db version v2.6.5
  2014-11-17T09:00:10.106+0000 [initandlisten] git version: e99d4fcb4279c0279796f237aa92fe3b64560bf6
  2014-11-17T09:00:10.106+0000 [initandlisten] build info: Linux build8.nj1.10gen.cc 2.6.32-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
  2014-11-17T09:00:10.106+0000 [initandlisten] allocator: tcmalloc
  2014-11-17T09:00:10.107+0000 [initandlisten] options: { net: { bindIp: "0.0.0.0", http: { RESTInterfaceEnabled: true, enabled: true } }, storage: { dbPath: "data", journal: { enabled: false } } }
  ************** 
  Unclean shutdown detected.
  Please visit http://dochub.mongodb.org/core/repair for recovery instructions.
  *************
  2014-11-17T09:00:10.107+0000 [initandlisten] exception in initAndListen: 12596 old lock file, terminating
  2014-11-17T09:00:10.107+0000 [initandlisten] dbexit: 
  2014-11-17T09:00:10.107+0000 [initandlisten] shutdown: going to close listening sockets...
  2014-11-17T09:00:10.107+0000 [initandlisten] shutdown: going to flush diaglog...
  2014-11-17T09:00:10.107+0000 [initandlisten] shutdown: going to close sockets...
  2014-11-17T09:00:10.107+0000 [initandlisten] shutdown: waiting for fs preallocator...
  2014-11-17T09:00:10.107+0000 [initandlisten] shutdown: closing all files...
  2014-11-17T09:00:10.107+0000 [initandlisten] closeAllFiles() finished
  2014-11-17T09:00:10.107+0000 [initandlisten] dbexit: really exiting now
  </code></pre>
  
  <h1>EDIT:</h1>
  
  <p>I have tried with the <code>mongod --repair</code> flag.I have also tried to execute this script,which is what I do in case I shut my local machine down without closing <code>mongod</code> properly:</p>
  
  <pre><code>   #!/bin/sh
    sudo rm /var/lib/mongodb/mongod.lock
    sudo -u mongodb mongod -f /etc/mongodb.conf --repair
    sudo service mongodb start
  </code></pre>
  
  <p>It says that the file <code>/var/lib/mongodb/mongod.lock</code> was not found.I have tried to start <code>mongodb</code> as a service:</p>
  
  <pre><code>  sudo service mongod start
  </code></pre>
  
  <p>wherein,it asks me to use <code>mongod start</code> which also fails with the same message.I have read about <code>net.http.enabled</code> which should be left switched off because it could increase network exposure.</p>
  
  <p>I used a <code>Ubuntu 12.04</code> based <code>vagrant</code> box once,so I tried with:</p>
  
  <pre><code> mongodb start
  </code></pre>
  
  <p>which tells me that <code>mongodb</code> is not a valid command.</p>
  
  <p>I have also tried <code>mongo</code> which tells me that:</p>
  
  <pre><code> vamsiampolu1@takenote:~/workspace (master) $ mongo
   MongoDB shell version: 2.6.5
   connecting to: test
   2014-11-17T11:51:44.752+0000 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111     Connection refused
   2014-11-17T11:51:44.753+0000 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1),   connection attempt failed at src/mongo/shell/mongo.js:146
   exception: connect failed
  </code></pre>
  
  <p>I believed that I might have mistakenly closed the terminal window running <code>mongod</code> and thus am unable to start it.But it wont let me do what I usually do and continue working.</p>
  
  <p>I have also tried to run this to find if <code>mongod</code> was already running:</p>
  
  <pre><code>  vamsiampolu1@takenote:~/workspace (master) $ ps ax | grep mongod
    2504 pts/2    S+     0:00 grep --color=auto mongod 
  </code></pre>
  
  <p>I tried to stop it from running using the following:</p>
  
  <pre><code>   stop mongod
  </code></pre>
  
  <p>Then I ran that again to find if mongod was still running:</p>
  
  <pre><code>   vamsiampolu1@takenote:~/workspace (master) $ ps ax | grep mongod
     2524 pts/2    S+     0:00 grep --color=auto mongod
  </code></pre>
  
  <p>When I tried to run this:</p>
  
  <pre><code>      vamsiampolu1@takenote:~/workspace (master) $ mongod --shutdown
        There doesn't seem to be a server running with dbpath: /data/db
  </code></pre>
  
  <p>When I tried to set the <code>dbpath</code> manually:</p>
  
  <pre><code>  vamsiampolu1@takenote:~/workspace (master) $ ./mongod --dbpath /data/db
    Error parsing command line:  Multiple occurrences of option "--dbpath"
  </code></pre>