Become a MongoDB Replica Set Expert in Under 5 Minutes:

Similar documents
Scaling MongoDB. Percona Webinar - Wed October 18th 11:00 AM PDT Adamo Tonete MongoDB Senior Service Technical Service Engineer.

How to Scale MongoDB. Apr

Maximizing Availability With Hyper-Converged Infrastructure

Run your own Open source. (MMS) to avoid vendor lock-in. David Murphy MongoDB Practice Manager, Percona

GR Reference Models. GR Reference Models. Without Session Replication

Virtual protection gets real

Exploring the replication in MongoDB. Date: Oct

WHITE PAPER. Header Title. Side Bar Copy. Header Title 5 Reasons to Consider Disaster Recovery as a Service for IBM i WHITEPAPER

Azure Webinar. Resilient Solutions March Sander van den Hoven Principal Technical Evangelist Microsoft

Microsoft SQL Server

Aurora, RDS, or On-Prem, Which is right for you

MySQL HA Solutions Selecting the best approach to protect access to your data

A Guide to Architecting the Active/Active Data Center

DATABASE SCALE WITHOUT LIMITS ON AWS

Overview. CPS Architecture Overview. Operations, Administration and Management (OAM) CPS Architecture Overview, page 1 Geographic Redundancy, page 5

A Ready Business rises above infrastructure limitations. Vodacom Power to you

Step into the future. HP Storage Summit Converged storage for the next era of IT

Your First MongoDB Environment: What You Should Know Before Choosing MongoDB as Your Database

~3333 write ops/s ms response

MySQL and Virtualization Guide

Scalable backup and recovery for modern applications and NoSQL databases. Best practices for cloud-native applications and NoSQL databases on AWS

ZYNSTRA TECHNICAL BRIEFING NOTE

MongoDB Backup and Recovery Field Guide. Tim Vaillancourt Sr Technical Operations Architect, Percona

MySQL Cluster Ed 2. Duration: 4 Days

ECONOMICAL, STORAGE PURPOSE-BUILT FOR THE EMERGING DATA CENTERS. By George Crump

Solution Brief: Commvault HyperScale Software

End-to-End Storage Provisioning for MongoDB

Veritas Cluster Server from Symantec

Protecting Mission-Critical Application Environments The Top 5 Challenges and Solutions for Backup and Recovery

Carbonite Availability. Technical overview

Cloud Backup and Recovery for Healthcare and ecommerce

4 Criteria of Intelligent Business Continuity

TOP REASONS TO CHOOSE DELL EMC OVER VEEAM

Data Protection for Virtualized Environments

IBM Compose Managed Platform for Multiple Open Source Databases

MySQL Architecture Design Patterns for Performance, Scalability, and Availability

EBOOK. FROM DISASTER RECOVERY TO ACTIVE-ACTIVE: NuoDB AND MULTI-DATA CENTER DEPLOYMENTS

Designing Database Solutions for Microsoft SQL Server 2012

Business Benefits of Policy Based Data De-Duplication Data Footprint Reduction with Quality of Service (QoS) for Data Protection

COURSE 20740B: INSTALLATION, STORAGE AND COMPUTE ITH WINDOWS SERVER 2016

MongoDB Backup & Recovery Field Guide

[MS20740]: Installation, Storage, and Compute with Windows Server 2016

How to upgrade MongoDB without downtime

MySQL In the Cloud. Migration, Best Practices, High Availability, Scaling. Peter Zaitsev CEO Los Angeles MySQL Meetup June 12 th, 2017.

Disaster Recovery as a Service

VMWARE VREALIZE OPERATIONS MANAGEMENT PACK FOR. MongoDB. User Guide

Microsoft Azure for AWS Experts

Disaster Recovery Guide

<Insert Picture Here> MySQL Web Reference Architectures Building Massively Scalable Web Infrastructure

Microsoft E xchange 2010 on VMware

IBM Spectrum Protect Plus

MySQL High Availability

MongoDB. David Murphy MongoDB Practice Manager, Percona

Microsoft SQL Server on Stratus ftserver Systems

Documentation Accessibility. Access to Oracle Support

Advanced Architecture Design for Cloud-Based Disaster Recovery WHITE PAPER

ESSENTIAL, QUALITY IT SUPPORT FOR SMALL AND MEDIUM BUSINESSES

Datacenter replication solution with quasardb

A Digium Solutions Guide. Switchvox On-Premise Options: Is it Time to Virtualize?

MySQL High Availability. Michael Messina Senior Managing Consultant, Rolta-AdvizeX /

From Single File Recovery to Full Restore: Choosing the Right Backup and Recovery Solution for Your Cloud Data

Veeam with Cohesity Data Platform

NEC Express5800 R320f Fault Tolerant Servers & NEC ExpressCluster Software

Using MySQL for Distributed Database Architectures

Pro2SQL. OpenEdge Replication. for Data Reporting. for Disaster Recovery. March 2017 Greg White Sr. Progress Consultant Progress

Mike Kania Truss

Highly Available Database Architectures in AWS. Santa Clara, California April 23th 25th, 2018 Mike Benshoof, Technical Account Manager, Percona

