Mongo Sharded Cluster with Docker Compose ========================================= A simple sharded Mongo Cluster with a replication facto…
Mongo Sharded Cluster with Docker Compose ========================================= A simple sharded Mongo Cluster with a replication facto…
A simple sharded Mongo Cluster with a replication factor of 2 running in docker using docker-compose.
Designed to be quick and simple to get a local or test environment up and running. Needless to say... DON'T USE THIS IN PRODUCTION!
Heavily inspired by https://github.com/jfollenfant/mongodb-sharding-docker-compose
config01,config02,config03shard01a,shard01bshard02a,shard02bshard03a,shard03brouterStart all of the containers (daemonized)
docker-compose up -dInitialize the replica sets (config server and shards) and router
sh init.shThis script has a sleep 20 to wait for the config server and shards to elect their primaries before initializing the router
Verify the status of the sharded cluster
…The cluster only has to be initialized on the first run. Subsequent startup can be achieved simply with docker-compose up or docker-compose up -d
Its as simple as:
docker-compose exec router mongoTo remove all data and re-initialize the cluster, make sure the containers are stopped and then:
docker-compose rmExecute the First Run instructions again.
No open issues yet, or sync has not completed.