Galera Cluster New Features Deep Dive webinar

Preview:

DESCRIPTION

This Webinar was presented by Ralf Gebhardt, MariaDB Corporation Ab and Seppo Jaakola, Codership at 27. November 2014.

Citation preview

©"MariaDB"Corpora,on"Ab"

Galera"Cluster"Deep"Dive"Webinar"

"Seppo"Jaakola,"CEO"–"seppo.jaakola@codership.com"

Ralf"Gebhardt,"Sales"Engineer"I"ralf.gebhardt@mariadb.com"""

*" *"27.11.14 1

©"MariaDB"Corpora,on"Ab"

Agenda"

• Introduc,on"• MariaDB"Galera"Cluster"Essen,als"• Partner"presenta,on:"Codership"• MariaDB"Enterprise"and"MariaDB"Enterprise"Cluster"

27.11.14 2

©"MariaDB"Corpora,on"Ab"

MariaDB"Corpora,on"and"MariaDB"

• MariaDB"Corpora,on,"formerly"SkySQL"•  Strong"team"of"MariaDB/MySQL"experts"•  Provides"support"and"services"for""

MariaDB,"MySQL"and"derived"databases"•  Strong"Supporter"of"MariaDB"Founda,on"

• MariaDB"•  Compa,ble"with"MySQL"•  Superior"replica,on"and"scalability"for"cloud"•  Addresses"Big"Data"and"IoT"needs"•  MariaDB"is"becoming"the"leading"database"plaVorm"for"cloud"•  MariaDB"is"adopted"by"key"open"source"communi,es"

27.11.14 3

mariadb.com

©"MariaDB"Corpora,on"Ab"

MariaDB"Enterprise"An"Architecture"Of"Collabora,on"

27.11.14 4

Partner'Products'

Availability"

Management"

Scalability"

Backup"

Applica1on'

Storage Engines

Plug-Ins

Tools

Documentation

MaxScale'Proxy'

Connectors'

MariaDB'Enterprise'

Community'

©"MariaDB"Corpora,on"Ab"

Data"Redundancy"with"MariaDB"

• MariaDB"Internal"Replica,on"•  Asynchronous"•  SemiISynchronous"

• Storage"based"redundancy"(Ac,ve/Passive)"•  DRBD"(Distributed"Replicated"Block"Device)"•  SAN"(Storage"Area"Network)"

• VMWare"replica,on"• MariaDB'Galera'Cluster'

27.11.14 5

©"MariaDB"Corpora,on"Ab"

HA"using"MariaDB"Replica,on"

• This"is"in"many"cases"a"good"enough"solu,on,"but"it"has"some"issues"

• The"cluster"is"very"loosely"coupled,"not"all"nodes"are"aware"of"all"the"other"nodes"for"example"

• Replica,on"is"asynchronous,"so"failing"over"is"more"difficult"than"usually"

• Adding"a"slave"is"difficult"

27.11.14 6

●  Clustered MariaDB nodescooperate to remain in sync.

●  With multiple master nodes,reads and updates both scale.

●  Synchronous replication withoptimistic locking delivers high availability with little overhead.

●  Fast failover because all nodes remains synchronized.

●  Integrated and tested binaries. ●  Supported by MariaDB.

MariaDB Availability: Galera Cluster Synchronous HA Replication

Load Balancingand Failover

Application / App Server

©"MariaDB"Corpora,on"Ab"

RW Scalability, HA Failover: Galera Cluster + Connection Load Balancing

●  Applications can be simple, use one connection for reads and updates.

●  Using connection load balancing, MaxScale load balances connections to each node in the Galera Cluster, round-robin.

●  MaxScale monitors the cluster, routing requests only to fully synchronized nodes.

""

MaxScale

Technology Preview

©"MariaDB"Corpora,on"Ab"

Partner"Presenta,on:"Codership"

G a l e r a C l u s t e rNew Features

Seppo JaakolaCodership

2

www.galeracluster.com

Agenda

● Galera Cluster Release History

● Galera project

● Release 3.0 Features● WAN Replication● MySQL Replication Support

● Towards Galera 4

3

www.galeracluster.com

Galera Cluster

DBMS

