So I've installed mongo using home brew and I've installed it through npm, so I have the JS driver.
When I run mongo in command line though, I get this -
MongoDB shell version: 2.2.2
connecting to: test
Thu Jan 24 02:38:26 Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
exception: connect failed
why is that happening?
After you've installed MongoDB, open a terminal window and go to the file path where your MongoDB application is stored e.g c:\MongoDB. Then type mongod and hit enter. This should start this process running. Mongod is the database server that you then access via the mongo shell.
After mongod is running, open a new terminal window and type mongo then hit enter. You should now be up and running. You can test that it's working by typing the following into the mongo shell as an example:
>
>db.names.save({'name':"James"})
>db.names.find()
This should then return the document you have just saved to the database as shown in the example below.
>{"_id" ObjectID:"764tdf763dyf6337fd376","name":"James"}
Read through the documentation and look for tutorials online. 10gen have just started an excellent online course. It's free and started this week so you might still be able to register.
Related
so I was trying to learn Meteor.js. I installed Chocolaty on my windows 8.1 machine, and with the command choco install meteor, I was able to successfully install meteor using Windows Powershell.
I created a new meteor project using the command meteor create demo and started the project using meteor command. Here's where I get Mongo server error, which says-
Unexpected mongo exit code 3221225781. Restarting.
Can't start Mongo server.
The server never starts and the process exits.
I tried uninstalling meteor and reinstalling with the same command as I mentioned above, but I am still facing the same error.
Please help.
I am trying to access Mongodb in the virtualbox hosted Ubuntu. When I am developing app in Ubuntu, I used "meteor create {app_name}"
I didnt change the default Mongodb. So when I am running Meteor app using "meteor" command, I cant access the mongodb.
In my Robomongo app in Windows, I am using this credentials,
"192.168.1.13:3001" as host and port. But It says "failed to connect".
What Do i need to do to connect to my mongodb?
Hey After doing some digging I find out the solution.
steps you need to follow:
Go to the following path cd /etc
There you will find a file called mongod.conf open this file with the help of
sudo vim mongod.conf
3.You will be in a file type i and find bindIp written over there.
4.now you need to change your bindIp of mongodb to 0.0.0.0
5.type ctrl +c then :wq // write and quite
6.sudo service mongod restart
7.Go to your robomongo and create connection and in address field just type your ip (192.168.1.13) // no port number is required in which you are running the code port will be default port on which mongodb runs 27017
I have found that using no bind ip in mongod.conf and adding localhost 127.0.0.1 to the hosts.conf works
I have one Meteor application running on my Ubuntu server (Digital Ocean). I use Meteor Up (MUP) to deploy and keep the app running. Everything works fine.
However, when I try to deploy a second app on the same server, something goes wrong in connecting to the MongoDB. I get a long and unreadable error message that starts "Invoking deployment process: FAILED" and then ends with
Waiting for MongoDB to initialize. (5 minutes)
connected
myapp start/running, process 25053
Waiting for 15 seconds while app is booting up
Checking is app booted or not?
myapp stop/waiting
myapp start/running, process 25114
And the app refuses to run. I have tried a number of things to fix this and will edit this post if more info is requested, but I'm not sure what's relevant. Essentially I don't understand the Error message, so I need to know what the heck is going on?
EDIT:
I want to add that my app runs fine if I go into the project folder and use the "meteor" command. Everything runs as expected. It is only when I try to deploy it for long-term production mode with MUP that I get this error.
EDIT:
I moved on to trying mupx instead of mup. This time I can't even get past the installation process, I get the following error message:
[Neal] x Installing MongoDB: FAILED
-----------------------------------STDERR-----------------------------------
Error response from daemon: no such id: mongodb
Error: failed to remove containers: [mongodb]
Error response from daemon: Cannot start container c2c538d34c15103d1d07bcc60b56a54bd3d23e50ae7a8e4f9f7831df0d77dc56: failed to create endpoint mongodb on network bridge: Error starting userland proxy: listen tcp 127.0.0.1:27017: bind: address already in use
But I don't understand why! Mongod is clearly already running on port 27017 and a second application should just add a new database to that instance, correct? I don't know what I'm missing here, why MUP can't access MongoDB.
It's tricky without your mup.json to see what's going on here. Given what you said, it looks like your 2nd app deployment tries to override/boot mongodb over the 1st one which is locked, the mongodb environment fails to boot, causing then the fail. You should tackle this different ways:
If your objective is to share your mongoDB, point the MONGO_URL from your 2nd mup.jon on your first mongodb instance. It's generally something along the 2701X ports. As it's a shared DB, changes in one database could affect the other.
meteor-up oversees the deployment of your app from a meteor-nice-to-test thing to a node+mongodb environment. You can spawn another mongod instance with :
mongod --port 2701X --dbpath /your/dbpath --fork --logpath /log/path on your DO server and then point MONGO_URL there.
Last but not least, mupx having docker under the hood. Using mupx for your deployments should isolate both apps from each other.
i just finished installing my all-new debian wheezy distribution. I would like to install the meteor framework, so I did:
sudo curl https://install.meteor.com/ | sh
as recommended by the official meteor website, but during the installation I get this error when I type meteor after creating a new meteor project:
=> Started proxy.
Unexpected mongo exit code 1. Restarting.
Unexpected mongo exit code 1. Restarting.
Unexpected mongo exit code 1. Restarting.
Can't start Mongo server.
MongoDB failed global initialization
Looks like MongoDB doesn't understand your locale settings. See
https://github.com/meteor/meteor/issues/4019 for more details
In fact, once a new project is created and operational after coding, the meteor command run a localhost web server on port 3000 and then we can see the web application.
I don't understand why I get this error. Is it possible that my problems are coming from my debian distribution?
Do: $: LC_ALL=<your language>
where is the system language. Like de_DE.UTF-8 or en_US.UTF-8
in console:
export PORT=3000
export MONGO_URL=mongodb://127.0.0.1:27017/meteor
export ROOT_URL=http://localhost:3000
export HTTP_FORWARDED_COUNT=1
After downloading, extracting, creating the data/db folder and cd-ing into where I extracted mongoDB, I tried running this command, as directed by the official mongoDB install instructions: .bin/mongo/ but I keep getting this error:
Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:91
I can't find a concise explanation on the internet, though it seems to be a common problem, and the mongoDB docs aren't clear either. Can anyone help me out?
Start the server before trying to connect with a client:
mongod
Or if you want to specifically point it at a db location, and log to a log file:
mongod --logpath /data/log/mongo.log --dbpath /data/db
Or something of this nature. This command will run the server in a foreground process. You can use --fork to daemonize it.