Dont understand, how to run MongoDB in my workspace



I do all that is written in the instructions on c9 community, but i see error
MongoDB shell version: 2.6.12
connecting to: test
2016-08-26T07:21:04.853+0000 warning: Failed to connect to, reason: errno:111 Connection refused
2016-08-26T07:21:04.853+0000 Error: couldn’t connect to server (, connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
what am I doing wrong


@ugozhaev did you find this article? Setting Up MongoDB

It appears that you have mongodb installed, but you did not take the steps to start mongod as indicated in that post.


I did all steps in that topic, and result is what i wrote.


@ugozhaev So, you created the mongod script, and you ran the script, you need to leave the mongo server running in one terminal window and then run the mongo client in another terminal window.

The mongod server should tell you that it is listening on the IP/port. Are you seeing this?


ugozhaev:~/workspace $ ./mongod
2016-08-27T13:31:44.153+0000 ** WARNING: --rest is specified without --httpinterface,
2016-08-27T13:31:44.154+0000 ** enabling http interface
warning: bind_ip of is unnecessary; listens on all ips by default
2016-08-27T13:31:44.164+0000 [initandlisten] MongoDB starting : pid=2933 port=27017 dbpath=data 64-bit host=ugozhaev-myfirstproject-3233110
2016-08-27T13:31:44.165+0000 [initandlisten] db version v2.6.12
2016-08-27T13:31:44.165+0000 [initandlisten] git version: d73c92b1c85703828b55c2916a5dd4ad46535f6a
2016-08-27T13:31:44.165+0000 [initandlisten] build info: Linux 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
2016-08-27T13:31:44.165+0000 [initandlisten] allocator: tcmalloc
2016-08-27T13:31:44.165+0000 [initandlisten] options: { net: { bindIp: “”, http: { RESTInterfaceEnabled: true, enabled: true } }, storage: { dbPath: “data”, journal: { enabled: false } } }
2016-08-27T13:31:44.177+0000 [initandlisten] exception in initAndListen: 10309 Unable to create/open lock file: data/mongod.lock errno:13 Permission denied Is a mongod instance already running?, terminating
2016-08-27T13:31:44.177+0000 [initandlisten] dbexit:
2016-08-27T13:31:44.177+0000 [initandlisten] shutdown: going to close listening sockets…
2016-08-27T13:31:44.177+0000 [initandlisten] shutdown: going to flush diaglog…
2016-08-27T13:31:44.177+0000 [initandlisten] shutdown: going to close sockets…
2016-08-27T13:31:44.177+0000 [initandlisten] shutdown: waiting for fs preallocator…
2016-08-27T13:31:44.177+0000 [initandlisten] shutdown: closing all files…
2016-08-27T13:31:44.177+0000 [initandlisten] closeAllFiles() finished
2016-08-27T13:31:44.177+0000 [initandlisten] shutdown: removing fs lock…
2016-08-27T13:31:44.177+0000 [initandlisten] couldn’t remove fs lock errno:9 Bad file descriptor
2016-08-27T13:31:44.177+0000 [initandlisten] dbexit: really exiting now
i ran the script and see this


We can see here that mongod is having some difficulty accessing files.

First comment, I would recommend creating the data directory for mongod in a location other than your workspace folder, which might accidentally get committed into a git repo.

So, create your data folder in your home folder ~ and run the mongod script you created from your home folder as well.


go here bro :slight_smile:


Thank you, it works.
ugozhaev:~ $ mongo
MongoDB shell version: 2.6.12
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type “help”.
For more comprehensive documentation, see
Questions? Try the support group
Server has startup warnings:
2016-08-27T16:32:48.237+0000 ** WARNING: --rest is specified without --httpinterface,
2016-08-27T16:32:48.237+0000 ** enabling http interface
so, what driver i have use with PHP in c9?


@ugozhaev Great, glad it’s working for you. Not a PHP person myself, I’d recommend creating a new topic if you can’t find what you’re looking for on google or by searching the forum.


Need I use script every time, i launch workspace?


Yes, you’ll need to make sure to start mongod each time.


Is there a way to automate this process?