Efficient Geographic Replication & Disaster Recovery. Tom Pantelis Brian Freeman Colin Dixon

Virtual Disaster Recovery

Securely Access Services Over AWS PrivateLink. January 2019

Installation, Storage, and Compute with Windows Server 2016 Course 20740B - 5 Days - Instructor-led, Hands on

MySQL High Availability Solutions. Alex Poritskiy Percona

The future of database technology is in the clouds

HPE and Micro Focus Data Protection for SAP HANA

HCI: Hyper-Converged Infrastructure

Course Outline 20740B. Module 1: Installing, upgrading, and migrating servers and workloads

The Data Protection Rule and Hybrid Cloud Backup

Disaster Unpreparedness June 3, 2013

Data Sheet: High Availability Veritas Cluster Server from Symantec Reduce Application Downtime

PGConf.Russia 2019, Moscow. Alexander Kukushkin

Data safety for digital business. Veritas Backup Exec WHITE PAPER. One solution for hybrid, physical, and virtual environments.

SOLUTION BRIEF Fulfill the promise of the cloud

VMWARE VSAN LICENSING GUIDE - MARCH 2018 VMWARE VSAN 6.6. Licensing Guide

ON CALL, ALL THE TIME DISASTER RECOVERY AS A SERVICE FROM WINDSTREAM

Server Fault Protection with NetApp Data ONTAP Edge-T

FUJITSU Storage ETERNUS AF series and ETERNUS DX S4/S3 series Non-Stop Storage Reference Architecture Configuration Guide

RECOVERY & BUSINESS CONTINUITY SERVICES. Protect your data. Recover your environment. Manage your recovery.

Buyer s Guide: DRaaS features and functionality

CANVAS DISASTER RECOVERY PLAN AND PROCEDURES

Avoiding the Cost of Confusion: SQL Server Failover Cluster Instances versus Basic Availability Group on Standard Edition

20465: Designing a Data Solution with Microsoft SQL Server

MySQL CLOUD SERVICE. Propel Innovation and Time-to-Market

DELL EMC DATA DOMAIN BOOST AND DYNAMIC INTERFACE GROUPS

Ten things hyperconvergence can do for you

Running Splunk on VxRack FLEX

DO NOT USE Microsoft Designing Database Solutions for Microsoft SQL Server

MongoDB Architecture

Focus On: Oracle Database 11g Release 2

Simplifying Downtime Prevention for Industrial Plants. A Guide to the Five Most Common Deployment Approaches

Document Sub Title. Yotpo. Technical Overview 07/18/ Yotpo

Transcription:

Become a MongoDB Replica Set Expert in Under 5 Minutes: USING PERCONA SERVER FOR MONGODB IN A FAILOVER ARCHITECTURE This solution brief outlines a way to run a MongoDB replica set for read scaling in production. It also demonstrates advanced features that empower you to use a best practice architecture from day one. Best fit for: Production environments that need automated high availability and recovery Environments that have not yet reached the need for full sharding solutions

Summary With many classic databases, you need to use additional services, third-party software and scripts to facilitate data replication. MongoDB provides the replication (in a form of a replica set) out of the box. This document describes a proven, MongoDB replica set architecture that is built upon Percona Server for MongoDB. It provides an elastic, highlyavailable, fast-to-recover and resilient database layer out of the box. We also describe the best practices underlying the architecture of a replicaset, including the biggest mistake people make. To ensure you understand how each option is used, we have a slightly complicated diagram. However, it shows you where these features fit. Use Case Almost all web and application projects need to somehow persistently store data. Storing data on one single server does not provide redundancy and scalability. Modern web applications are usually read-heavy, so scaling reads are essential for the application performance. MongoDB provides data replication and read scalability out of the box. The Replica Set in MongoDB is a quick an easy way to implement: Data redundancy Automatic failover (little to no application downtime) Read scalability (via the ReadConcern option) Ability to perform rolling upgrades and maintenance with zero downtime PRO Quicker failover means higher application uptime with little to no application downtime, with consistent data across nodes. Failover is transparent to applications and doesn t affect application performance. Allows you to tailor specific MongoDB nodes to specific database functions in order to distribute working load across environment. Scales out to 50 read replicas. CON Limit of seven voting nodes ON-PREMISES OR CLOUD ARCHITECTURE SOLUTION PROPERTIES AVAILABILITY DATA PROTECTION OPERATIONAL COST SIMPLICITY READ SCALABILITY WRITE SCALABILITY BACKUP RECOVERY TIME Chaining replicas can cause lags in data between nodes, which can mean stale reads. You need to set how safe reads should be, which means that reads between nodes in a replica set might not be consistent. Secondary nodes may return stale data due to asynchronous replication on write. No scalability for writes MongoDB always writes to a Primary node. 2