wsrep provider

GCS framework

replication

wsrep hooks wsrep

Replication API

certification

vsbes gcommspread

Galera Plugin

dlopen

4

www.galeracluster.com

Galera Cluster

DBMS

wsrep provider

GCS framework

replication

wsrep hooks wsrep API

certification

vsbes gcommspread

Galera Plugin

5

www.galeracluster.com

Replication Plugin

Replication plugin is runtime loadable● Set global wsrep_provider=none;

● Set global wsrep_provider='/usr/lib/libgalera_smm.so';

With no replication plugin speci'ed, server should work as vanilla MySQL server

6

www.galeracluster.com

Galera Cluster Releases

Galera Cluster projects:

● Replication Interface (wsrep API)● De'nes the interface between DBMS and replication plugin

● Versioned by API level #1-25. Galera 3.0 uses #25

● Galera Replication Plugin● Latest API #25 version is 3.7

● Replication API implementation in MySQL server● 5.5.39-25.11 for MySQL 5.5

● 5.6.20-25.6 for MySQL 5.6

7

www.galeracluster.com

Roadmap to 3.0

20092009 20102010 20112011 2013201320122012 20142014

demo

8

www.galeracluster.com

Roadmap to 3.0

20092009 20102010 20112011 2013201320122012 20142014

demo

0.6GTID

9

www.galeracluster.com

Roadmap to 3.0

20092009 20102010 20112011 2013201320122012 20142014

demo

0.7DDL support

0.6GTID

10

www.galeracluster.com

Roadmap to 3.0

20092009 20102010 20112011 2013201320122012 20142014

demo

0.7DDL support

0.6GTID 0.8

Parallel replicationSST script API

mysqldump

rsync

xtrabackup

11

www.galeracluster.com

Roadmap to 3.0

20092009 20102010 20112011 2013201320122012 20142014

demo

0.7DDL support

0.6GTID 0.8

Parallel replicationSST script API

1.0Foreign keys

gcache

mysqldump

rsync

xtrabackup

1.1 ...1.2

12

www.galeracluster.com

Roadmap to 3.0

20092009 20102010 20112011 2013201320122012 20142014

demo

0.7DDL support

0.6GTID 0.8

Parallel replicationSST script API

1.0Foreign keys

gcache

2.0IST

TOI & RSUmysqldump

rsync

xtrabackup

1.1 ...1.2

2.1 ...2.7

13

www.galeracluster.com

Roadmap to 3.0

20092009 20102010 20112011 2013201320122012 20142014

demo

0.7DDL support

0.6GTID 0.8

Parallel replicationSST script API

1.0Foreign keys

gcache

2.0IST

TOI & RSU

3.0WAN

Async compatibility 3.1 ...3.7

mysqldump

rsync

xtrabackup

1.1 ...1.2

2.1 ...2.7

14

www.galeracluster.com

20 Galera Replication Plugin Releases since 2009

15

www.galeracluster.com

35 Galera Cluster for MySQL Releases since 2009

16

www.galeracluster.com

Galera Project

WSREP API

MySQLCommunity edition

Galera Replication Plugin

Galera Cluster for MySQL

17

www.galeracluster.com

Galera Project

WSREP API

MySQLCommunity edition

Galera Replication Plugin

Galera Cluster for MySQL

WSREP API

PerconaServer

merge

Percona XtraDB Cluster

18

www.galeracluster.com

Galera Project

WSREP API

MySQLCommunity edition

Galera Replication Plugin

Galera Cluster for MySQL

WSREP API

PerconaServer

merge

Percona XtraDB Cluster

WSREP API

MariaDB

merge

MariaDB Galera Cluster

19

www.galeracluster.com

Galera Project

WSREP API

MySQLCommunity edition

Galera Replication Plugin

Galera Cluster for MySQL

WSREP API

PerconaServer

Percona XtraDB Cluster

WSREP API

MariaDB

MariaDB Galera Cluster

R&DR&D

20

www.galeracluster.com

Galera R&D Community

A network of companies working around Galera technology

With Percona and MariaDB we have joint:● R&D, QA co-operation

● Roadmaps

● Feedback, feature requests

● Bug systems

