Skip to content
This repository has been archived by the owner on Jan 31, 2025. It is now read-only.

Commit

Permalink
BC-7240 - init improved
Browse files Browse the repository at this point in the history
  • Loading branch information
mamutmk5 authored Jun 27, 2024
1 parent 52ff499 commit cbe0a1b
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion ansible/roles/mongo-repset/templates/init-configmap.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,17 @@ data:
do
sleep 1
done
mongosh $MONGODB_URI --eval 'rs.initiate({"_id" : "rs0", "members" : [{"_id" : 0, "host" : "mongodb-0.mongo-svc:27017"},{"_id" : 1, "host" : "mongodb-1.mongo-svc:27017"},{"_id" : 2, "host" : "mongodb-2.mongo-svc:27017"}]})'
mongosh $MONGODB_URI --eval 'rs.initiate({"_id" : "rs0", "members" : [{"_id" : 0, "host" : "mongodb-0.mongo-svc:27017"}]})'
until mongosh $MONGODB_1_URI --eval "print(\"waited for connection\")"
do
sleep 1
done
mongosh $MONGODB_URI --eval 'rs.add("mongodb-1.mongo-svc:27017")'
until mongosh $MONGODB_2_URI --eval "print(\"waited for connection\")"
do
sleep 1
done
mongosh $MONGODB_URI --eval 'rs.add("mongodb-2.mongo-svc:27017")'
sleep 30
if [[ $(mongosh --quiet --eval "db.isMaster().setName") != rs0 ]]
then
Expand Down

0 comments on commit cbe0a1b

Please sign in to comment.