GithubHelp home page GithubHelp logo

sathyajithps / mongo-replica-set Goto Github PK

View Code? Open in Web Editor NEW

This project forked from candisio/mongo-replica-set

0.0 0.0 0.0 7 KB

A replica set of MongoDB in Docker Container

License: MIT License

Dockerfile 61.05% Shell 38.95%

mongo-replica-set's Introduction

MongoDB Replica Set

Forked from https://github.com/CandisIO/mongo-replica-set

A Replica Set of MongoDB running in a Docker container

Not For Production

The key motivation for this image is to have a ready-made replica set of MongoDB running inside docker container for CI tests and local development.

To run the container, execute the following command:

docker run -d -p 27017:27017 -p 27018:27018 -p 27019:27019 sathyajith/mongo-replica-set:latest

Wait for 30 to 35 seconds in order to properly start all database instances and replica-set initialization.

Configuration

Additionally, you can pass an env variable called HOST when running the container to configure the replica's hostname in docker. By default, it uses localhost.

Once ready, the replica-set can be accessed using the following connection string:

mongodb://localhost:27017,localhost:27018,localhost:27019/?replicaSet=rs0&readPreference=primary&ssl=false

If you're connecting from your host machine, you might need to set a new alias within /etc/hosts:

# /etc/hosts
127.0.0.1 HOST # where HOST is the value passed as env variable to the container

mongo-replica-set's People

Contributors

jsangilve avatar grantwilliams avatar sathyajithps avatar candeemis 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.