R&D

21

www.galeracluster.com

Galera Cluster Community

● Steady growth for 3 years time span

● Monthly download rates constantly raising

● Presence in Linux distros makes community estimates fuzzy

● Good adoption in cloud installations, AWS, Openstack

22

www.galeracluster.com

Galera 3.0

Released Nov 2013, Featuring:

● Optimization for WAN replication● Cluster can be divided in segments based on location

● Asynchronous replication topologies● Async replication can be interleaved with Galera replication

● Support for MySQL 5.6 GTID

● New write set key format● Makes certi'cation faster

● A step towards huge transaction support

● A number of bug 'xes and minor improvements

23

www.galeracluster.com

A-1

WAN Replication 3.0

A-2 A-3

B-1

B-2 B-3

Data center A Data center B

● Replication between cluster segments go over one link only● Replication events will be distributed within each segment p2p

24

www.galeracluster.com

A-1

WAN Replication 3.0

A-2 A-3

B-1

B-2 B-3

Data center A Data center B

● Replication between segments go over one link only● Replication events will be distributed within each segment p2p● Segment gateways can change per transaction

25

www.galeracluster.com

Segment per Data Center

Segment 1 Segment 2

Segment 4Segment 3

26

www.galeracluster.com

Galera + MySQL Replication

Galera Cluster can operate both as MySQL master and MySQL slave

● MySQL master fail over in Galera Cluster has been challenging until now

● MySQL Slave operation has performance bottleneck

Galera 3.0 solves both these problems

27

www.galeracluster.com

MySQL Replication – Multi Source

Node1MySQL slave

MySQL replicationMySQL

master1

Node2MySQL slave

Node3MySQL master

MySQLmaster2

MySQL replication

MySQLslave

MySQL replication

GaleraReplication

28

www.galeracluster.com

MariaDB Multi Source Replication

All Galera nodes can replicate individually their local transactions to MariaDB slave

Multi Source replication interleaves the replication streams in the slave

Losing a node in cluster, does not trigger any needs for fail over

Zero admin solution for fan-out

29

www.galeracluster.com

MariaDB Multi Source Replication

Node1 Node2Node3

MariaDBslave

MariaDB replication

GaleraReplication

Client transactions

30

www.galeracluster.com

MariaDB Multi Source Replication

Node1 Node2Node3

MariaDBslave

MariaDB replication

GaleraReplication

Client transactions

Cluster remains healthySlave receives all transactions

31

www.galeracluster.com

Towards 4.0

1. 3.x Improvements● we will have constant back log of 3.0 issues to sort

out while 4.0 will be under development

2. Test system development● MySQL test suite integration

3. New Features● Some new features going in for 3.* releases

● Major uplift for 4.0 , feature set 'xed

● Feedback from community & partners

32

www.galeracluster.com

Galera Cluster QA

● Percona and MariaDB have QA teams testing PXC and MGC respectively

● PXC, MGC and GC QA have slightly diDerent methodologies and focus areas

● Codership has established QA team for testing the upstream Galera Cluster

● Philip Stoev (Random Query Generator) joining Codership QA

33

www.galeracluster.com

Galera Cluster QA

● Traditional cluster testing framework for testing failures and various “scenarios” in a cluster as a whole

● Regression testing for lessons learned with 'xed bugs

● MySQL Test Run (mtr) for feature testing

● Performance regression testing

● Code reviews

● Co-operation with Percona and MariaDB QA teams

34

www.galeracluster.com

New Features...

● Non Blocking DDL● Huge transactions by streaming replication● Optimized consistency alert shutdown

Galera 4.0

● Intelligent Donor selection● Cluster crash recovery● TokuDB support

Galera 3.*

v

v

v

35

www.galeracluster.com

Better Donor Selection Support

● SST donor is selected in random

● 4.0 SST “handshake” makes intelligent choice for donor picking:

● Favor donor who can provide IST● Favor proximity (segment)● Present already in Galera 3.6

● SST donor can be forced by wsrep_sst_donor

36

www.galeracluster.com

Engine Room Power Out

Node A Node CNode B

37

www.galeracluster.com

Engine Room Power Out

? ? ?

38

