Preventing con!icts in Multi-master replication with Tungsten

Similar documents
Using Tungsten Replicator to solve replication problems

Solving Large-Scale Database Administration with Tungsten

How, What, and Where of Data Warehouses for MySQL

From Dolphins to Elephants: Real-Time MySQL to Hadoop Replication with Tungsten

Replicating to everything

Parallel Replication for MySQL in 5 Minutes or Less

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

Linas Virbalas Continuent, Inc.

Database Replication with MySQL and PostgreSQL

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

Database Replication with MySQL and PostgresSQL

Zero Downtime Deployments with Database Migrations. Bob Feldbauer

Real-time reporting at 10,000 inserts per second. Wesley Biggs CTO 25 October 2011 Percona Live

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

Synchronous multi-master clusters with MySQL: an introduction to Galera

High Availability Using MySQL in the Cloud:

Adding Indirection Enhances Functionality

Database Scalability {Patterns} / Robert Treat

Basics Of Replication: SQL Server 2000

Comparing MySQL and Postgres 9.0 Replication

Non-Stop for Apache HBase: Active-active region server clusters TECHNICAL BRIEF

Module 14: Scalability and High Availability

MySQL synchronous replication in practice with Galera

Future-Proofing MySQL for the Worldwide Data Revolution

Database Replication

High Availability Solutions for the MariaDB and MySQL Database

Neutron Monitor Database

The Future of PostgreSQL High Availability Robert Hodges - Continuent, Inc. Simon Riggs - 2ndQuadrant

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

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

Not Your Grandpa s Replication

Change Management for Rational DOORS User s Guide

MakeMyTrip CUSTOMER SUCCESS STORY

Speed, scale, query: can NoSQL give us all three? Arun Matthew Couchbase

ASYNCHRONOUS REPLICATION OF METADATA ACROSS MULTI-MASTER SERVERS IN DISTRIBUTED DATA STORAGE SYSTEMS. A Thesis

Apache Hadoop new way for the company to store and analyze big data

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

Linas Virbalas Continuent, Inc.

Informix Dynamic Server May Availability Solutions with Informix Dynamic Server 11

Practical Cassandra. Vitalii

What is Data Virtualization? Rick F. van der Lans, R20/Consultancy

The CAP theorem and the design of large scale distributed systems: Part I

Tungsten Replicator, more open than ever!

Informatica Data Replication

MySQL Comes of Age. Robert Hodges Sr. Staff Engineer Percona Live London November 4, VMware Inc. All rights reserved.

VMware Continuent. Benefits and Configurations TECHNICAL WHITE PAPER

Transactions and ACID in MongoDB

Cloud DBMS: An Overview. Shan-Hung Wu, NetDB CS, NTHU Spring, 2015

Scalability and Reliability Features of MySQL Connector/J

High Availability Solutions with MySQL

User Guide. You will be presented with a login screen which will ask you for your username and password.

D83167 Oracle Data Integrator 12c: Integration and Administration

HP Quality Center. Upgrade Preparation Guide

F1: A Distributed SQL Database That Scales. Presentation by: Alex Degtiar (adegtiar@cmu.edu) /21/2013

Availability Digest. What is Active/Active? October 2006

Using MySQL for Big Data Advantage Integrate for Insight Sastry Vedantam

Dave Stokes MySQL Community Manager

MySQL Cluster New Features. Johan Andersson MySQL Cluster Consulting johan.andersson@sun.com

Virtuoso Replication and Synchronization Services

/ Cloud Computing. Recitation 11 November 10 th and November 12 th, 2015

COSC 6397 Big Data Analytics. 2 nd homework assignment Pig and Hive. Edgar Gabriel Spring 2015

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

CatDV Pro Workgroup Serve r

Architectures Haute-Dispo Joffrey MICHAÏE Consultant MySQL

