Giter Club home page Giter Club logo

mongo-docker's Introduction

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

mongo-docker's People

Contributors

jacksoncage avatar

Watchers

Maxim Kharchenko avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.