@@ -11,19 +11,21 @@ pushd $(dirname $0)
1111 source $PWD /func.sh
1212
1313 export MONGO_VERSION=${MONGO_VERSION}
14+ export DATA_MONGOD_FLAGS=" --shardsvr"
1415 export MCB_EXTRA=${MCB_EXTRA}
1516
1617 CONFIGSVR_REPLSET=csReplSet
1718 if [ " ${CONFIGSVR_TYPE} " == " CSRS" ]; then
1819 export CONFIGSVR_FLAGS=" --replSet ${CONFIGSVR_REPLSET} "
19- export MONGOS_CONFIGDB=" ${CONFIGSVR_REPLSET} /mongo-cs-1:27017,mongo-cs-2:27017"
20+ export MONGOS_CONFIGDB=" ${CONFIGSVR_REPLSET} /mongo-cs-1:27017,mongo-cs-2:27017,mongo-cs-3:27017 "
2021 echo " # Using CSRS-based config servers: '${MONGOS_CONFIGDB} '"
2122 else
2223 export CONFIGSVR_FLAGS=
2324 export MONGOS_CONFIGDB=" mongo-cs-1:27017,mongo-cs-2:27017"
2425 echo " # Using SCCC-based config servers: '${MONGOS_CONFIGDB} '"
2526 fi
2627
28+ # start mongo-mongos service (which starts the whole cluster)
2729 echo " # Starting instances with docker-compose"
2830 docker-compose up -d mongo-mongos
2931
@@ -37,25 +39,27 @@ pushd $(dirname $0)
3739 configsvr: true,
3840 members: [
3941 { _id: 0, host: "mongo-cs-1:27017" },
40- { _id: 1, host: "mongo-cs-2:27017" }
42+ { _id: 1, host: "mongo-cs-2:27017" },
43+ { _id: 1, host: "mongo-cs-3:27017" }
4144 ]
4245 })'
4346 fi
4447
4548 echo " # Initiating rs0"
46- doMongo mongo-mongos mongo-s- rs0-1:27017 ' rs.initiate({
49+ doMongo mongo-mongos mongo-rs0-1:27017 ' rs.initiate({
4750 _id: "rs0",
4851 members: [
49- { _id: 0, host: "mongo-s-rs0-1:27017" },
50- { _id: 1, host: "mongo-s-rs0-2:27017", priority: 0 }
52+ { _id: 0, host: "mongo-rs0-1:27017" },
53+ { _id: 1, host: "mongo-rs0-2:27017" },
54+ { _id: 1, host: "mongo-rs0-3:27017", priority: 0 }
5155 ]
5256 })'
5357
5458 echo " # Waiting 10 seconds"
5559 sleep 10
5660
5761 echo " # Adding shard rs0"
58- doMongo mongo-mongos mongo-mongos:27017 ' sh.addShard("rs0/mongo-s- rs0-1:27017,mongo-s- rs0-2:27017")'
62+ doMongo mongo-mongos mongo-mongos:27017 ' sh.addShard("rs0/mongo-rs0-1:27017,mongo-rs0-2:27017,mongo-rs0-3 :27017")'
5963
6064 echo " # Starting mongodb_consistent_backup, cluster mode (in docker)"
6165 docker-compose up --abort-on-container-exit backup-cluster
0 commit comments