Connect to MongoDb on linux server (Compass/Browser)

I am very new to MongoDB. I have successfully installed it on a Centos linux server and wanted to know how I can connect to it using a browser to create a cluster and database. As yet I haven’t setup a virtual host because I don’t know which directory I need to be the root directory.

If someone can point me to all the right documentation that would be great

If you want to configure a cluster through the web, then I would look into making a free cluster of MongoDB Atlas.

If you want to have it on a local Centos server than you will have to configure the cluster through a configuration file.

The default directory that mongo runs on is /data/db. But you can use any path that you would like for your database / log files as long as you define the path in your configuration file.

Also MongoDB has great videos on Mongo University that will walk you through how to setup an Atlas cluster or a replica set in a VM. See the course Mongo University M001.

I have looked at the MongoDb courses and they are all based on Atlas and I would much prefer to use this on my own server. I have also looked at the configuration file and made some changes and now when I run netstat I get:
tcp 0 0* LISTEN 52833/mongod

However, when I try to connect using Compass on either port 27017 or 28017 I get a connection timeout. I also timeout if I try to connect using a browser

I now find when I run a browser locally using :27017 I get:
It looks like you are trying to access MongoDB over HTTP on the native driver port.
but when I run remotely I get connection timeout

Hi @Russell_Rose

You might need to open/filter port 27017/tcp on the firewall on the centos server. Depending on your server setup SELinux could also be a factor. SELinux is covered in the install guide

The courses M103, M310 and M312 at are not based on Atlas and cover running mongodb on your own hardware.

M103: Basic Cluster Administration


Learn how to start up basic MongoDB deployments, from the basic single mongod process, to replica sets and sharded clusters. This course will teach you to explore and configure these deployments using the MongoDB shell.

M310: MongoDB Security


Learn basic MongoDB security features, integration capabilities and resources. The course project involves creating secured deployments of MongoDB for production ready environments.

M312: Diagnostics and Debugging


Learn how to diagnose and debug issues that can arise in your MongoDB deployment. This course will go over a set of scenarios you might find in production, and introduce you to many of the tools and functionality that MongoDB’s support and field teams use to diagnose issues, and how to fix those problems once they’re identified.