Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 1.38 KB

README.md

File metadata and controls

26 lines (18 loc) · 1.38 KB

Mongo Replicas running as Docker containers.

Inspiration and most of code/configuration comes from [this blog post] (http://www.tothenew.com/blog/mongodb-replica-set-using-docker-networking-and-docker-compose/) (Thanks to [Navjot Singh] (http://www.tothenew.com/blog/author/navjot/) -- Author of the post).

Information

  • PRIMARY - <DOCKER_MACHINE_IP:27017>
  • SECONDARY - <DOCKER_MACHINE_IP:27018>
  • SECONDARY - <DOCKER_MACHINE_IP:27019>

Running

Verifying - Failover Situations (if Secondary becomes Primary)

  • Stop Primary (master) service - docker-compose stop mongodb-master
  • Connect to one of Secondary (slave):
    • mongo <DOCKER_MACHINE_IP:27018> or docker run -it abdul/alpine-mongo:latest mongo <DOCKER_MACHINE_IP:27018>
    • Or, * mongo <DOCKER_MACHINE_IP:27019> or docker run -it abdul/alpine-mongo:latest mongo <DOCKER_MACHINE_IP:27019>
  • Verify if data (imported/added earlier on Primary) is available