Do I need to Configure replica set from MongoDB shell after server restart?

check the task manager if you have 3 “mongod” process. they might have stopped for you might forgot the unseen step of creating data and log folders.

  • you need 3 data folders under c:\data: db, db1 and db2
  • you need 3 log folders under C:\mongodb-win32-xxx: log, log1 and log2

f you have followed that page and did not divert from the instruction it provides, you should be able to connect them all as localhost at ports “27017”, “37017” and “47017” individually.

the primary node of your set can change at any time you restart the system, so use this to connect as a whole (connect to primary if not set otherwise):
mongodb://localhost:27017,localhost:27017,localhost:27017/?replicaSet=rs1

1 Like