MongoDB - Replication & Sharding

Similar documents
Disclaimer This presentation may contain product features that are currently under development. This overview of new technology represents no commitme

Roundabout Modeling in CORSIM. Aaron Elias August 18 th, 2009

Dell EMC SCv ,000 Mailbox Exchange 2016 Resiliency Storage Solution using 10K drives

Real-time Bus Tracking using CrowdSourcing

TRITON ERROR CODES ERROR CODE MODEL SERIES DESCRIPTION RESOLUTION

License Model Schedule Actuate License Models for the Open Text End User License Agreement ( EULA ) effective as of November, 2015

1 Descriptions of Use Case

Enhancing Energy Efficiency of Database Applications Using SSDs

MODULE 6 Lower Anchors & Tethers for CHildren

Frequently Asked Questions: EMC Captiva 7.5

Scheduling. Purpose of scheduling. Scheduling. Scheduling. Concurrent & Distributed Systems Purpose of scheduling.

SCAT PASSENGER NO-SHOW/LATE CANCELLATION POLICY

Series 905-IV16(E) CAN/CANopen Input Modules Installation and Operating Manual

INSTALLATION USER MANUAL

What s new. Bernd Wiswedel KNIME.com AG. All Rights Reserved.

PowerChute TM Network Shutdown v3.1. User Guide. VMware

Index. Calculated field creation, 176 dialog box, functions (see Functions) operators, 177 addition, 178 comparison operators, 178

Veritas CloudPoint. Snapshot based data protection

Options G4, G5 and G8 Power management Functional description Display units Power management setup Power management functions Parameter lists

GPI (Gas Pump Interface) with Cash Register Express - Integration Manual

Twoskip Cyrus database format

2015 The MathWorks, Inc. 1

Fixing the Hyperdrive: Maximizing Rendering Performance on NVIDIA GPUs

Administrator edited the Terminal configuration 1014 Administrator printed the configuration. Enter the Administrative menu. Select DIAG.

APC APPLICATION NOTE #98

DOWNLOAD OR READ : TORRENT SEAT CORDOBA WORKSHOP MANUALS WIRING

JUMO DSM software. PC software for management, configuration, and maintenance of digital sensors. Operating Manual T90Z001K000

Optimal Start Time: Precool and Preheat

PQube 3 Modbus Interface

STPA in Automotive Domain Advanced Tutorial

ENTERTAINMENT IDENTIFIER REGISTRY COMBINED MONTHLY UPDATE

A Preliminary Look At Safety Critical Events From The Motorcyclists Perspective

Designing an Effective Authentication Topology. Gil Kirkpatrick CTO, NetPro

GFX2000. Fuel Management System. User Guide

Proposed Solution to Mitigate Concerns Regarding AC Power Flow under Convergence Bidding. September 25, 2009

Informatica Powercenter 9 Designer Guide Pdf

Quick Setup Guide for IntelliAg Model YP Air Pro

Huf Group. Your Preferred Partner for Tire Pressure Monitoring Systems. IntelliSens App

City of West Covina 2017 Public Participation Districting Kit

Quick Setup Guide for IntelliAg Model YP40 20 Air Pro

Characteristics of Vessels Participating in the Alaska Peninsula Salmon Purse Seine and Drift Gillnet Fisheries, 1978 to 1999

ABB AC500 Technical Help Sheet

ID: Cookbook: browseurl.jbs Time: 20:23:06 Date: 25/05/2018 Version:

Welcome to the waitless world. CBU for IBM i. Steve Finnes

ZT Disk Drive Replacement Solutions

NDC. National Demographics Corporation. City of Merced 2015 Public Participation Districting Kit. Printed Contents (in the Acrobat PDF file)

Sinfonia: a new paradigm for building scalable distributed systems

Query Engines for Hive: MR, Spark, Tez with LLAP Considerations!

Five Cool Things You Can Do With Powertrain Blockset The MathWorks, Inc. 1

Alberta Speeding Convictions and Collisions Involving Unsafe Speed

Dispenser Communication Error Codes for units containing the DeLaRue SDD-1700 feeders only

