How To Convert Your MongoDB Single Instance Into a Cluster

Photo by Geran de Klerk on Unsplash — Two is better than one, especially for mongodb instances :)

Let’s start

replication:
replSetName: myReplica
rs.initiate(
{
_id: "myReplica",
version: 1,
members: [
{ _id: 0, host : "mongo1.mydomain:27017" },
{ _id: 1, host : "mongo2.mydomain:27017" },
]
}
)

Wait, you are not done yet

Option 1: Creating another secondary

Option 2: Creating an arbitrer

rs.addArb("mongo-arbitrer1.mydomain:27017")

Summary

--

--

--

R&D Group Manager @ Check Point | Software Engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Analysing source control history with Rust

How to Update device drivers in Windows 10 (Updated Guide 2021)

Media Player Classic Home Cinema 1.9.18 [MPC HC]

Media Player Classic Home Cinema 1.9.18 [MPC HC]

Renaming the default branch from master to main on Github

REST API~ Quick note

Intro to Claris Connect Part 2: Creating A Conditional Flow

New water-proof soil sensor with arduino

How to get the most out of the flutter documentation

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Regev Golan

Regev Golan

R&D Group Manager @ Check Point | Software Engineer

More from Medium

Hosting Nodejs App using your own Docker Image in Jelastic PaaS/ Yeti Cloud

Hosting frontend app on Cloud - Part I

Building a “People who bought this item but also bought” recommendation engine.

Rough process flow of how the recommended products are generated.

What happens when you type google.com in your browser and press Enter