Connecting to Meteor Mongo from GUI - mongodb

How do I connect to my Meteor Mongo instance from a GUI, e.g. MongoChef (I am on Windows running an Ubuntu Virtual Machine which has the Meteor application on it)?
I have tried connecting using the IP address of my running Virtual Box, with both port 3001 and 27017 with no joy - should I be setting up some port forwarding or something?

This applies to an out-of-the-box install of Mongo when Meteor is installed:
The mongo daemon mongod binds to 127.0.0.1 so you need to connect to it via a SSH tunnel if your client supports it. MongoVUE and Mongo Chef both allow this type of connection. Once you SSH into the VM, you can connect to 127.0.0.1:3001 without any trouble. It does not require a password or username, just the database to be set as meteor.

Related

How to connect VPS to MongoDB Compass

I bought a VPS and I want to put MongoDB server there. I connect to VPS with ssh tunnel, install MongoDB and start it.
The question is, that how can I add VPS server to MongoDB Compass? Is it even possible?
I was trying to connect via hostname but I receive this error - connect ECONNREFUSED my.ip.adress.here
Also was trying to connect via ssh tunnel in MongoDB Compass - doesn't work for me.
Maybe there is a problem with port?
I can connect to my VPS from terminal with ssh.
Edit1:
I was using this documentation to install MongoDB on ubuntu and I'm using MongoDB 4.2.8
EDIT2: When I install mongodb on VPS, MongoDB ip is 127.0.0.1 how can I change it? I want it to set it for VPS ip address. If it's possible, otherwise I don't understand how I can connect to my DB on VPS.
Sorry if it's lame questions, just first time using VPS and it's pretty complex to me.
Before you can connect to vps with mongodb compass, you need to allow remote connections to mongodb from your vps.
It is recommended to secure your mongodb connection with a username and password
Edit the mongod.conf file located at
sudo nano /etc/mongod.conf
Enter a comma and append the IP address of the vps to the end of the bindIp field. This will allow remote connections to the mongodb instance
Save the file and restart the mongodb connection
sudo systemctl restart mongod
Setup the firewall to allow connections to port 27017 (the default mongodb port) from anywhere. (Please note that will expose your mongo database to the internet. Therefore it is recommended to close this port when shipping to production)
sudo ufw allow 27017
That's it for the vps.
You can now open up mongodb compass
Choose "fill in connection fields individually"
Fill in the hostname with the IP address of your vps, port is the port which you opened previously 27017 in this case and select authentication by username and password.
Enter the username and password of the mongodb admin which you should have created already.
Choose the authentication database (usually admin)
That's it. You should be connected. You can now view the collections and fields of your mongodb instance on your remote machine

Connect mongodb server via robomongo from another PC

I am using mongodb database for my meteor app. I want to access it from another pc. I have mounted my local as a virtual drive on other PC using ssh. Now I want to connect to mongodb via robomongo. I have given the address as 192.168.1.2:4001 (ip addr of local : port on which meteor is running +1). But its giving an error 'Unable to connect to mongodb'. How to proceed?
The other way around is to start your meteor on a regular mongo server with this command :
MONGO_URL=mongodb://localhost:27017/nameOfDatabase meteor
Be sure to have a running mongo on localhost and to change the nameOfDatabase.
Now it's just a regular mongoDB server to connect. Also you might need to add login and password to that mongo url and the debug parameter after meteor if you use packages like meteor toys.
Please check mongodb's config file /etc/mongod.conf and comment out bind ip
net:
#bindIp: 127.0.0.1
port: 4001
Restart mongodb service. This will allow mongodb to bind to ip's other than localhost.

JDBC connection to mongodb running on Meteor server on Cloud 9

