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

Clarify process of setting up replicaSet with mongodb #496

Open
Timothy-Gonzalez opened this issue Nov 3, 2022 · 0 comments
Open

Clarify process of setting up replicaSet with mongodb #496

Timothy-Gonzalez opened this issue Nov 3, 2022 · 0 comments

Comments

@Timothy-Gonzalez
Copy link
Member

Timothy-Gonzalez commented Nov 3, 2022

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!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant