Senior Solutions Architect, MongoDB Inc. Massimo Brignoli Introduction to Replication and Replica Sets.

Slides:



Advertisements
Similar presentations
A Ridiculously Easy & Seriously Powerful SQL Cloud Database Itamar Haber AVP Ops & Solutions.
Advertisements

© ViSolve.com All rights reserved. Privacy Statement April Oracle Disaster Recovery Implementation A Non-Technical Overview.
SQL Server AlwaysOn: Active Secondaries Luis Vargas Program Manager Microsoft Corporation DBI312.
1 Disk Based Disaster Recovery & Data Replication Solutions Gavin Cole Storage Consultant SEE.
Oracle Data Guard Ensuring Disaster Recovery for Enterprise Data
1 Cheriton School of Computer Science 2 Department of Computer Science RemusDB: Transparent High Availability for Database Systems Umar Farooq Minhas 1,
0 SQL Server AlwaysOn – SharePoint 2013 High Availability and Disaster Recovery Sal Bawany, Solutions Architect
FlareCo Ltd ALTER DATABASE AdventureWorks SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS Slide 1.
1 © Copyright 2010 EMC Corporation. All rights reserved. EMC RecoverPoint/Cluster Enabler for Microsoft Failover Cluster.
Turn on…. Calm restored …. Application within DC failure DC location failure Loss of access from / to your office location.
Implementing Failover Clustering with Hyper-V
National Manager Database Services
Installing and Setting up mongoDB replica set PREPARED BY SUDHEER KONDLA SOLUTIONS ARCHITECT.
Building Highly Available Systems with SQL Server™ 2005 Vineet Gupta Evangelist – Data and Integration Microsoft Corp.
Chapter 10 : Designing a SQL Server 2005 Solution for High Availability MCITP Administrator: Microsoft SQL Server 2005 Database Server Infrastructure Design.
High-Availability Methods Lesson 25. Skills Matrix.
Implementing Multi-Site Clusters April Trần Văn Huệ Nhất Nghệ CPLS.
© 2011 Cisco All rights reserved.Cisco Confidential 1 APP server Client library Memory (Managed Cache) Memory (Managed Cache) Queue to disk Disk NIC Replication.
Sofia, Bulgaria | 9-10 October SQL Server 2005 High Availability for developers Vladimir Tchalkov Crossroad Ltd. Vladimir Tchalkov Crossroad Ltd.
MODIFY THIS SLIDE FOR ACTUAL PRESENTER, DELETE THIS BAR AFTER MODIFICATION.
DATABASE MIRRORING  Mirroring is mainly implemented for increasing the database availability.  Is configured on a Database level.  Mainly involves two.
DB-2: OpenEdge® Replication: How to get Home in Time … Brian Bowman Sr. Solutions Engineer Sandy Caiado Sr. Solutions Engineer.
SQLintersection Session SQL37 SQL Server 2012 Availability Groups Aaron Bertrand
Site Power OutageNetwork Disconnect Node Shutdown for Patching Node Crash Quorum Witness Failure How do I make sure my Cluster stays up ??... Add/Evict.
Daniela Anzellotti Alessandro De Salvo Barbara Martelli Lorenzo Rinaldi.
Chapter 15 Recovery. Topics in this Chapter Transactions Transaction Recovery System Recovery Media Recovery Two-Phase Commit SQL Facilities.
Module 13 Implementing Business Continuity. Module Overview Protecting and Recovering Content Working with Backup and Restore for Disaster Recovery Implementing.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation MongoDB Architecture.
1 MONGODB: CH ADMIN CSSE 533 Week 4, Spring, 2015.
Fast Crash Recovery in RAMCloud. Motivation The role of DRAM has been increasing – Facebook used 150TB of DRAM For 200TB of disk storage However, there.
OSIsoft High Availability PI Replication
High Availability in DB2 Nishant Sinha
MongoDB: What, why, when. Solutions Architect, MongoDB Inc. Massimo Brignoli #mongodb.
Switching Topic 3 VTP. Agenda VTP basics Components Frames and advertisements Domains and revision numbers VTP operations VTP pruning VTP issues.
Alwayson Availability Groups
Enhancing Scalability and Availability of the Microsoft Application Platform Damir Bersinic Ruth Morton IT Pro Advisor Microsoft Canada
Replication Store it in multiple places.... Literature Colouris, Dollimore, Kindberg, 2000 –Gets deep into the details of reliable communication, byzantine.
Senior Solutions Architect, MongoDB Inc. Massimo Brignoli #MongoDB Introduction to Sharding.
Course Topics Administering SQL Server 2012 Jump Start 01 | Install and Configure SQL Server04 | Manage Data 02 | Maintain Instances and Databases05 |
Complete VM Mobility Across the Datacenter Server Virtualization Hyper-V 2012 Live Migrate VM and Storage to Clusters Live Migrate VM and Storage Between.
PI System High Availability : Interface Redundancy and Disconnected Interface Startup Andy Singh, Ph.D., OPC Team Tony Cantele, Uniint Team Leader.
Introduction to MongoDB. Database compared.
Virtual Machine Movement and Hyper-V Replica
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
VICTORIA UNIVERSITY OF WELLINGTON Te Whare Wananga o te Upoko o te Ika a Maui SWEN 432 Advanced Database Design and Implementation Cassandra Architecture.
SQL Server High Availability Introduction to SQL Server high availability solutions.
AlwaysOn In SQL Server 2012 Fadi Abdulwahab – SharePoint Administrator - 4/2013
OSIsoft High Availability PI Replication Colin Breck, PI Server Team Dave Oda, PI SDK Team.
Cassandra The Fortune Teller
Sponsors.
Business Continuity for Virtual SQL Servers
Configuration Manager Site Server High Availability
Navigating the options for Data Redundancy
Disaster Recovery Where to Begin
MongoDB Distributed Write and Read
Section 7 Erasure Coding Overview
A Technical Overview of Microsoft® SQL Server™ 2005 High Availability Beta 2 Matthew Stephen IT Pro Evangelist (SQL Server)
Always On Availability Groups
Senior Solutions Architect, MongoDB Inc.
How to Create Mac OS X Recovery Partition?
Required 9s and data protection: introduction to sql server 2012 alwayson, new high availability solution Santosh Balasubramanian Senior Program Manager.
SQL Azure Database – High Availability
VMware VM Replication for High Availability in Vembu VMBackup
Microsoft Azure P wer Lunch
Always On : Multi-site patterns
Ewen Cheslack-Postava
EECS 498 Introduction to Distributed Systems Fall 2017
ATC323 Architecting Highly Available, Geo-Redundant Cloud Solutions with Windows Azure Graham Elliott Asia Time Zone Director Global Technical Evangelism.
Setting up PostgreSQL for Production in AWS
Designing Database Solutions for SQL Server
Presentation transcript:

