multi-data center mysql with continuent tungsten · 4 key reasons for multi-data center mysql •...

33
Peter Boros, Consultant, Percona Robert Hodges, CEO, Continuent Percona Technical Webinars March 2, 2013 Multi-Data Center MySQL with Continuent Tungsten

Upload: others

Post on 04-Jul-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

Peter Boros, Consultant, Percona Robert Hodges, CEO, Continuent

Percona Technical Webinars March 2, 2013

Multi-Data Center MySQL with Continuent Tungsten

Page 2: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 2 www.continuent.com

About This Presentation

•  Why is multi-data center MySQL important?

•  How does Continuent Tungsten fill the gaps?

•  Demonstration •  Practical steps to multi-data center

MySQL

Page 3: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

Why is multi-data center MySQL important?

Robert Hodges

Page 4: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 4 www.continuent.com

Key reasons for multi-data center MySQL

•  High availability – Moving data away from problems

•  Performance – Moving data closer to users

•  Legal – Keeping data within some locations but not others

Page 5: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 5 www.continuent.com

HA Example – Amazon Failure

US-East-1 AZ AZ

AZ AZ

EU- West-1 AZ

AZ AZ US- West-1 AZ

AZ AZ AZ AZ AZ AZ AZ

Availability Zones Region

AZ AZ AZ AZ

EBS fails in a single availability zone

Page 6: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 6 www.continuent.com

HA Example – Amazon Failure

US-East-1 AZ AZ

AZ AZ

EU- West-1 AZ

AZ AZ US- West-1 AZ

AZ AZ AZ AZ AZ AZ AZ

Availability Zones Region

AZ AZ AZ AZ

Leading to failures within the region due to coupled Amazon services

Page 7: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 7 www.continuent.com

HA Example – Amazon Failure

US-East-1 AZ AZ

AZ AZ

EU- West-1 AZ

AZ AZ US- West-1 AZ

AZ AZ AZ AZ AZ AZ AZ

Availability Zones Region

AZ AZ AZ AZ

Leading to failure of tightly coupled applications in other regions

Page 8: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 8 www.continuent.com

Requirements for successful multi-DC MySQL

•  Local HA within geographic regions •  Failover •  Planned maintenance and upgrade

•  Advanced multi-site replication •  Flexible topologies •  Tolerant of faults and WAN latency •  Transaction filtering

•  Minimal changes to apps / migration

Page 9: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

How does Continuent Tungsten fill the gaps?

Robert Hodges

Page 10: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 10 www.continuent.com

Tungsten picks up where MySQL leaves off

•  Handle local DBMS server failures •  Perform maintenance while apps are

running •  Load balance SQL across DBMS •  Create disaster recovery sites •  Enable multi-master replication •  Replicate transactions in real-time to

other DBMS types

Page 11: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 11 www.continuent.com

Tungsten Cluster Architecture

Manager

db2

Manager

Replicator

db1

Manager

db3

Slave

Application Stack

Tungsten Connector

Application Stack

Tungsten Connector

Replicator Replicator

Slave Master

•  Off-the-shelf MySQL build

•  Async replicators

•  Peer-to-peer management

•  Network-based connectors

Page 12: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 12 www.continuent.com

How connectivity works •  Transparent: Implements

MySQL wire protocol

•  Runs anywhere on network

•  Routes transactions to master by default

•  Optional read/write splitting

•  Reads load-balanced across all slaves Manager

db2

Manager

db1

Slave

Application Stack

Tungsten Connector

Master

TCP/IP

Page 13: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 13 www.continuent.com

Graceful failover

Manager

db2

Manager

Replicator

db1

Manager

db3

Slave

Application Stack

Tungsten Connector

Application Stack

Tungsten Connector

Replicator Replicator

Slave Master

•  Triggered by command

•  Zero-data loss

•  Transparent to applications

•  Automatic reconfiguration

Page 14: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 14 www.continuent.com

Hard failover – MySQL crash

Manager

db2

Manager

db1

Manager

db3

Slave

Application Stack

Tungsten Connector

Application Stack

Tungsten Connector

Replicator Replicator

Slave Master

•  Triggered by automatic rules

•  Within seconds for MySQL crash

•  Up to 1 minute after host crash

•  Admin required for recovery

Shunned

Page 15: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 15 www.continuent.com

Hard failover – quorum loss

Manager

db2

Manager

db1

Manager

db3

Slave

Application Stack Application Stack

Tungsten Connector

Replicator Replicator