Portable Scale-Out Benchmarks for MySQL. MySQL User Conference 2008 Robert Hodges CTO Continuent, Inc.

Oracle Data Integrator for Big Data. Alex Kotopoulis Senior Principal Product Manager

What is Data Virtualization?

Personal Cloud. Support Guide for Mac Computers. Storing and sharing your content 2

High Availability and Scalability for Online Applications with MySQL

MySQL Replication. openark.org

Scaling up = getting a better machine. Scaling out = use another server and add it to your cluster.

Availability Digest. MySQL Clusters Go Active/Active. December 2006

Database Replication with Oracle 11g and MS SQL Server 2008

Firewall Server 7.2. Release Notes. What's New in Firewall Server 7.2

Pre Sales Communications

Appendix A Core Concepts in SQL Server High Availability and Replication

User Guide to the Content Analysis Tool

The Hadoop Distributed File System

MySQL és Hadoop mint Big Data platform (SQL + NoSQL = MySQL Cluster?!)

Module: Sharepoint Administrator

Oracle EXAM - 1Z Oracle Database 11g Release 2: SQL Tuning. Buy Full Product.

Hadoop and MySQL for Big Data

The MongoDB Tutorial Introduction for MySQL Users. Stephane Combaudon April 1st, 2014

RecoveryVault Express Client User Manual

Chapter 3 - Data Replication and Materialized Integration

Testing and Verifying your MySQL Backup Strategy

1Z0-117 Oracle Database 11g Release 2: SQL Tuning. Oracle

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

MySQL and Hadoop: Big Data Integration. Shubhangi Garg & Neha Kumari MySQL Engineering

Galera Replication. Synchronous Multi-Master Replication for InnoDB. ...well, why not for any other DBMS as well. Seppo Jaakola Alexey Yurchenko

MySQL always-up with Galera Cluster

Oracle Data Integrator 12c: Integration and Administration

Online Backup Linux Client User Manual

Extraction Transformation Loading ETL Get data out of sources and load into the DW

Flash Databases: High Performance and High Availability

Prepared By : Manoj Kumar Joshi & Vikas Sawhney

How to evaluate which MySQL High Availability solution best suits you

Comparing SQL and NOSQL databases

Online Backup Client User Manual

Transcription:

Preventing con!icts in Multi-master replication with Tungsten Giuseppe Maxia, QA Director, Continuent 1

Introducing Continuent The leading provider of clustering and replication for open source DBMS Our Product: Continuent Tungsten Clustering - Commercial-grade HA, performance scaling and data management for MySQL Replication - Open source, Flexible, highperformance data movement Continuent 2012 2

What is Tungsten Replicator? Open source drop-in replacement for MySQL replication, providing: Global transaction ID Multiple masters Multiple sources Flexible topologies Heterogeneous replication Parallel replication... and more 3

Tungsten Replicator Overview Master Download transactions via network Replicator THL (Transactions + Metadata) DBMS Logs Slave Replicator THL Apply using JDBC (Transactions + Metadata) Continuent 2012 4

Tungsten Replication Service Pipeline Stage Extract Filter Apply Stage Extract Filter Apply Stage Extract Filter Apply Master DBMS Transaction History Log In-Memory Queue Slave DBMS Continuent 2012 5

Multiple Services Per Replicator NYC Replicator Service nyc Replicator Frankfurt Replicator Service nyc Service fra Service fra London Continuent 2012 6

Multi-Master Replication Updates on 2+ sites (active-active mode) Enables geographic distribution of data No failover necessary if network fails or site becomes unavailable Not all applications can handle multi-master Applications must avoid con!icts Careful testing required Restoration of broken systems may not be easy Continuent 2012 7

Simple Multi-Master Con!guration NYC Replicator Replicator Frankfurt fra (slave) fra (master) nyc (master) nyc (slave) Database-to-Database Continuent 2012 8