Senior Solutions Architect, MongoDB Inc. Massimo Brignoli Introduction to Replication and Replica Sets

Notes to the presenter Themes for this presentation: Balance between cost and redundancy. Cover the many scenarios which replication would solve and why. Secret sauce of avoiding downtime & data loss If time is short, skip 'Behind the curtain' section If time is very short, skip Operational Considerations also

Agenda Replica Sets Lifecycle Developing with Replica Sets Operational Considerations

Why Replication? How many have faced node failures? How many have been woken up from sleep to do a fail-over(s)? How many have experienced issues due to network latency? Different uses for data – Normal processing – Simple analytics

Replica Set Lifecycle

Replica Set – Creation

Replica Set – Initialize

Replica Set – Failure

Replica Set – Failover

Replica Set – Recovery

Replica Set – Recovered

Replica Set Roles & Configuration

Replica Set Roles

> conf = { _id : "mySet", members : [ {_id : 0, host : "A”, priority : 3}, {_id : 1, host : "B", priority : 2}, {_id : 2, host : "C”}, {_id : 3, host : "D", hidden : true}, {_id : 4, host : "E", hidden : true, slaveDelay : 3600} ] } > rs.initiate(conf) Configuration Options

> conf = { _id : "mySet”, members : [ {_id : 0, host : "A”, priority : 3}, {_id : 1, host : "B", priority : 2}, {_id : 2, host : "C”}, {_id : 3, host : "D", hidden : true}, {_id : 4, host : "E", hidden : true, slaveDelay : 3600} ] } > rs.initiate(conf) Configuration Options Primary DC

> conf = { _id : "mySet”, members : [ {_id : 0, host : "A”, priority : 3}, {_id : 1, host : "B", priority : 2}, {_id : 2, host : "C”}, {_id : 3, host : "D", hidden : true}, {_id : 4, host : "E", hidden : true, slaveDelay : 3600} ] } > rs.initiate(conf) Configuration Options Secondary DC Default Priority = 1

> conf = { _id : "mySet”, members : [ {_id : 0, host : "A”, priority : 3}, {_id : 1, host : "B", priority : 2}, {_id : 2, host : "C”}, {_id : 3, host : "D", hidden : true}, {_id : 4, host : "E", hidden : true, slaveDelay : 3600} ] } > rs.initiate(conf) Configuration Options Analytics node

> conf = { _id : "mySet”, members : [ {_id : 0, host : "A”, priority : 3}, {_id : 1, host : "B", priority : 2}, {_id : 2, host : "C”}, {_id : 3, host : "D", hidden : true}, {_id : 4, host : "E", hidden : true, slaveDelay : 3600} ] } > rs.initiate(conf) Configuration Options Backup node

Developing with Replica Sets

Strong Consistency

Delayed Consistency

Write Concern Network acknowledgement Wait for error Wait for journal sync Wait for replication

Unacknowledged

MongoDB Acknowledged (wait for error)

Wait for Journal Sync

Wait for Replication

Tagging Control where data is written to, and read from Each member can have one or more tags – tags: {dc: "ny"} – tags: {dc: "ny", subnet: " ", rack: "row3rk7"} Replica set defines rules for write concerns Rules can change without changing app code

{ _id : "mySet", members : [ {_id : 0, host : "A", tags : {"dc": "ny"}}, {_id : 1, host : "B", tags : {"dc": "ny"}}, {_id : 2, host : "C", tags : {"dc": "sf"}}, {_id : 3, host : "D", tags : {"dc": "sf"}}, {_id : 4, host : "E", tags : {"dc": "cloud"}}], settings : { getLastErrorModes : { allDCs : {"dc" : 3}, someDCs : {"dc" : 2}} } } > db.blogs.insert({...}) > db.runCommand({getLastError : 1, w : "someDCs"}) Tagging Example

Wait for Replication (Tagging)

Read Preference Modes 5 modes – primary (only) - Default – primaryPreferred – secondary – secondaryPreferred – Nearest When more than one node is possible, closest node is used for reads (all modes but primary)

Tagged Read Preference Custom read preferences Control where you read from by (node) tags – E.g. { "disk": "ssd", "use": "reporting" } Use in conjunction with standard read preferences – Except primary

Operational Considerations

Maintenance and Upgrade No downtime Rolling upgrade/maintenance – Start with Secondary – Primary last

Replica Set – 1 Data Center Single datacenter Single switch & power Points of failure: – Power – Network – Data center – Two node failure Automatic recovery of single node crash

Replica Set – 2 Data Centers Multi data center DR node for safety Can’t do multi data center durable write safely since only 1 node in distant DC

Replica Set – 3 Data Centers Three data centers Can survive full data center loss Can do w= { dc : 2 } to guarantee write in 2 data centers (with tags)

Behind the Curtain

Implementation details Heartbeat every 2 seconds – Times out in 10 seconds Local DB (not replicated) – system.replset – oplog.rs Capped collection Idempotent version of operation stored

> db.replsettest.insert({_id:1,value:1}) { "ts" : Timestamp( , 1), "h" : NumberLong(" "), "op" : "i", "ns" : "test.replsettest", "o" : { "_id" : 1, "value" : 1 } } > db.replsettest.update({_id:1},{$inc:{value:10}}) { "ts" : Timestamp( , 1), "h" : NumberLong(" "), "op" : "u", "ns" : "test.replsettest", "o2" : { "_id" : 1 }, "o" : { "$set" : { "value" : 11 } } } Op(erations) Log is idempotent

> db.replsettest.update({},{$set:{name : ”foo”}, false, true}) { "ts" : Timestamp( , 1), "h" : NumberLong(" "), "op" : "u", "ns" : "test.replsettest", "o2" : { "_id" : 2 }, "o" : { "$set" : { "name" : "foo" } } } { "ts" : Timestamp( , 2), "h" : NumberLong(" "), "op" : "u", "ns" : "test.replsettest", "o2" : { "_id" : 3 }, "o" : { "$set" : { "name" : "foo" } } } { "ts" : Timestamp( , 3), "h" : NumberLong(" "), "op" : "u", "ns" : "test.replsettest", "o2" : { "_id" : 1 }, "o" : { "$set" : { "name" : "foo" } } } Single operation can have many entries

Recent improvements Read preference support with sharding – Drivers too Improved replication over WAN/high-latency networks rs.syncFrom command buildIndexes setting replIndexPrefetch setting

Just Use It Use replica sets Easy to setup – Try on a single machine Check doc page for RS tutorials –

Questions?

Thank Massimo Brignoli