SyedAsadRazaDevops / how-to-Connect-MongoDB-compass-to-your-linux-cloud-server-instance-using-SSH

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What You’ll Need

If you are using MongoDB in the Cloud (Atlas) Or if you plan on using a local instance of MongoDB, you will need to:

Install MongoDB and start up an instance to which you will connect.

Install your client

To install Compass, see the Compass installation instructions

Obtain your MongoDB connection

In order to connect to MongoDB, you will need a URI string. A URI (Uniform Resource Identifier) is similar to a URL.

in my case i use the server ip, where i deployed the mongodb and its cluster run in localhost (http://127.0.0.1:27017).

Connect to your MongoDB instance

If you wish to manually configure your Compass connection, load Compass and select the New Connection link. You will see a form where you can enter connection information for MongoDB.

connect-to-host

in my case i use mongo-compass version 1.31

image (1)

the host name define your mongoDB cluster-IP, you can see your cluster-IP in ubuntu on:

nano /etc/mongo.conf

if your mongo-DB is bind with some external or internal IP, then use this URL. in my case my server-IP is public and mongo is runing on internal local host (IP=127.0.0.1).

image (2)

You will be prompted to populate the connection dialog. Click Yes.

NOTE Errors related to connecting through Compass will appear in red at the top of the Connect screen.

Summary

Congratulations. If you have successfully completed this guide, you have connected to your MongoDB instance. In the next group of guides, you’ll learn how to create, read, update, and delete data in MongoDB.


to make coonection with your mongodb server:

The default /etc/mongod.conf file has this entry for network interfaces:

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1

To expose the database running in a VM to the host, it's simplest to bind the database to all interfaces for testing purposes.

# network interfaces
net:
  port: 27017
  bindIpAll: true

Notice the bindIp parameter is removed.

About