mongo集群
主节点配置
dbpath=/data/db/
port=27017
bind_ip=0.0.0.0
fork=true
logpath = /data/db/MongoDB.log
logappend = true
auth=false
replSet=mongo-rs
docker run -d -p 37017:27017 --name mongo-master --restart=always -v /Users/wangdasheng/Documents/docker/mongo/master/db:/data/db -v /Users/wangdasheng/Documents/docker/mongo/master/config:/data/configdb mongo --replSet mongo-rs
#从节点
dbpath=/data/db/
port=27017
bind_ip=0.0.0.0
fork=true
logpath = /data/db/MongoDB.log
logappend = true
auth=false
replSet=mongo-rs
docker run -d -p 37018:27017 --name mongo-slave1 --restart=always -v /Users/wangdasheng/Documents/docker/mongo/slave1/db:/data/db -v /Users/wangdasheng/Documents/docker/mongo/slave1/config:/data/configdb mongo --replSet mongo-rs
docker run -d -p 37019:27017 --