Click to deploy
- Choose two instances and an arbiter instance. (Min required config for a replica set)
- SSH into the primary instance (determined by rs.status())
- Create a dbuser admin with root permissions
- Verify that the user is good
- Create a keyFile with openssl command.
- Paste the keyFile to both the instances.
- chmod 700 file and sudo chown mongodb:mongodb file
- stop both instances.
- Edit config file enable security authentication, give keyFile path to the one created
- start both servers
- open shell in the last server started.
- rs.status(), and check which instance is primary
- Login to the primary instance and create a user for the db.
- Add a traffic rule in networks setting in gcp console allowing tcp:27017 with instances of the right deployment
- Connect and enjoy!