net: bindIpAll: true replication: replSetName: rs_configsvr # 副本集名称,相同副本须使用同一个副本集名称 sharding: clusterRole: configsvr |
docker run -d -p 9001:27019 --name configsvr \ --entrypoint "mongod" \ -v /data/mongod/configdata/configsvr:/data/configdb \ -v /data/mongod/conf/keyfile:/data/keyfile \ -v /data/mongod/conf/configsvr:/data/conf \ mongo:4.0.21 -f /data/conf/mongod.conf |
docker exec -it configsvr bash mongo --host 172.17.140.41 --port 9001 use admin |
rs.initiate({ _id: "rs_configsvr", configsvr: true, members: [ { _id : 0, host : "172.17.140.41:9001" }, { _id : 1, host : "172.17.140.42:9001" }, { _id : 2, host : "172.17.140.43:9001" } ] } ) |