Architecture We will look at two replica sets in action: a Best Practice Basic Replica Set and an Every Feature Configuration Replica Set. The second is very complex, but labeled so you can see how someone might use the setup when running two data centers that need, for example, US and APAC local reads for performance, local backup nodes to improve recovery, a delayed slave in the US and even a preferred pair of nodes that can become Primary. This is explained in more detail in Ultra Low Latency Reads Per Region with MongoDB Replica Set. ARCHITECTURE DIAGRAM In the diagram above: All nodes are data bearing with the same hardware Each node has the same priority, any can be Primary as needed None are Arbiters If any two nodes are up, we maintain read and write capabilities. With two nodes down, an election can t happen so the surviving node cannot be made primary. In this case, we can read data from the surviving node but cannot write any data to the replica set. An Arbiter node can be helpful, but there are some caveats regarding their use. An arbiter node is to decides elections for a new primary in case of a tie from the remaining nodes. If you have an odd number of nodes, an arbiter is not needed as there is always be a sufficient number of surviving nodes to decide an election. As a cost-saving method, some organizations decide to have one of the nodes in a three-node replica set as an Arbiter (to save on disk space and to decrease costs as well as arbiters don t store data and can run in any machine), and this is where problems can arise. If you do not have at least three nodes in the full data set, any work such as building indexes, nodes or backups can have a measurable impact on your system or even worse, can risk your high availability coverage. Since the Arbiter does not have the full data set, it cannot function as a database node in case of a failure of one of the other nodes. You are left with one node that handles all of the work, and imperils backups and high availability. 3

ARCHITECTURE DIAGRAM Components MongoDB Community, MongoDB Enterprise, or Percona Server for MongoDB will all work here with no need for any third-party tooling. The table explains the functions of the nodes in the diagram: NODE P B SETUP All writes are sent to this node in the replica set. S1-S5 could also become Primary nodes, but since S3-S5 have priority:1, and P, S1 and S2 have priority:2, the system prefers to keep the Primary on the west coast (only moving to the east coast in dire need). This non-voting node is dedicated for backups (shown by the gray heartbeat). It doesn t vote or answer queries and is not in the West tag-set. S1/2 Both of these nodes are normal Secondaries that do vote, and are also members of the West tag-set. This means any applications in the West tag-set query them instead of S3-S5. In the event of an election, since this is the primary data center they have a priority of 2. P, S1 and S2 are preferred in order to keep the Primary in the west. S3/4/5 DS A Failover Like S1/S2, these nodes are Secondaries and only become primary if the West data center is down. Additionally, they are in the East tag-set. Reads for East Coast applications go here and not to the West Coast. Writes must still go to the Primary. This is a special node is hidden so it won t take reads, and delayed so that it applies changes a full two hours behind the rest of the cluster. This allows the final data center to be a proper disaster recovery site. This node can never become Primary and it is unable to vote. Finally, we get the Arbiter. With three voting members in the East and West each, we have an even six votes. The Arbiter can break any ties, and does not hold data to ensure that either the West of East always has a Primary if the opposing data center fails. Unlike other databases, MongoDB includes automatic failover and recover. This makes replicas inherently valuable for even beginner users who might not know how to set up manual failover. For comparison, MySQL users have to build and implement failover systems themselves, or turn to third-party tools. MongoDB replication allows for relatively easy set up by having the most difficult aspects already done and automatically managed on your behalf. The connection string must be properly configured, otherwise the application will fail due to no Primary node available. 4

Backups Backups are a complex topic in any database. Like other databases, MongoDB is capable of binary, logical, and snapshot backups. This flexibility allows you to choose the right tool for the job. When it comes to taking a logical backup, you can make it consistent by using the --oplog flag to record any changes occurring while the backup is taking place. When you perform a restore, MongoDB applies those operations and your database is consistent to the point the backup stopped. MongoDB automatically tries to use a read Primary node for a backup when it notices it is part of a replica set for cluster-wide (multiple replica sets) backed-up at the same time. Sharding adds complications but there are still safe methods. Please email us for more information and solutions. Monitoring For query analytics and time-based database performance information, we strongly recommend our Percona Monitoring and Management open source tool. This should be installed on a third host, either by using the Docker container images, Virtual Appliance (OVA) or as is available through the Amazon Marketplace. Dealing with Growth You can expand the entry level environment by adding more nodes for reads, or increasing their resources for writes. Once the write workload grows beyond a single server, we recommend sharding or workload separation (sharding is far easier to implement). Replica sets provide extensive read scaling at a low operational cost. It is simple to deploy an additional node with the same configuration file, and then run rs.add( $newhost:$newport ). MongoDB do the lifting for you. Percona Can Help Managing your organization s database operations, on-premises or in the cloud, requires in-depth knowledge of potential issues plus diligent, dedicated practice. Being aware of the issues above will help protect your organization s data-based applications when setting up a high availability database environment. It will also significantly enhance both performance and scalability to deliver a better user experience. Percona Support services are accessible 24x7x365 online or by phone to ensure that your database installation is running optimally. We can also provide onsite or remote Percona Consulting for current or planned projects, or in emergency situations. Every engagement is unique and we will work with you to create the most effective solution for your business. Percona Managed Services can support your existing database infrastructure whether it is hosted onpremise or at a colocation facility or if you purchase services from a cloud provider or database-as-aservice provider. To learn about how Percona can help you, and for pricing information, please contact us at +1-888-316-9775 (USA), +44 203 608 6727 (Europe), or email us at sales@percona.com. 5