net: bindIpAll: true sharding: configDB: rs_configsvr/172.17.140.41:9001,172.17.140.42:9001,172.17.140.43:9001 # 定义为mongos配置服务器 |
docker run --name mongos -d \ -p 27017:27017 \ --entrypoint "mongos" \ -v /data/mongod/conf/keyfile/:/data/keyfile/ \ -v /data/mongod/conf/mongos/:/data/conf/ \ mongo:4.0.21 -f /data/conf/mongod.conf |
# 进入mongos 容器中 # docker exec -it mongos bash # 连接mongos # mongo --host 127.0.0.1 --port 27017 # use admin |