From 51fa756c910f19eb5e18d7e40620365ad2b75dff Mon Sep 17 00:00:00 2001 From: Grant Williams Date: Tue, 6 Oct 2020 16:05:11 +0200 Subject: [PATCH] Ensure the Mongo database running on port 27017 is the master --- init-replica.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/init-replica.sh b/init-replica.sh index 045ac04..c50d9f2 100644 --- a/init-replica.sh +++ b/init-replica.sh @@ -6,9 +6,9 @@ DB3_PORT=27019 LOCAL_HOST="127.0.0.1" -RS_MEMBER_1="{ \"_id\": 0, \"host\": \"${LOCAL_HOST}:${DB1_PORT}\" }" -RS_MEMBER_2="{ \"_id\": 1, \"host\": \"${LOCAL_HOST}:${DB2_PORT}\" }" -RS_MEMBER_3="{ \"_id\": 2, \"host\": \"${LOCAL_HOST}:${DB3_PORT}\" }" +RS_MEMBER_1="{ \"_id\": 0, \"host\": \"${LOCAL_HOST}:${DB1_PORT}\", \"priority\": 2 }" +RS_MEMBER_2="{ \"_id\": 1, \"host\": \"${LOCAL_HOST}:${DB2_PORT}\", \"priority\": 0 }" +RS_MEMBER_3="{ \"_id\": 2, \"host\": \"${LOCAL_HOST}:${DB3_PORT}\", \"priority\": 0 }" sleep 30 mongo --eval "rs.initiate({ \"_id\": \"rs0\", \"members\": [${RS_MEMBER_1}, ${RS_MEMBER_2}, ${RS_MEMBER_3}] });"