MongoDB via Cloud Manager
Bootstrap multiple Google Compute Engine instances with the MongoDB Cloud Manager agent.
Prerequisites
Google Cloud Platform
- Create a Google Cloud Platform account (and enable billing)
- Install and setup the Google Cloud SDK
- Enable the Deployment Manager and Compute Engine APIs
- Set your project:
gcloud config set project PROJECT-ID
- Set the preferred zone:
gcloud config set compute/zone ZONE
MongoDB Cloud Manager
- Create a MongoDB Cloud Manager account
- Navigate to
Cloud Manager > Settings > Group Settings
and copy theGroup ID
andAgent API Key
at the top of the page, you will need these values below.
Note: MongoDB Cloud Manager is a paid service from MongoDB, Inc. and is governed by the MongoDB Cloud Manager terms of service
Deploying Configuration
Properties
The Deployment Manager template uses a schema that defines and describes the properties required for the deployment:
machineType
- Default value is
n1-highmem-2
- Can be any of the available predefined machine types
- For custom machine types refer to the machineType URL spec
zone
- Default value is
us-central1-f
- Can be any of the available regions & zones
mmsGroupId
- No default value set
- Use the value from
Group Id
above when deploying (see example below)
mmsApiKey
- No default value set
- Use the value from
Agent API Key
above when deploying (see example below)
Creating Deployment
Create the deployment using the Deployment Manager configuration template:
$ gcloud deployment-manager deployments create mongodb-cloud-manager \
--template mongodb-cloud-manager.jinja \
--properties mmsGroupId:MMSGROUPID,mmsApiKey:MMSAPIKEY
Optionally, to override the default values for machineType
or zone
use the following:
$ gcloud deployment-manager deployments create mongodb-cloud-manager \
--template mongodb-cloud-manager.jinja \
--properties machineType:n1-highmem-8,zone:us-central1-d,mmsGroupId:MMSGROUPID,mmsApiKey:MMSAPIKEY
The Deployment Manager configuration creates three 500GB Persistent SSDs and attaches them to three Compute Engine instances. Each instance then runs a startup script that configures and attaches storage, and installs the MongoDB Cloud Manager automation agent.
Deploy MongoDB using Cloud Manager
Once the instances have completed the setup process, they should be visible via Cloud Manager > Deployment > Servers
in a few minutes. To deploy MongoDB, refer to the instructions for Deploying a Replica Set.
Clean Up
First, unmanage the deployment via Cloud Manager. Refer to the documentation on Removing a Process from Management for more information.
Next, delete the deployment from Google Cloud Platform.
Note that all configuration resources (instances, disks) will be deleted.
$ gcloud deployment-manager deployments delete mongodb-cloud-manager
Notes
- Three instances are created by this configuration, sufficient for a MongoDB Replica Set. To deploy a MongoDB Sharded Cluster, consider adding additional instance entries in the mongodb-cloud-manager.jinja configuration template.
- Instances are created within the
default
network however no MongoDB-specific firewall rules are added. To add rules that allow incoming traffic to your MongoDB deployment, refer to the Firewalls documentation. - The Google Cloud Platform Pricing Calculator estimate of the monthly costs to run this deplyoment configuration can be found here