hands-on lab

Self-Hosting MongoDB on Google Compute Engine

Difficulty: Intermediate
Duration: Up to 1 hour and 15 minutes
Students: 51
Rating: 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

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