Skip to content
This repository was archived by the owner on Dec 7, 2023. It is now read-only.
This repository was archived by the owner on Dec 7, 2023. It is now read-only.

Clarify process of setting up replicaSet with mongodb #496

Description

@Timothy-Gonzalez

We need to make a doc somewhere on how to set up replicaSet with mongodb since the current process is slightly convoluted.

Note for this to work, it's recommended not to use the service (make sure you do sudo service mongod stop).

  1. Run command to start mongod (~/mongodb/db is the path of your database, make sure it exists (makedir ~/mongodb/db -p):
sudo mongod --dbpath ~/mongodb/db --replSet rs0
  1. Connect using mongosh
mongosh
  1. Initialize rs:
rs.initialize()
  1. Exit, stop mongod, and rerun. Should be working now, you can test using make run and the POST /user/ endpoint
  2. If you want mongod to start on boot up, add this to your .bashrc:
sudo mongod --dbpath ~/mongodb/db --replSet rs0 > /var/log/mongod/mongod.log &

/var/log/mongod/mongod.log is the location where the logs will be written. Make sure the directory exists (makedir /var/log/mongod/ -p).

And it SHOULD work!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions