Start MongoDB Service

  1. Press Windows+R, then type services.msc and press Enter.
    Figure 1. MongoDB Installation - Community Version (HA) (cont.)
    A screenshot of a computer error message Description automatically generated
  2. Search for the MongoDB service and click MongoDB service.
  3. Click Start the service on the Left pane.
    Figure 2. MongoDB Installation - Community Version (HA) (cont.)
    Note:
    These above steps must be performed on all the servers which are part of the replica set.
  4. Go to all the servers that have MongoDB service installed.
  5. Open Command Prompt as Administrator and execute the below command by changing respective IP and port of server.
    mongosh --host <IP> --port <port on which mongoDB service is running (mentioned in config file)>
    for e.g.
    server 1: mongosh --host x.x.xx.x1 --port 27014
    server 2: mongosh --host x.x.x.x2 --port 27015
    server 3: mongosh --host x.x.x.x3 --port 27016
  6. If the service is running successfully, then connection will be established without any error message.