Advanced Superscalar Architectures. Speculative and Out-of-Order Execution

Copyright 2012 EMC Corporation. All rights reserved.

WEST KENTUCKY COMMUNITY AND TECHNICAL COLLEGE

FLEXIBILITY FOR THE HIGH-END DATA CENTER. Copyright 2013 EMC Corporation. All rights reserved.

ET9500 BEMS Interface Box Configuration Guide

Quick Setup Guide for IntelliAg Model 3PYP 12 Row Single Row Air Pro

KNIME Server Workshop

WHITE PAPER. Informatica PowerCenter 8 on HP Integrity Servers: Doubling Performance with Linear Scalability for 64-bit Enterprise Data Integration

Rapid Upgrades With Pg_Migrator

Report on the MLA Job Information List,

BKF Control Panel Instruction Manual for the Owners

Practical Resource Management in Power-Constrained, High Performance Computing

Rapid Upgrades With Pg_Migrator

Agenda. Transactions Concurrency & Locking Lock Wait Deadlocks IBM Corporation

PowerChute TM Network Shutdown v4.0. User Guide. VMware

BRANDON POLICE SERVICE th Street Brandon, Manitoba R7A 6Z3 Telephone: (204)

Automatic Genset Controller, AGC-4 Display readings Push-button functions Alarm handling Log list

Simulating Trucks in CORSIM

Configuring FDMS Nash-North (Datawire) for Credit Card / Debit Card Processing in Retail/Quick Service

Sams Teach Yourself Java In 24 Hours 5th Edition Rogers Cadenhead

Admission Requirements for a Bachelor of Science in Computer Information Technology

JMS Performance Comparison Performance Comparison for Publish Subscribe Messaging

Survey Report Informatica PowerCenter Express. Right-Sized Data Integration for the Smaller Project

Method for the estimation of the deformation frequency of passenger cars with the German In-Depth Accident Study (GIDAS)

Application Note 67. Using The Low Power Modes on TransPort. April 2016

Validation of Generation Meter Data in MV-90 xi

Informatica Powercenter 9 Transformation Guide Pdf

UKSM: Swift Memory Deduplication via Hierarchical and Adaptive Memory Region Distilling

Associate of Science to Bachelor of Science in Computer Information Technology All Tracks

Michigan State Police (MSP) Post 21 - Metro North

SEG-D, Rev October 2015 Release letter

REPORT TO THE CHIEF ADMINISTRATIVE OFFICER FROM THE DEVELOPMENT AND ENGINEERING SERVICES DEPARTMENT COMPRESSED NATURAL GAS TRANSIT FLEET UPDATE

An update on MTCC Caribbean s Pilot Projects: Preliminary Results of Data Collection Stephan Nanan

WIRELESS BLOCKAGE MONITOR OPERATOR S MANUAL

2010 National Edition correlated to the. Creative Curriculum Teaching Strategies Gold

KISSsoft 03/2016 Tutorial 7

SEG-D, Rev September 2014 Release letter

Vehicle Diagnostic Logging Device

Installation Guide. ECL Comfort 210 / 310, application A231 / A Table of Contents

Towards Realizing Autonomous Driving Based on Distributed Decision Making for Complex Urban Environments

Agenda. Industrial software systems at ABB. Case Study 1: Robotics system. Case Study 2: Gauge system. Summary & outlook

MetaXpress PowerCore System Installation and User Guide

2018 Linking Study: Predicting Performance on the NSCAS Summative ELA and Mathematics Assessments based on MAP Growth Scores

KISSsoft 03/2018 Tutorial 7

CommWeigh Axle Standard Module

Southern California Edison Original Cal. PUC Sheet No E Rosemead, California (U 338-E) Cancelling Cal. PUC Sheet No.

Engine Control System Tacho System

SENTRY VI USER S MANUAL

Using SystemVerilog Assertions in Gate-Level Verification Environments

Transcription:

MongoDB - Replication & Sharding Masterprojekt NoSQL Mirko Köster Universität Hamburg Fachbereich Informatik Arbeitsgruppe VSIS 29. November 2013 Mirko Köster MongoDB - Replication & Sharding 29.11.2013 1 / 26

