hands-on lab

Self-Hosting MongoDB on Google Compute Engine

Intermediate
Up to 1h 15m
49
5/5
Get guided in a real environmentPractice with a step-by-step scenario in a real, provisioned environment.
Learn and validateUse validations to check your solutions every step of the way.
See resultsTrack your knowledge and monitor your progress.

Description

There are tradeoffs involved in deciding whether or not to self-host a database or to leverage a database as a service offering. How much control do you need over the database? Do you have the bandwidth and expertise to deal with self-hosting? These are just a few of the questions to consider. This lab assumes you've made the decision to self-host MongoDB and deploy the database on Google Compute Engine (GCE).

This lab walks you through the process of getting MongoDB up and running on an instance and deploying a MongoDB replica set. Considerations for production workloads are discussed at each phase. The lab also discusses how to leverage Compute Engine's snapshot functionality as part of a sound disaster recovery plan.

Learning Objectives

Upon completion of this intermediate-level lab, you will be able to:

  • Understand the benefits of multiple zone database deployments
  • Install MongoDB on Linux machines
  • Configure and deploy a MongoDB replica set
  • Understand available options for backing up MongoDB data
  • Create Google Compute Engine persistent disk snapshots

Intended Audience

  • Cloud Engineers
  • Database Administrators
  • Anyone interested in self-hosting databases, particularly MongoDB

Prerequisites

Familiarity with the following will be beneficial but is not required:

  • Working with Linux at the command line
  • MongoDB fundamentals

The following content can help to fulfill the prerequisite:

Updates

June 5th, 2024 - Updated lab to use MongoDB 7.0

May 27th, 2022 - Added instructions to improve clarity

Environment before

Environment after

About the author

Avatar
Logan Rakai, opens in a new tab
Technical Director, Labs
Students
223,162
Labs
223
Courses
9
Learning paths
58

Logan has been involved in software development and research since 2007 and has been in the cloud since 2012. He is an AWS Certified DevOps Engineer - Professional, AWS Certified Solutions Architect - Professional, Microsoft Certified Azure Solutions Architect Expert, MCSE: Cloud Platform and Infrastructure, Google Cloud Certified Associate Cloud Engineer, Certified Kubernetes Security Specialist (CKS), Certified Kubernetes Administrator (CKA), Certified Kubernetes Application Developer (CKAD), and Certified OpenStack Administrator (COA). He earned his Ph.D. studying design automation and enjoys all things tech.

LinkedIn, Twitter, GitHub

Covered topics

Lab steps

Signing In to the Google Cloud Console
Introducing the Lab's MongoDB Cluster Resources
Installing MongoDB on the Primary Node
Deploying a MongoDB Replica Set
Using Snapshots to Backup the MongoDB Database