Skip to content

Instantly share code, notes, and snippets.

@mav-erick
Last active September 1, 2018 15:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mav-erick/25f149faae7dd5c352bc36f5b7928a0f to your computer and use it in GitHub Desktop.
Save mav-erick/25f149faae7dd5c352bc36f5b7928a0f to your computer and use it in GitHub Desktop.
Deploying MongoDB Google one click

Click to deploy

  1. Choose two instances and an arbiter instance. (Min required config for a replica set)
  2. SSH into the primary instance (determined by rs.status())
  3. Create a dbuser admin with root permissions
  4. Verify that the user is good
  5. Create a keyFile with openssl command.
  6. Paste the keyFile to both the instances.
  7. chmod 700 file and sudo chown mongodb:mongodb file
  8. stop both instances.
  9. Edit config file enable security authentication, give keyFile path to the one created
  10. start both servers
  11. open shell in the last server started.
  12. rs.status(), and check which instance is primary
  13. Login to the primary instance and create a user for the db.
  14. Add a traffic rule in networks setting in gcp console allowing tcp:27017 with instances of the right deployment
  15. Connect and enjoy!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment