Giter Club home page Giter Club logo

global-mongo's Introduction

Dockerized Mongo replica set

Introduction

This docker-compose setup creates a simulation of a cross-region Mongo replica set. The set consists of 3 instances. Two of them (m1 and m2) are installed in one "virtual datacenter" and the third (m3) is placed in a different region, with 100ms of latency.

The user observes the replica set from the m3 perspective, so they have 0ms latency connecting to m3 and 100ms to m1 and m2:

Graph

Deployment

In order to setup the containers, invoke:

./init.sh

it'll use docker-compose to create 4 containers. Mongo instances are available on exposed ports 27017 (primary), 27018 (secondary) and 27019 (secondary, no latency).

Connecting to the replica set with mongo

One may connect to the Mongo using the ports above and the hostname of the docker-machine. If the docker runs without the docker-machine localhost will work as well.

mongo $(docker-machine ip):27017

Setting latency

The latency and jitter can be set using another script:

./set_latency.sh 200 10

Both values are passed in milliseconds. Invoking the script without any parameters will disable the latency.

Stopping the replica set

The whole deployment can be stopped and removed with following command:

./kill.sh

TODO

  • Add fakes3 support to simulate datastore latency

global-mongo's People

Contributors

mreutegg avatar trekawek avatar

Watchers

 avatar  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.