Sign inSign up

jacksoncage/mongo

By jacksoncage

•Updated almost 11 years ago

Instant MongoDB sharded cluster

Image
6

8.3K

jacksoncage/mongo repository overview

⁠Instant MongoDB sharded cluster

This repository provides a Vagrantfile, Dockerfile and a bootstrap script to create MongoDB Cluster using a virtual machine built on Virtualbox software hypervisor. After setup is complete shared MongoDB sharded cluster on a single virtual machine running on your local machine.

MongoDB cluster consisted of the following docker containers

  • mongos1-3r1-3: Mongod server with three replica sets distributes on six mongo containers.
  • configservers1-3: Stores metadata for sharded cluster distributed on three mongo containers.
  • mongos1: Mongo routing service installed on one mongo container.
  • skydock: Used for service discovery and inserts internal docker images records into skydns.
  • skydns: Used as internal DNS for containers.

There unfortunately some hard-coded timeouts due to timing issues with MongoDB.

⁠Installation:

⁠Linux

Install Virtualbox based off the installation instructions⁠.

⁠MacOS
⁠Install Homebrew

First, install Homebrew⁠.

ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
⁠Install Virtualbox and Vagrant

Install VirtualBox and Vagrant using Brew Cask⁠.

brew tap phinze/homebrew-cask
brew install brew-cask
brew cask install virtualbox
brew cask install vagrant

⁠Check out the repository

git clone [email protected]:jacksoncage/mongo-docker.git
cd mongo-docker
vagrant up

⁠Setup Cluster

This will pull all the images from Docker index⁠ and setup Mongodb sharded cluster.

vagrant ssh
./docker/start_cluster.sh"

You should now be able connect to mongos1 and the new sharded cluster:

MongoDB Cluster is now ready to use
Connect to cluster by:
$ mongo --port 49550

⁠Kill/restart cluster

To re-initiate cluster run start_cluster.sh again. To rebuild vagrant vagrant destroy and then vagrant up

⁠Persistent storage

Data is stored at ./docker_mongodb_cluster/mongodata/ and are excluded from version control. Data will be persistent even for a vagrant destroy as it's mounted into vagrant and then needed container as well. To remove all data rm -rf ./docker_mongodb_cluster/mongodata/*

⁠Built upon

Tag summary

Content type

Image

Digest

sha256:4e3b343c6…

Size

225.5 MB

Last updated

almost 11 years ago

docker pull jacksoncage/mongo