Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between a cluster and a replica set in mongodb atlas?

I'm taking the Mongodb University M103 course and over there they gave a brief overview of what a cluster and a replica set is. From my understanding a cluster is a set of servers or nodes. While a replica set is a set of servers or nodes all of which has replication mechanism built into each of them for downtime access and faster read operation.

From that it seems that replica set is a specific type of cluster, but my confusion arises from MongoDB Atlas. In mongoDB atlas one has to create a cluster, is that a replica set as well?

Are those terms interchangeable in all scenarios?

like image 572
Devorein Avatar asked May 07 '20 11:05

Devorein


People also ask

What is cluster and replica set in MongoDB?

The major difference between a replica set and a cluster is: A replica set copies the data set as a whole. A cluster distributes the workload and stores pieces of data (shards) across multiple servers.

What is a cluster in MongoDB Atlas?

MongoDB Atlas Cluster is a NoSQL Database-as-a-Service offering in the public cloud (available in Microsoft Azure, Google Cloud Platform, Amazon Web Services). This is a managed MongoDB service, and with just a few clicks, you can set up a working MongoDB cluster, accessible from your favorite web browser.

What is replica sets in MongoDB?

A replica set is a group of mongod instances that maintain the same data set. A replica set contains several data bearing nodes and optionally one arbiter node. Of the data bearing nodes, one and only one member is deemed the primary node, while the other nodes are deemed secondary nodes.

What is meant by replica set?

A ReplicaSet is a process that runs multiple instances of a Pod and keeps the specified number of Pods constant. Its purpose is to maintain the specified number of Pod instances running in a cluster at any given time to prevent users from losing access to their application when a Pod fails or is inaccessible.


1 Answers

Replica Set

In MongoDB, a replicaset is a concept that depicts a set of MongoDB server working in providing redundancy (all the servers in the replica set have the same data) and high availability (if a server goes down, the remaining servers can still fulfil requests). When you create a replicaset, you need a minimum of 3 servers. There will always be a primary (read and write) and the remaining are called secondaries (for reading only).

MongoDB Atlas Cluster

Atlas is a DaaS, meaning a database a service company. They remove the burdain of maintaining, scaling and monitoring MongoDB servers on premise, so that you can focus on your applications.

An Atlas MongoDB cluster is a set of configuration you give to Atlas so it can setup the MongoDB servers for you. Hence, a MongoDB ReplicaSet is a feature subset in Atlas.

For example, while creating an Atlas Cluster, they will ask you whether you want a replicaset, sharded cluster, etc. Also, in which cloud provider you want to deploy. Your backup policy, the specs of your MongoDB hardware and more...

The keyword here is configuration. At the end of the day, you will have your MongoDB servers (replicaset or not) up and ready.

Summary

MongoDB Cluster

A specific configuration set of MongoDB servers to provide specific features. i.e. replicaset and sharding.

MongoDB Replicaset

A MongoDB cluster setup to provide redundancy and high availability with 3 or more odd number of servers (3, 5, 7, etc.)

MongoDB Atlas Cluster

High level MongoDB cluster configuration that allows you to set a replicaset or other type of MongoDB cluster with its location and performance range.

I would suggest you to play with their web console. You will definitely see the difference.

like image 112
gmolaire Avatar answered Oct 04 '22 01:10

gmolaire