Three-node Multi-Master Con!guration NYC Replicator fra (slave) Replicator fra (master) Frankfurt nyc (master) nyc (slave) lon (slave) lon (slave) Database-to-Database lon (master) fra (slave) London nyc (slave) Replicator Continuent 2012 9

multi-node star Con!guration NYC Replicator nyc (master) Replicator fra (master) Frankfurt lon (slave) lon (slave) lon (master) fra (slave) nyc (slave) Replicator sin (master) lon (slave) Singapore London (hub) sin (slave) Replicator Continuent 2012 10

CONFLICTS Continuent 2012 11

What's a con"ict Data modi!ed by several sources (masters) Creates one or more : data loss (unwanted delete) data inconsistency (unwanted update) duplicated data (unwanted insert) replication break 12

Data duplication 4 Matt 140 alpha id name amount 1 Joe 100 2 Frank 110 3 Sue 100 bravo charlie 4 Matt 130 BREAKS REPLICATION 13

auto_increment o#sets are not a remedy A popular recipe auto_increment_increment + auto_increment_offset They don't prevent con"icts They hide duplicates 14

Hidden data duplication 11 Matt 140 INSERT alpha o#set 1 id name amount 1 Joe 100 2 Frank 110 3 Sue 100 bravo o#set 2 INSERT charlie o#set 3 13 Matt 130 15

Data inconsistency 3 Sue 108 UPDATE alpha id name amount 1 Joe 100 2 Frank 110 3 Sue 100 bravo charlie UPDATE 3 Sue 105 16

Data loss 3 Sue 108 UPDATE alpha id name amount 1 Joe 100 2 Frank 110 3 Sue 100 bravo charlie DELETE record #3 MAY BREAK REPLICATION 17

con"ict handling strategies resolving after the fact Needs information that is missing in async replication avoiding requires synchronous replication with 2pc preventing setting and enforcing a split sources policy Transforming and resolving all records are converted to INSERTs used by Tungsten planned for future use con!icts are resolved within a given time window Continuent 2012 18

Tungsten Replicator Filters 19

Replicator Pipeline Architecture Tungsten Replicator Process Pipeline Stage Stage Stage Extract Assign Shard ID Apply Extract Apply Extract Apply Transaction History Log MySQL Binlog filter THL filter filter Slave DBMS

Restrict replication to some schemas and tables./tools/tungsten-installer \ --master-slave -a \... --svc-extractor-filters=replicate \ "--property=replicator.filter.replicate.do=test,*.foo" \... --start-and-report # test="test.*" -> same drawback as binlog-do-db in MySQL # *.foo = table 'foo' in any database # employees.dept_codes,employees.salaries => safest way 21

Multi-master: Con!ict prevention 22

Tungsten con"ict prevention in a nutshell 1. de!ne the rules (which master can update which database) 2. tell Tungsten the rules 3. de!ne the policy (error, drop, warn, or accept) 4. Let Tungsten enforce your rules 23

Tungsten Con"ict prevention facts Sharded by database De!ned dynamically Applied on the slave services methods: error: make replication fail drop: drop silently warn: drop with warning 24

Tungsten con"ict prevention applicability unknown shards The schema being updated is not planned actions: accept, drop, warn, error unwanted shards the schema is updated from the wrong master actions: accept, drop, warn, error whitelisted shards can be updated by any master 25

Con"ict prevention directives --svc-extractor-filters=shardfilter replicator.filter.shardfilter.unknownshardpolicy=error replicator.filter.shardfilter.unwantedshardpolicy=error replicator.filter.shardfilter.enforcehomes=false replicator.filter.shardfilter.allowwhitelisted=false 26

con"ict prevention in a star topology alpha updates employees A B A C C Host1 master: alpha database: employees Host3 master: charlie (hub) database: vehicles H m d H m d Host2 master: bravo database: buildings B C 27

