Skip to content

Latest commit

 

History

History
29 lines (26 loc) · 566 Bytes

README.md

File metadata and controls

29 lines (26 loc) · 566 Bytes

Docker MongoDB Cluster (Replication Set)

Easily deploy Mongodb cluster on your local environment

Getting Started

  • Nodes:
    • mongodb1 [master]
    • mongodb2 [rs secondary]
    • mongodb3 [rs secondary]
  • Run Mongodb cluster contianers
$ docker compose up -d
  • Execute to mongo shell on master node
$ docker exec -it mongodb1 mongosh
  • Setup replications
rs.initiate()
rs.add("mongodb2:27017")
rs.add("mongodb3:27017")

Port Configuration

  • nodes:
    • mongodb1: 27027
    • mongodb2: 27078
    • mongodb3: 27079