Zero Downtime Deployments with Database Migrations. Bob Feldbauer twitter: @bobfeldbauer email: bob.feldbauer@timgroup.com



Similar documents
High Availability and Scalability for Online Applications with MySQL

Database Replication with MySQL and PostgreSQL

Adding Indirection Enhances Functionality

MySQL High Availability Solutions. Lenz Grimmer OpenSQL Camp St. Augustin Germany

High Availability Solutions for the MariaDB and MySQL Database

MySQL Replication. openark.org

Enabling Database-as-a-Service (DBaaS) within Enterprises or Cloud Offerings

Database Replication with MySQL and PostgresSQL

Basics Of Replication: SQL Server 2000

Solving Large-Scale Database Administration with Tungsten

High Availability Solutions for MySQL. Lenz Grimmer DrupalCon 2008, Szeged, Hungary

MySQL Security for Security Audits

How To Upgrade To Symantec Mail Security Appliance 7.5.5

Achieving Zero Downtime and Accelerating Performance for WordPress

Architectures Haute-Dispo Joffrey MICHAÏE Consultant MySQL

MySQL synchronous replication in practice with Galera

Tushar Joshi Turtle Networks Ltd

Postgres Plus xdb Replication Server with Multi-Master User s Guide

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

Real-time Data Replication

YouTube Vitess. Cloud-Native MySQL. Oracle OpenWorld Conference October 26, Anthony Yeh, Software Engineer, YouTube.

MySQL Storage Engines

DBdeployer. About the Speaker: CJ Estel, Operations Database Engineer CoverMyMeds

The Evolution of Database Management Systems

Comparing MySQL and Postgres 9.0 Replication

MySQL for Beginners Ed 3

Database Administration with MySQL

Using SAS as a Relational Database

Would-be system and database administrators. PREREQUISITES: At least 6 months experience with a Windows operating system.

AOL CUSTOMER SUCCESS STORY

Percona Server features for OpenStack and Trove Ops

ScaleArc for SQL Server

MySQL/MariaDB Multi-Master Replication & Failover

Database Resilience at ISPs. High-Availability. White Paper

Dave Stokes MySQL Community Manager

Geodatabase Programming with SQL

Migration Scenario: Migrating Backend Processing Pipeline to the AWS Cloud

Evolution of Web Application Architecture International PHP Conference. Kore Nordmann / <kore@qafoo.com> June 9th, 2015

W I S E. SQL Server 2012 Database Engine Technical Update WISE LTD.

MySQL Security: Best Practices

Scalability of web applications. CSCI 470: Web Science Keith Vertanen

ibolt V3.2 Release Notes

Intro to Databases. ACM Webmonkeys 2011

MarkLogic Server. Database Replication Guide. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

Preparing for the Big Oops! Disaster Recovery Sites for MySQL. Robert Hodges, CEO, Continuent MySQL Conference 2011

Migrating from Legacy to New Business Solutions

5 Percona Toolkit tools that could save your day. Stéphane Combaudon FOSDEM February 3rd, 2013

Configuring the Redundancy Feature in a KIRK Wireless Server Application Note

Real World Enterprise SQL Server Replication Implementations. Presented by Kun Lee

Configuring the Redundancy Feature in a Polycom KIRK Wireless Server 6000

Redundant Storage Cluster

ScaleArc idb Solution for SQL Server Deployments

Comparing Microsoft SQL Server 2005 Replication and DataXtend Remote Edition for Mobile and Distributed Applications

How SourceForge is Using MongoDB

Vormetric Data Security

news from Tom Bacon about Monday's lecture

SQL Remote. Version January Copyright 2012, ianywhere Solutions, Inc. - SQL Anywhere

SQL Server for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach

ATTACHMENT 6 SQL Server 2012 Programming Standards

An Oracle White Paper March Best Practices for Real-Time Data Warehousing

Agenda Hi-Media Activities Tool Set for production Replication and failover Conclusion. 2 years of Londiste. Dimitri Fontaine.

Implementing a Data Warehouse with Microsoft SQL Server 2012

SQL Server Replication Guide

Scaling DBMail with MySQL

Top 10 Reasons why MySQL Experts Switch to SchoonerSQL - Solving the common problems users face with MySQL

Upgrading Your SQL Server 2000 Database Administration (DBA) Skills to SQL Server 2008 DBA Skills Course 6317A: Three days; Instructor-Led

MOC Administering Microsoft SQL Server 2014 Databases

High Availability Design Patterns

Networking and High Availability

Microsoft SQL Database Administrator Certification

SPARX SYSTEMS ENTERPRISE ARCHITECT GOES CLOUD USING MICROSOFT AZURE AND MICROSOFT SQL AZURE VERSION 2.1

MySQL. Leveraging. Features for Availability & Scalability ABSTRACT: By Srinivasa Krishna Mamillapalli

Linas Virbalas Continuent, Inc.

Getting Started with Attunity CloudBeam for Azure SQL Data Warehouse BYOL