www.galeracluster.com

Engine Room Power Out

? ? ?

39

www.galeracluster.com

Engine Room Power Out

Node C

? ? Service mysql start –wsrep-new-cluster

40

www.galeracluster.com

Engine Room Power Out

Node A Node CNode B

Service mysql startService mysql start

41

www.galeracluster.com

Cluster Crash Recovery

● Engine room power out – use case

● If all nodes shutdown● New cluster must be started and 'rst node to elected

● This is manual operation

● Other nodes can join back automatically, either through IST or SST

42

www.galeracluster.com

Cluster Crash Recovery

● pc.recovery=ON

● Nodes maintain the group information in persistent storage

● After shutdown, the full group can start with same con'guration

43

www.galeracluster.com

Engine Room Power Out

Node A Node CNode B

PC PC PC

44

www.galeracluster.com

Engine Room Power Out

PC PC PC

45

www.galeracluster.com

reconcile

Engine Room Power Out

Node A Node CNode B

PC PC PC

46

www.galeracluster.com

Engine Room Power Out

Node A Node CNode B

PC PC PC

47

www.galeracluster.com

TokuDB Support

Initial TokuDB support has been pushed to MGC-10

● But: this is experimental only!● Master-slave model only (no conLict resolution)● Not safe for parallel applying

Benhmarking shows good performance for tokuDB, 3 node installation

Complete tokuDB support with Multi-Master capabilities requires more work in tokuDB lock manager

48

www.galeracluster.com

Huge Transaction Support

● Currently transaction processes in master node until commit time

● For large transactions, the write size will be big, and is hard to handle

● There are means to prevent too large transactions● wsrep_max_ws_rows

● wsrep_max_ws_size (not enforced atm)

49

www.galeracluster.com

Huge Transaction Replication

Huge transaction

Galera Replication

Node A Node B

Huge trx

50

www.galeracluster.com

Huge Transaction Replication

Huge transaction

Galera Replication

Node A Node B

Huge trx

51

www.galeracluster.com

Huge Transaction Replication

Huge transaction

Galera Replication

Node A Node B

Huge trx

Ws

commit

52

www.galeracluster.com

Huge Transaction Replication

Huge transaction

Galera Replication

Node A Node B

Huge trx

53

www.galeracluster.com

Huge Transaction Replication

Huge transaction

Galera Replication

Node A Node B

Huge trx

WS WS WS

54

www.galeracluster.com

Huge Transaction Support

● In Galera Cluster 4.0 ● Possible to replicate transactions of any size

● Transaction size limits will remain, cluster can still reject too large transactions

55

www.galeracluster.com

Optimizing Consistency Shutdown

● Current Policy for Inconsistency:

● For suspected inconsistency, cluster node will do emergency shutdown

● However, DDL failures are logged only as warnings

● Injected inconsistency in one node can cause all other nodes to shutdown

56

www.galeracluster.com

Inconsistency Shutdown

Galera Replication

Node A Node B Node C

Create table t1 (i int)

57

www.galeracluster.com

Inconsistency Shutdown

Galera Replication

Node A Node B Node C

Set wsrep_on=OFFInsert into t values (8)

t1 t1 t1

8

58

www.galeracluster.com

Inconsistency Shutdown

Node A Node B Node C

Set wsrep_on=ONDelete from t;

t1 t1 t1

8

Del 8

Del 8

59

www.galeracluster.com

Inconsistency Shutdown

Node A Node B Node C

t1 t1 t1

Set wsrep_on=ONDelete from t;

Del 8

Del 8

60

www.galeracluster.com

Optimizing Consistency Shutdown

● Galera Cluster 4.0 will optimize shutdowns due to suspected inconsistency

● Target is to shutdown minimal number of nodes

61

www.galeracluster.com

Non-Blocking DDL

Current DDL replication blocks whole cluster for the duration of DDL statement processing

Galera Cluster 4.0 has two developments:

1. Through TOI, but locking only aDected table

2. Rolling Schema Upgrade (RSU) optimized

62

www.galeracluster.com

Non-Blocking DDL - RSU

Galera Replication

Node.BNode.A Node.C

63

www.galeracluster.com