I have a Meteor app running on Cloud 9 and I would like to connect to MongoDB from a window app that I am in trial period (DBSCHEMA: http://www.dbschema.com/).
Cloud 9 guys told me that I need my DB to listen to 0.0.0.0:8082.
In cloud9 I started my app using command: $ meteor --port $IP:$PORT.
I also created a db and user that has role "userAdmin" to this database.
In another terminal, at c9, "Meteor mongo" command give me connecting to: 127.0.0.1:8081/meteor
In DBSchema ping to the server is succesfull, but connection is refused.
So, I am trying to change to 0.0.0.0:8082 but I cant figure out how and not sure its going to work.
Any suggestions please?
use environment variable MONGO_URL=your-mongo-server-ip-or-hostname:8082 in meteor and start mongo with port 8082 on 0.0.0.0 with the config file
http://docs.mongodb.org/manual/reference/configuration-options/
Ideally, you should not expose you dB to the outside (so not bind to 0.0.0.0 which exposes the DB on all interfaces including the public IP).
If you want to access it with Robomongo, bind to localhost, and then you should create a ssh tunnel to the server from you local terminal with the command
ssh -L 8082:localhost:8082 your-host
then connect to it with robomongo at localhost:8082 –

Cannot connect to mongod running in Ubuntu machine

I would like to connect with mongo from a cmd shell in windows to a mongod database running in a Ubuntu virtual machine.
mongo is running fine in the Ubuntu terminal and from a putty shell
When I use mongo from a windows cmd shell, I got this error:
mongo.exe --host 192.168.1.6 --port 27017
MongoDB shell version: 2.4.6
connecting to: 192.168.1.6:27017/test
Sat Feb 01 14:45:32.181 Error: couldn't connect to server 192.168.1.6:27017 at src/mongo/shell/mongo.js:147
exception: connect failed
What should I do to be able to connect?
My goal is to use MongoVue to connect to the mongod database in the Ubuntu machine (by the way, MongoVue is not connecting even using its SSH options).
I am trying to connect to the mongod instance of a meteorjs application.
The meteor application is up and running and I can connect to the mongod instance running on the Ubuntu machine at port 3002, both in the Ubuntu terminal and with a putty shell.
stefano#MeteorDeploy:~$ mongo --port 3002
MongoDB shell version: 2.0.4
connecting to: 127.0.0.1:3002/test
PRIMARY> show dbs
local 0.0625GB
meteor 0.0625GB
I would like to connect to the mongod instance using MongoVue as alternative of the putty shell.
I did as in the docs.mongodb.org/manual/tutorial/configure-linux-iptables-firewall/ but without success.
Meteor runs it's own instance of mongo per app. As you note since your edit, when you ssh into your VM you use --port 3002 to connect.
Now you could add that port to your mongo shell launch except for one problem
ps -ef | grep mongo
on your VM will show you the running instance of mongo along with it's startup options. By default this will be bound to 127.0.0.1 which is the loopback adaptor and not accessible outside of the VM.
So what you need to do is either change the startup options in your project, or use another instance on mongo installed on the local machine.
export MONGO_URL=mongodb://localhost:27017/your_db
By default mongod insllation on Ubuntu only listen to localhost, so you can't connect from Windows.
Edit /etc/mongodb.conf and change the bind_ip line (add your windows IP adress on the local network) so it will accept connection.
Be aware that by default mongod does not require authentification so you would maybe want to settup one.
Doc is here :
http://docs.mongodb.org/manual/reference/configuration-options/#bind_ip
For quick and dirty solution (not for Production):
Edit /etc/mongodb.conf and change the bind_ip to 0.0.0.0

MongoDB is not installed properly on Ubuntu 11.04 in Amazon EC2

I'm trying to install MongoDB on my Ubuntu 11.04 AMI in Amazon EC2.
I allowed 27017 port in security option.
The problem is that I can use "mongo OTHER IP ADDRESS" to access to other mongoDB.
But simply "mongo" does not simply give me access to localhost mongoDB.
mongoDB shell shows like it is about to work but it stops at
MongoDB shell version: 1.8.3
connecting to: test
If it is truly connected, it should give me ">" but it doesn't and freezes.
I couldn't find answer on freezing problem by googling myself.
Also any tips on running mongoDB as daemon or running in background?
Be sure to use 0.0.0.0 as the IP in the security group. This will include your public IP and localhost IP. If this is not the issue, try this for debugging.
See what interface or IP range mongo is listening on:
netstat -pan | grep mongod
I imagine that it's listening on your public IP address (OTHER IP ADDRESS as you call it). If this is the case, try starting mongod without bind_ip. If you didn't specify the bind_ip argument then it's probably something related to EC2.
Another test:
Try telnet localhost 27017 (hit Ctrl-], type quit to quit). This should also fail because this is the same thing the mongo client is doing.