Setup MongoDB community server as a single node.
$ docker pull mongodb/mongodb-community-server
Verify MongoDB image is downloaded successfully:
$ docker images
Run docker image
$ docker run --name mongo -p 27017:27017 -d mongodb/mongodb-community-server:latest
Setup MongoDB 3 node cluster on docker
The steps to create a docker cluster are as follows.
- Create a Docker network.
- Start three instances of MongoDB.
- Initiate the Replica Set.
Once you have a MongoDB cluster up and running, you will be able to experiment with it.
Ref: https://www.mongodb.com/compatibility/deploying-a-mongodb-cluster-with-docker
Using Docker Compose -
docker-compose -f config/docker-compose.yaml up -d
More details on cluster setup can be learned from Mongodb University here.
No comments:
Post a Comment