Agenda 1 Replication 2 Sharding Mirko Köster MongoDB - Replication & Sharding 29.11.2013 2 / 26

Replication Mirko Köster MongoDB - Replication & Sharding 29.11.2013 3 / 26

Motivation Redundancy Failover Maintanance Load Balancing Mirko Köster MongoDB - Replication & Sharding 29.11.2013 4 / 26

Overview Master - Slave - Replication deprecated more than 12 nodes (ReplSet) up to 12 nodes consists of 1 master and some slaves (and/or arbiter(s)) write to master read from master consistent read from slave eventually consistent Mirko Köster MongoDB - Replication & Sharding 29.11.2013 5 / 26

ReplSet States State Vote State Description All members start up in this state. The mongod STARTUP parses the replica set configuration document while in STARTUP. PRIMARY + The primary is the only member to accept write operations. SECONDARY + The secondary replicates the data store. RECOVERING + Members either perform startup self-checks, or transition from completing a rollback or resync. FATAL Has encountered an unrecoverable error. STARTUP2 Forks replication and election threads before becoming a secondary. UNKNOWN Has never connected to the replica set. ARBITER + Arbiters do not replicate data and exist solely to participate in elections. DOWN Is not accessible to the set. ROLLBACK + Performs a rollback. SHUNNED Was once in the replica set but has now been removed. Mirko Köster MongoDB - Replication & Sharding 29.11.2013 6 / 26

Heartbeat Every node pings every other node every 2 seconds n (n 1) pings every 2 seconds worst case: 12 (12 1) = 132 pings every 2 seconds Mirko Köster MongoDB - Replication & Sharding 29.11.2013 7 / 26

Failover If the master becomes unresponsive, a new master has to be elected. Majority Vote Initial number of nodes defines size of majority. Majority of n nodes: n/2 + 1 In most cases the most up to date secondary will be elected master. After recovery the former failed master may rejoin the ReplSet as secondary. Missing data will be replicated. If too far behind: complete resync No majority no master The current master will step down and become a secondary. Writing to the ReplSet is now impossible. Mirko Köster MongoDB - Replication & Sharding 29.11.2013 8 / 26

Replication oplog - master records all changes to the data capped collection on 64 Bit Linux: the greater of 1 GB and 5% discsize entries (transactions) are idempotent and identified with a BSON timestamp. entries are replicated to secondaries (and applied locally). In case the master crashed: entries from the oplog, which have not been replicated, will be rolled back. the oplog does NOT replace journaling. journaling is still advised to minimize downtime in case of node crash. Mirko Köster MongoDB - Replication & Sharding 29.11.2013 9 / 26

Commits & Write Concerns a change is considered to be commited, once it is replicated to a majority of nodes. In most cases the consistency one gets by writing to the master is good enough. If it is not, one can use write concerns. controlled via two parameters w: total number of nodes the change must have been replicated to (can be a number or the value "majority") timeout: how long (time in ms) the application should wait (block) Mirko Köster MongoDB - Replication & Sharding 29.11.2013 10 / 26

ReplSet Config (excerpt) priority votes arbiteronly slavedelay Mirko Köster MongoDB - Replication & Sharding 29.11.2013 11 / 26

MongoDB Drivers available for most common languages e.g. C, C++, C#, Erlang, Java, Perl, PHP, Python, Ruby, Scala connect to specific node master secondary (read only) set parameter :slave_ok to true no automatic failover connect to whole ReplSet aware of all nodes automatic failover but error not hidden see driver s documentation Mirko Köster MongoDB - Replication & Sharding 29.11.2013 12 / 26

Scenarios - Heartbeat Mirko Köster MongoDB - Replication & Sharding 29.11.2013 13 / 26

Scenarios - Arbiter Mirko Köster MongoDB - Replication & Sharding 29.11.2013 14 / 26

Scenarios - Arbiter Mirko Köster MongoDB - Replication & Sharding 29.11.2013 14 / 26

Scenarios - Arbiter Mirko Köster MongoDB - Replication & Sharding 29.11.2013 14 / 26