Slave Master

Tungsten Connector •  Managers

maintain quorum

•  Connectivity stops when lost

•  Works across Amazon AZs

•  …But not regions

Shunned

Failed Failed

Shunned Shunned

X X X X

Page 16: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 16 www.continuent.com

How replication works

Manager

•  Moves transactions between points

•  Can replicate between clusters

•  Can run multiple services

•  Global transaction IDs

•  Very flexible topologies

•  Transaction filtering Replicator

Replicator

Replicator

west

Replicator

Replicator

east DBMS

east

west

Page 17: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 17 www.continuent.com

Cross-site multi-master with independent clusters

Replicator

Replicator

west

west Replicator

Replicator

east east

west east

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

Normal operation

Page 18: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 18 www.continuent.com

Multi-master replicator failure

Replicator

Replicator

west

west Replicator

Replicator

east east

west east

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

Automatic rerouting after

replicator failure

Page 19: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 19 www.continuent.com

Multi-master node failure

Replicator

Replicator

west

west Replicator

Replicator

east east

west east

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

Automatic failover following

node failure

Page 20: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 20 www.continuent.com

Full site failure

Replicator

Replicator

west

west Replicator

Replicator

east east

west east

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

West site down for multiple days

Page 21: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 21 www.continuent.com

Cross-site primary/DR with composite data service

Replicator

Replicator

west Replicator

Replicator

east

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

Normal operation

us

Page 22: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 22 www.continuent.com

Composite service node failure

Replicator

Replicator

west Replicator

Replicator

east

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

Failover to slave node

us

Page 23: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 23 www.continuent.com

Composite service site failure

Replicator

Replicator

west Replicator

Replicator

east

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

Application Stack

Tungsten Connector Application Stack

Tungsten Connector

Manual failover to slave site

us

Page 24: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

Demonstration

Peter Boros

Page 25: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 25 www.continuent.com

Demo Architecture

Multi-Master Topology

EU-West-1

US-East-1 US-West-1

US-West-1 EU-West-1

Composite Data Service

World

Page 26: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

Practical steps to multi-data center MySQL

Robert Hodges

Page 27: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 27 www.continuent.com

Setting Up Multi-DC Clustering

•  Tungsten tpm – Sets up local clusters and replication links between them

1.  Put tungsten.ini file on host 2.  Download software (rpm or tarball) 3.  Run ‘tpm install’

Page 28: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 28 www.continuent.com

Ini File for Composite Service [defaults]!home-directory=/opt/continuent!user=tungsten!replication-user=tungsten!replication-password=password!application-user=sbtest!application-password=sbtest!mysql-connectorj-path=/home/tungsten/mysql-connector-java-5.1.26-bin.jar!start-and-report=true![eu]!master=tw-eu1!slaves=tw-eu2,tw-eu3!connectors=tw-eu1,tw-eu2,tw-eu3![west]!master=tw-usw1!relay-enabled=true!relay-source=eu!slaves=tw-usw2,tw-usw3!connectors=tw-usw1,tw-usw2,tw-usw3![world]!composite-datasources=eu,west!

Page 29: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 29 www.continuent.com

Composite Data Services – Pros and Cons

•  Key benefits: •  No conflicts •  No app changes •  Failover is transparent •  Works with statement replication

•  Things to consider and test: •  High latency writes to primary master •  Managing unplanned site failover •  Potential coupling between sites

Page 30: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 30 www.continuent.com

Multi-Master Data Services – Pros and Cons

•  Key benefits •  Sites are completely uncoupled •  No failover! •  Minimal write latency

•  Things to consider and test carefully: •  Potential for conflicts •  App changes often required •  Row replication strongly recommended

Page 31: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 31 www.continuent.com

Workloads that handle multi-master very well

•  Append-only data

•  Tables that use only auto-increment keys

•  Sharded apps where writes to each shard are in a particular region (system of record)

Page 32: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 32 www.continuent.com

Where to get started

•  Cluster and replication documentation •  https://docs.continuent.com

•  Software •  https://code.google.com/p/tungsten-

replicator/ •  http://www.continuent.com/downloads/

software •  Percona and Continuent Websites

Page 33: Multi-Data Center MySQL with Continuent Tungsten · 4 Key reasons for multi-data center MySQL • High availability – Moving data away from problems • Performance – Moving data

www.percona.com 33 www.continuent.com

Peter Boros [email protected]

Robert Hodges

[email protected]

Thank You!

www.percona.com www.continuent.com