Skip to content

ashok-kallara/mongo-docker-compose

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongo-docker-compose

This repository provides a fully sharded mongo environment using docker-compose and local storage.

The MongoDB environment consists of the following docker containers. It's a simplified version of original upstream.

  • mongosrs(1-2)n1: Mongod data server with two replica sets containing 1 nodes each
  • mongocfg1: Stores metadata for sharded data distribution
  • mongos1: Mongo routing service to connect to the cluster through

In addition, also creates an admin user mongo-admin/mongo-admin.

Caveats

  • This is designed to have a minimal disk footprint at the cost of durability.
  • This is designed in no way for production but as a cheap learning and exploration vehicle.

Usage

Check out the repository

git clone [email protected]:singram/mongo-docker-compose.git
cd mongo-docker-compose

Setup Cluster

This will pull all the images from Docker index and run all the containers.

docker-compose up

Please note that you will need docker-compose 1.4.2 or better for this to work due to circular references between cluster members. You will need to run the following once only to initialize all replica sets and shard data across them

./initiate

You should now be able connect to mongos1 and the new sharded cluster via mongCLI or any other client like Robo 3T

mongo localhost:27017 -u mongo-admin -p mongo-admin --authenticationDatabase admin

Persistent storage

Data is stored at ./data/ and is excluded from version control. Data will be persistent between container runs. To remove all data ./reset

TODO

Built upon

About

Fully sharded mongo environment using docker-compose

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 100.0%