Scenarios - Two Datacenters Mirko Köster MongoDB - Replication & Sharding 29.11.2013 15 / 26

Scenarios - Two Datacenters Mirko Köster MongoDB - Replication & Sharding 29.11.2013 15 / 26

Scenarios - Two Datacenters Mirko Köster MongoDB - Replication & Sharding 29.11.2013 15 / 26

Scenarios - Three Datacenters Mirko Köster MongoDB - Replication & Sharding 29.11.2013 16 / 26

Scenarios - Three Datacenters Mirko Köster MongoDB - Replication & Sharding 29.11.2013 16 / 26

Read Scaling a ReplSet with the maximum of 12 Servers means majority = 7 If your cluster is available, that is the lower bound of nodes you can count on for read performance. not enough? you have basically 2 options (Master - Slave - Replication) Sharding Mirko Köster MongoDB - Replication & Sharding 29.11.2013 17 / 26

Sharding Sharding Mirko Köster MongoDB - Replication & Sharding 29.11.2013 18 / 26

Sharding Motivation distribute large volumes of data evenly accross nodes add capacity increase write and/or read throughput keep working data + indexes in RAM RAM is limiting factor reduce load on node(s) production-level sharding since August 2010 (v1.6) Mirko Köster MongoDB - Replication & Sharding 29.11.2013 19 / 26

Sharding Sharding Components shards each shard is a ReplSet routers ( mongos ) no state often run on the same server as application config servers 3 config servers - on 3 different machines (redundancy) may be run on same server with other MongoDB services persistently store cluster state (shard cluster meta data) Mirko Köster MongoDB - Replication & Sharding 29.11.2013 20 / 26

Sharding Scenarios - Sharding Mirko Köster MongoDB - Replication & Sharding 29.11.2013 21 / 26

Sharding Sharding a collection (1) MongoDB shards data on a per collection basis. Every database has a primary shard that holds all the un-sharded collections in that database. define a shard key per sharded collection (basically the main index used to distribute the data among the shards). The data is split into non-overlapping ranges (chunks). distributed evenly accross cluster not guaranteed to be contiguous per shard. Mirko Köster MongoDB - Replication & Sharding 29.11.2013 22 / 26

Sharding Sharding a collection (2) Balancing automatic splitting and migrating of chunks splitting (logical): default max chunk size is 64 MB or 100,000 documents migrating (physical): per default when number of chunks diverge by 8 or more Sharding logic separated from application little to no need to change app code after migrating from single server (or ReplSet) to sharded cluster Indexes on a per-shard basis unique index only for shard key and/or _id otherwise it would require inter-shard-communication. Mirko Köster MongoDB - Replication & Sharding 29.11.2013 23 / 26

Sharding Query / Query Performance shard key part of query? yes: execute on right shard(s) no: hit all shards scatter / gather - query merge result on router use prefix subset of compound shard key analyze queries (e.g. performance, how many shards involved etc) Mirko Köster MongoDB - Replication & Sharding 29.11.2013 24 / 26

Summary use replication in production commodity hardware sufficient easy to set up highly customizable enable sharding when needed analyze needs of your application analyze queries to find a good shard key enable it early - not when it s too late Mirko Köster MongoDB - Replication & Sharding 29.11.2013 25 / 26

Literatur [Ban12] Banker, Kyle: MongoDB in Action. 20 Baldwin Road, PO Box 261, Shelter Island, NY 11964, USA : Manning Publications Co., 2012. 288 S. ISBN 9781935182870. ebook edition (pdf) [Cho13] Chodorow, Kristina: MongoDB: The Definitive Guide. Second Edition. 1005 Gravenstein Highway North, Sebastopol, CA 95472, USA : O Reilly Media, Inc., 2013. 410 S. ISBN 9781449344689. ebook edition (pdf) [Mon13] MongoDB Documentation. Version: Release 2.4.8, 2013. http: //docs.mongodb.org/v2.4/mongodb-manual.pdf. ebook edition (pdf) Mirko Köster MongoDB - Replication & Sharding 29.11.2013 26 / 26