Coder Social home page Coder Social logo

mongo-replica-set's Introduction

MongoDB Replica Set

A Replica Set of MongoDB running in a Docker container.

This image is useful for doing local development and for automated testing in a CI environment but should NOT be used for production.

Running MongoDB

To run the MongoDB replica set, execute the following command:

docker run -d -p 27017-27019:27017-27019 adaptable/mongo-replica-set

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

Persisting data

With the above command, any data stored in the MongoDB cluster is deleted when the Docker container is removed. To persist the database data beyond the lifetime of the container, use a Docker volume.

For example, to store the database data to a directory on your local system:

docker run -d -p 27017-27019:27017-27019 -v "${HOME}/my-mongo-data:/data" adaptable/mongo-replica-set

Connecting to the cluster

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

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

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.