Websense Support Webinar: Questions and Answers

Designing, Optimizing and Maintaining a Database Administrative Solution for Microsoft SQL Server 2008

IBM Campaign Version-independent Integration with IBM Engage Version 1 Release 3 April 8, Integration Guide IBM

Shadowbase Data Replication Solutions. William Holenstein Senior Manager of Product Delivery Shadowbase Products Group

Database as a Service (DaaS) Version 1.02

<Insert Picture Here> Oracle Web Cache 11g Overview

Course Outline: Course 6317: Upgrading Your SQL Server 2000 Database Administration (DBA) Skills to SQL Server 2008 DBA Skills

$99.95 per user. SQL Server 2005 Database Administration CourseId: 152 Skill level: Run Time: 30+ hours (158 videos)

Networking and High Availability

Preventing con!icts in Multi-master replication with Tungsten

Micro Focus Database Connectors

INTRODUCING ORACLE APPLICATION EXPRESS. Keywords: database, Oracle, web application, forms, reports

Design for Failure High Availability Architectures using AWS

MySQL 5.0 vs. Microsoft SQL Server 2005

AWS Schema Conversion Tool. User Guide Version 1.0

Firebird. A really free database used in free and commercial projects

MS Design, Optimize and Maintain Database for Microsoft SQL Server 2008

ADDING A NEW SITE IN AN EXISTING ORACLE MULTIMASTER REPLICATION WITHOUT QUIESCING THE REPLICATION

Implementing a Microsoft SQL Server 2005 Database

SQL Server 112 Success Secrets. Copyright by Martha Clemons

Workflow Templates Library

MS SQL Server 2014 New Features and Database Administration

MakeMyTrip CUSTOMER SUCCESS STORY

MONyog White Paper. Webyog

Overview of Databases On MacOS. Karl Kuehn Automation Engineer RethinkDB

Transcription:

Zero Downtime Deployments with Database Migrations Bob Feldbauer twitter: @bobfeldbauer email: bob.feldbauer@timgroup.com

Deployments Two parts to deployment: Application code Database schema changes (migrations, evolutions)

Deployments Two parts to deployment: Application code Database schema changes (migrations, evolutions) Zero downtime deployments for application code can be solved by load balancing and implementing a Blue-Green deployment pattern

Application Deployment Let s walk through a sample high-availability architecture for an application

Application Deployment Let s walk through a sample high-availability architecture for an application Incoming traffic hits a pair of HA load balancers Routed to a pair of HA web proxies Proxied to a pair of HA load balancers Routed to a pair of HA app servers in a Blue-Green versions (N, and N-1 respectively)

Application Deployment There s no problem here, as long as deployments only consist of application code Database schema changes that require locking the database are problematic

Application Deployment in zero downtime DB-world What if we could add a proxy in between the app and DB layer?

Application Deployment in zero downtime DB-world What if we could add a proxy in between the app and DB layer? A proxy allows us to switch between Active and Passive database servers

Application Deployment in zero downtime DB-world What if we could add a proxy in between the app and DB layer? A proxy allows us to switch between Active and Passive database servers What are our options? MySQL Proxy HAProxy Your favorite proxy

MySQL Replication basics Master records changes to its data in its binary log Slave copies the master s binary log events to its relay log Slave replays the events in its relay log and applies them Changes get written to the active server s binary log and flow through replication to the passive server s relay log. The passive server executes the query and writes the event to its own binary log (log_slave_updates=1). The active server retrieves the same change via replication into its own relay log, but ignores it because the server ID in the event matches its own.

Active/Passive MySQL Server Configuration Just make sure to set server-id to unique values for each and this is all you really need:

Zero downtime database migration process STOP SLAVE on both the Active and Passive servers Run SQL for database migration on the Passive server START SLAVE on the Active server Wait for replication lag on the Active server to become small, check with SHOW SLAVE STATUS "Seconds_Behind_Master" LOCK TABLES on the Active server for final replication catchup Ensure replication lag is zero on the Active server Modify your proxy configuration to change the Active/Passive designations Unlock the new Passive server START SLAVE on new Active server * basic implementation: 20 lines of Bash

Required schema modification rules Backwards compatible with previous schema Add new column with triggers rather than modifying in place New columns cannot be required immediately (for old writes to replicate) No use of server-generated data functions (UUID, NOW, RAND, etc) Cannot conflict with pending writes No auto-increment INSERT unless the app doesn't insert to that table No DROP COLUMN nor DELETE rows if used in previous schema Enforcement possibilities Test harness Reject at MySQL proxy

Resources High Performance MySQL, chapter 8: Replication http://codeascraft.etsy.com/2012/04/20/two-sides-forsalvation/ https://devblog.timgroup.com/ https://www.engineyard.com/blog/2011/zero-downtimedeploys-with-migrations/ Also, see http://mysql-mmm.org/ (Multi-Master Replication Manager for MySQL)