Skip to content

Latest commit

 

History

History

mongodb-replicaset

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Simple replica set in docker with a web app to connect to it

An example of how to create a very simple replica set using docker's docker-compose file. It can be used for starting developing your app without needing to install a mongo server locally.

For starting this up

Just use:

docker-compose up

Url for the different mongo containers

  • mongodb://mongo-rs0-1
  • mongodb://mongo-rs0-2
  • mongodb://mongo-rs0-3

Some commands for experimenting with the replica set

  • docker exec mongodb-replicaset_mongo-rs0-1_1 bash -c 'mongo --eval "rs.status();"'
  • docker stop mongodb-replicaset_mongo-rs0-2_1
  • docker start mongodb-replicaset_mongo-rs0-2_1

Resources