MongoDB on Ubuntu VMs

Azure Public Test Date Azure Public Test Result

Azure US Gov Last Test Date Azure US Gov Last Test Result

Best Practice Check Cred Scan Check

Deploy To Azure Deploy To Azure US Gov Visualize

This template creates a multi-server MongoDB deployment on Ubuntu and CentOS virtual machines, and configures the MongoDB installation for high availability using a replica set. The template also provisions storage accounts, virtual network, availability set, network interfaces, VMs, disks and other infrastructure and runtime resources required by the installation. In addition, and when explicitly enabled, the template can create one publicly accessible "jumpbox" VM allowing to ssh into the MongoDB nodes for diagnostics or troubleshooting purposes.

Topology

The deployment topology is comprised of a predefined number (as per t-shirt sizing) MongoDB member nodes configured as a replica set, along with the optional arbiter node. Replica sets are the preferred replication mechanism in MongoDB in small-to-medium installations. However, in a large deployment with more than 50 nodes, a master/slave replication is required.

The following table outlines the deployment topology characteristics for each supported t-shirt size:

T-Shirt Size Member Node VM Size CPU Cores Memory Data Disks Arbiter Node VM Size # of Members Arbiter # of Storage Accounts
XSmall Standard_D1 1 3.5 GB 2x100 GB Standard_A1 2 Yes 1
Small Standard_D1 1 3.5 GB 2x100 GB Standard_A1 3 No 1
Medium Standard_D2 2 7 GB 4x250 GB Standard_A1 4 Yes 2
Large Standard_D2 2 7 GB 4x250 GB Standard_A1 8 Yes 4
XLarge Standard_D3 4 14 GB 8x500 GB Standard_A1 8 Yes 4
XXLarge Standard_D3 4 14 GB 8x500 GB Standard_A1 16 No 8

An optional single arbiter node is provisioned in addition to the number of members stated above, thus increasing the total number of nodes by 1. The size of the arbiter node is standardized as Standard_A1. Arbiters do not store the data, they vote in elections for primary and require just a bare minimum machine specification to perform their duties.

Each member node in the deployment will have a MongoDB daemon installed and correctly configured to participate in a replica set. All member nodes except the last one will be provisioned in parallel. During provisioning of the last node, a replica set will be initiated. The optional arbiter joins the replica set after it is initiated. To ensure a successful deployment, this template has to serialize the provisioning of all member nodes and the arbiter node as follows:

(1) MEMBER NODES (except last) >>> (2) LAST MEMBER NODE >>> (3) ARBITER (optional)

In the above deployment sequence, steps #1 and #2 will have to complete first before the next step kicks off. As a result, you may be seeing longer-than-desirable deployment times as member node provisioning is not fully parallelized.

##Notes, Known Issues & Limitations

  • To access the individual MongoDB nodes, you need to use the publicly accessible jumpbox VM and ssh from it into the individual MongoDB instances
  • The minimum architecture of a replica set is comprised of 3 members. A typical 3-member replica set can have either 3 members that hold data, or 2 members that hold data and an arbiter
  • The deployment script is not yet idempotent and cannot handle updates (although it currently works for initial provisioning only)
  • SSH key is not yet implemented and the template currently takes a password for the admin user
  • MongoDB version 3.0.0 and above is recommended in order to take advantage of high-scale replica sets offered by this template
  • The current version of the MongoDB template is shipped with Ubuntu support only (adding support for CentOS is just a matter of creating an additional installation .sh script)

Tags: Microsoft.Resources/deployments, Microsoft.Network/networkInterfaces, Microsoft.Compute/virtualMachines, Microsoft.Compute/virtualMachines/extensions, CustomScript, Microsoft.Network/networkSecurityGroups, Microsoft.Network/publicIPAddresses, Microsoft.Storage/storageAccounts, Microsoft.Compute/availabilitySets, Microsoft.Network/virtualNetworks