con"ict prevention in a star topology alpha updates vehicles A C Host1 master: alpha database: employees H m d H m d A B C Host3 master: charlie (hub) database: vehicles Host2 master: bravo database: buildings B C 28

con"ict prevention in a all-masters topology alpha updates employees Host2 master: bravo database: buildings B A C B A B A C C Host1 master: alpha database: employees Host3 master: charlie (hub) database: vehicles H m d H m d 29

con"ict prevention in a all-masters topology charlie updates vehicles Host2 master: bravo database: buildings B A C B A B A C C Host1 master: alpha database: employees Host3 master: charlie (hub) database: vehicles H m d H m d 30

con"ict prevention in a all-masters topology alpha updates buildings Host2 master: bravo database: buildings B A C B A B A C C Host1 master: alpha database: employees Host3 master: charlie (hub) database: vehicles H m d H m d 31

con"ict prevention in a all-masters topology charlie updates employees Host2 master: bravo database: buildings B A C B A B A C C Host1 master: alpha database: employees Host3 master: charlie (hub) database: vehicles H m d H m d 32

setting con"ict prevention rules trepctl -host host1 -service charlie \ shard -insert < shards.map cat shards.map shard_id master critical personnel alpha false buildings bravo false vehicles charlie false test whitelisted false # charlie is slave service in host 1 33

setting con"ict prevention rules trepctl -host host2 -service charlie \ shard -insert < shards.map cat shards.map shard_id master critical personnel alpha false buildings bravo false vehicles charlie false test whitelisted false # charlie is slave service in host 2 34

setting con"ict prevention rules trepctl -host host3 -service alpha \ shard -insert < shards.map trepctl -host host3 -service bravo \ shard -insert < shards.map cat shards.map shard_id master critical personnel alpha false buildings bravo false vehicles charlie false test whitelisted false # alpha and bravo are slave services in host 3 35

Con"ict prevention demo reminder Server #1 can update "employees" Server #2 can update "buildings" Server #3 can update "vehicles" 36

Sample correct operation (1) mysql #1> create table employees.names(... ) # all servers receive the table # all servers keep working well 37

Sample correct operation (2) mysql #2> create table buildings.homes(... ) # all servers receive the table # all servers keep working well 38

Sample incorrect operation (1) mysql #2> create table employees.nicknames(... ) # Only server #2 receives the table # slave service in hub gets an error # slave service in #1 does not receive anything 39

sample incorrect operation (2) #3 $ trepct services simple_services alpha [slave] seqno: 7 - latency: 0.136 - ONLINE bravo seqno: [slave] -1 - latency: -1.000 - OFFLINE:ERROR charlie [master] seqno: 66 - latency: 0.440 - ONLINE 40

sample incorrect operation (3) #3 $ trepct -service bravo status NAME VALUE ---- ----- appliedlasteventid : NONE appliedlastseqno : -1 appliedlatency : -1.0 (...) offlinerequests : NONE pendingerror : Stage task failed: q-to-dbms pendingerrorcode : NONE pendingerroreventid : mysql-bin.000002:0000000000001241;0 pendingerrorseqno : 7 pendingexceptionmessage: Rejected event from wrong shard: seqno=7 shard ID=employees shard master=alpha service=bravo (...) 41

Fixing the issue mysql #1> drop table if exists employees.nicknames; mysql #1> create table if exists employees.nicknames (... ) ; #3 $ trepct -service bravo online -skip-seqno 7 # all servers receive the new table 42

Sample whitelisted operation mysql #2> create table test.hope4best(... ) mysql #1> insert into test.hope4best values (... ) # REMEMBER: 'test' was explicitly whitelisted # All servers get the new table and records # But there is no protection against conflicts 43

Parting thoughts We are hiring! http://continuent.com/about/careers 44

blog: http://datacharmer.blogspot.com twitter: @datacharmer Continuent Website: http://www.continuent.com Tungsten Replicator 2.0: http://tungsten-replicator.org Continuent 2012 45