Non-Blocking DDL - RSU

Galera Replication

Node.BNode.A Node.C

desync

ALTER TABLE...

● High priority DDL● Not replicated

64

www.galeracluster.com

Non-Blocking DDL - TOI

ALTER TABLE t1

Node A Node B

65

www.galeracluster.com

Non-Blocking DDL - TOI

ALTER TABLE t1

WSseqno

Node A Node B

66

www.galeracluster.com

Non-Blocking DDL - TOI

ALTER TABLE t1

Node A Node B

ALTER t1ALTER t1

67

www.galeracluster.com

Non-Blocking DDL - TOI

ALTER TABLE t1

Node A Node B

ALTER t1ALTER t1

UPDATE t2

68

www.galeracluster.com

Non-Blocking DDL - TOI

ALTER TABLE t1

Node A Node B

ALTER t1ALTER t1

UPDATE t1

69

www.galeracluster.com

Non-Blocking DDL - TOI

ALTER TABLE t1

Node A Node B

ALTER t1ALTER t1

UPDATE t1

UPDATE t3

70

www.galeracluster.com

Non-Blocking DDL - TOI

ALTER TABLE t1

Node A Node B

ALTER t1ALTER t1

UPDATE t1

71

www.galeracluster.com

Non-Blocking DDL - TOI

UPDATE t4

Node A Node B

72

www.galeracluster.com

4

Happy Clustering :-)

Thank you for listening!

©"MariaDB"Corpora,on"Ab"

MariaDB"Services"

MariaDB"Enterprise:"Integra,ng"the"Complete"Solu,on"

MariaDB Enterprise

24/7 Support,Technical Services

Partner Products

Enterprise Products

MariaDB"Enterprise:""Choose"From"Two"Product"Subscrip,ons"

MariaDB Enterprise Everything you need: a packaged, enterprise RDBMS product based on the popular MariaDB open source project, along with robust technical services and support.

MariaDB Enterprise Cluster A highly available database cluster product that combines MariaDB with advanced, multi-master clustering, along with expert support for demanding production applications.

©"MariaDB"Corpora,on"Ab"

MariaDB"Enterprise"Subscrip,on"Offers"

27.11.14 13

MariaDB'Enterprise' MariaDB'Enterprise'Cluster'

Summary' Powerful"enterprise"data"management." Highly"available"database"cluster"for"the"most"demanding"use"cases."

Supported'Database'Pla=orms'

●  MariaDB"(Included)"●  MySQL"

●  MariaDB"Galera"Cluster"(Included)"●  MySQL"+"Galera"

Comprehensive'Benefits:'●  30'min.'support'response'

●  Unlimited'incidents'

●  Updates'and'bug'fixes'

●  Security'patches'

●  Advice,'hotHfixes'

●  Installa1on,'configura1on'help'

●  Email,'web,'remote'login'

●  Exclusive'content'

●  Roadmaps'

●  Op1onal'enterprise'products'

●  Op1onal'services'including'

Remote'DBA,'Consul1ng,'Training,'

Custom'Development'

✔' ✔'

Included'ThirdHparty'Products'

●  Monitoring:"MONyog"●  Query"Editor:"SQLyog"●  Backup:"XtraBackup,"Zmanda"Backup"

●  Cluster"Deployment,"Management""&"Monitoring":"SeveralNines"ClusterControl"

●  Monitoring:"MONyog"●  Query"Editor:"SQLyog"●  Backup:"XtraBackup,"Zmanda"Backup"

●  MariaDB Portal ○  https://mariadb.com/resources/mariadb-portal

●  MariaDB Enterprise ○  mariadb.com/products/mariadb-enterprise

●  MariaDB Enterprise Cluster ○  mariadb.com/products/mariadb-enterprise-cluster

●  Guides and White Papers ○  mariadb.com/resources/guides-whitepapers

●  Downloads ○  https://mariadb.com/resources/downloads

●  Contact Us ○  mariadb.com/about/contact

MariaDB Resources

©"MariaDB"Corpora,on"Ab"

Ques,ons?"

www.mariadb.com"www.facebook.com/mariadb.dbms"

www.twider.com/mariadb""

Recommended