Question

I'm trying to setup mongodb on my nitrousio nodejs box. Following this tutorial.

When I finish executing this command,

mongo --shell --host $MONGODB_DEVELOPMENT_HOST --port $MONGODB_DEVELOPMENT_PORT 
-u $MONGODB_DEVELOPMENT_USERNAME -p $MONGODB_DEVELOPMENT_PASSWORD 
$MONGODB_DEVELOPMENT_DB

This happens,

enter image description here

Even though my MONGO_DEVELOPMENT_DB environment variable is set to pest, it tries to connect to test. Not only pest, if I try to connect to any of my DB instances, it always tries to connect to test.

Any idea as to what could be going wrong?

Was it helpful?

Solution 2

Ok, terminated the box and created a new one, that fixed it. Guess I messed up the env. variables in my first attempt. Works just fine now.

OTHER TIPS

I had something similar recently and it turned our that the config file was overriding some of the parameters. Try to look at /usr/local/mongodb/mongod.conf (on OS X, probably similar on linux)

I had the same problem and I've tried with new boxes(minimum memory and storage) but it didn't work out. After increasing memory and storage on existing box to maximum I could (Memory: 640MB and Storage: 1500MB) I was able to start MongoDB server and Mongo shell.

After starting the mongo shell your session will use the test database by default. For mong details, please refer to MongoDB Doc

I'm not sure if this will give you everything you need but at least I can ensure the mongo command interface works on Nitrous for me. Firstly a bit of background.

The helpful support guy at Nitrous told me that Nitrous only expose ports: 1024 - 10,000 open. The default for mongodb is: 27017. This port seems to be hand coded into the mongo command as well.

On Nitrous, I changed my mongodb.config file to use a port within that range, on the 0.0.0.0 address:

  • ~/.parts/etc/mongodb.conf
    • bind_ip = 0.0.0.0
    • port = 7017

See:

Apparently the bind to 0.0.0.0 IP address is not necessary due to Nitrous magic, however I haven't tested that. After re-starting mongodb server:

$ parts stop  mongodb
$ # ... edit ~/.parts/etc/mongodb.conf
$ parts start mongodb
$ mongo localhost:7017

Anyway that works for the default database. I expect other (valid, reasonable) command line options should be OK. The 'test' db name is the default, so if you never make a connection it mongodb probably won't even look at the DB Name given.

I am experimenting with the MEAN.io stack on Nitrous, so the config will be a quite different to your example. That said, this command works fine:

$ mongo localhost:7017/mean-dev 

To open the mean-dev database. Hopefully setting the port will give you what is needed.

One last thing the mongodb control interface for that port is on the nitrous preview URL with port number +1,000 ==> 8017. I have not discovered how to make the REST API work with the admin interface (yet). Even so, the admin screen shows me that things are looking reasonable.

Good luck /w.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top