Skip to content

Instantly share code, notes, and snippets.

View cnwangjie's full-sized avatar
👀
Exploring life

WangJie cnwangjie

👀
Exploring life
View GitHub Profile
@cnwangjie
cnwangjie / local-mongo-replicaset-with-docker
Created May 25, 2021 17:01 — forked from oleurud/local-mongo-replicaset-with-docker
[Local mongo replicaset with docker] #docker #mongo
# pull the official mongo docker container
docker pull mongo
# create network
docker network create my-mongo-cluster
# create mongos
docker run -d --net my-mongo-cluster -p 27017:27017 --name mongo1 mongo mongod --replSet my-mongo-set --port 27017
docker run -d --net my-mongo-cluster -p 27018:27018 --name mongo2 mongo mongod --replSet my-mongo-set --port 27018
docker run -d --net my-mongo-cluster -p 27019:27019 --name mongo3 mongo mongod --replSet my-mongo-set --port 27019