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

Description
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).
- 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
- Connect using
mongosh
- Initialize rs:
- Exit, stop mongod, and rerun. Should be working now, you can test using
make run and the POST /user/ endpoint
- 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!