Availability Zones (if the region supports it). In production clusters, we recommend using three replica sets ( Primary , Secondary0 , Secondary1 ). All clients typically interact with the primary node for read and write operations. It is possible to choose a secondary node as a preference during read operations, but write operations always go to the primary node and get replicated asynchronously in the secondary nodes. If you choose a secondary node for read operations, watch out for stale data, because the secondary node may not be in sync with the primary node. For more information about how read operations are routed in a replica set, see the MongoDB documentation. In a development environment, you can start with a single replica set and move to three replica sets during production. Figure 1 shows the MongoDB reference deployment with a replication factor of 3.
Amazon Web Services – MongoDB on the AWS Cloud August 2016 Page 7 of 26 Figure 1: MongoDB Cluster on AWS with Three Replica Sets When a primary instance fails, one of the secondary instances from another Availability Zone will become the new primary node, thereby guaranteeing automatic failover. Sharding . Refers to distribution of data across multiple nodes. Storing distinct data across multiple nodes provides horizontal scalability for read and write performance. When you have a large data set, a single node could be bottlenecked by CPU or I/O performance. Sharding resolves this bottleneck by reducing the number of operations each shard node handles, and improves overall cluster performance. This Quick Start provides support for up to three shards. A shard count of 0 results in a simple replicated cluster. Sharded cluster . MongoDB supports sharding via sharded clusters. Each shard can be a replica set. This Quick Start supports one and three replica sets, so each shard can be housed in one or three Availability Zones. Sharded clusters provide high availability of individual shards and are recommended for production. Query routers . These are instances that run the mongos process and interface with clients. The mongos process is responsible for handling queries from the application layer and determining the location of the query data in the sharded cluster. This reference deployment runs one query router on primary nodes. Additional routers can be started manually, if needed.
Amazon Web Services – MongoDB on the AWS Cloud August 2016 Page 8 of 26 Config servers . This reference deployment launches three config servers in three different Availability Zones in a sharded cluster. These are lightweight instances that store the cluster’s metadata , so a small instance type is sufficient for a config server. Figure 2 shows a two-way sharded and three-way replicated cluster.
- Spring '17
- Amazon Web Services, AWS, Amazon Elastic Compute Cloud, aws cloud