Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4652dc8

Browse files
committedJun 1, 2021
checking replica set status
1 parent 585038d commit 4652dc8

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed
 

‎start-mongodb.sh

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@ fi
1717

1818
if [ -z "$MONGODB_REPLICA_SET" ]; then
1919
echo ""
20-
echo "#########################################"
20+
echo "#############################################"
2121
echo "Starting single-node instance, no replica set"
2222
echo " - port [$MONGODB_PORT]"
2323
echo " - version [$MONGODB_VERSION]"
24-
echo "#########################################"
24+
echo "#############################################"
2525

2626
docker run --name mongodb --publish $MONGODB_PORT:27017 --detach mongo:$MONGODB_VERSION
2727
return
2828
fi
2929

3030

3131
echo ""
32-
echo "#########################################"
32+
echo "###########################################"
3333
echo "Starting MongoDB as single-node replica set"
3434
echo " - port [$MONGODB_PORT]"
3535
echo " - version [$MONGODB_VERSION]"
3636
echo " - replica set [$MONGODB_REPLICA_SET]"
37-
echo "#########################################"
37+
echo "###########################################"
3838

3939
docker run --name mongodb --publish $MONGODB_PORT:$MONGODB_PORT --detach mongo:$MONGODB_VERSION mongod --replSet $MONGODB_REPLICA_SET --port $MONGODB_PORT
4040

@@ -88,3 +88,12 @@ docker exec --tty mongodb mongo --port $MONGODB_PORT --eval "
8888
"
8989

9090
echo "Success! Initiated replica set [$MONGODB_REPLICA_SET]"
91+
92+
echo ""
93+
echo "##############################################"
94+
echo "Checking replica set status [$MONGODB_REPLICA_SET]"
95+
echo "##############################################"
96+
97+
docker exec --tty mongodb mongo --port $MONGODB_PORT --eval "
98+
rs.status()
99+
"

0 commit comments

Comments
 (0)
Please sign in to comment.