mongodb-icon

Mongo DB Replica Set

PSS Style (Primary - Secondary - Secondary)

This cluster has no access control mechanism till now. Don't forget to enable it before deploying to production.


This project will help you to setup a replica set of mongo db.

Original Repo : https://github.com/minhhungit/mongodb-cluster-docker-compose Original Readme : Readme

Table Of Contents


Prerequisites

Docker, Git and Docker Compose should be installed on your system.

Installation

  1. Clone the project.

    git clone https://github.com/Velorona-LLC/mongodb-replica-set.git
  2. Execute the install.sh file. It will:

    • Step 1: Start all of the containers
    • Step 2: Initialize the replica sets (config servers and shards)
    • Step 3: Initializing the router
    • Step 4: Verify status of replica set for each shard

You should see 1 PRIMARY, 2 SECONDARY

Connect to the replica set

You can connect to the replica set, by connecting to the router 1 and router 2 at port 27117 and/or 27118.

Note: 27117 and 27118 , not 27017 and 27018

mongodb://<username>:<password>@<router1:port1>,<router2:port2>/<database>?authSource=admin

Author

Author Name   :   Shree Krishna Lamichhane
Author URI       :   shreekrishnalamichhane.com.np
GitHub URI       :   shreekrishnalamichhane

Contributors

List of all Contributors:

License

License: MIT


Thank you for using this documentation. If you love this project give it a star.