Galera cluster - SkySQL Paris Meetup 17.12.2013

34
Codership is there to secure our customers’ invaluable data. We do this by providing high availability, no-data-loss and scalable data replication and clustering solutions for open source databases.

description

Galera cluster - Sakari Keskitalo at the SkySQL Paris Meetup 17.12.2013

Transcript of Galera cluster - SkySQL Paris Meetup 17.12.2013

Page 1: Galera cluster - SkySQL Paris Meetup 17.12.2013

Codership is there to secure our customers’ invaluable data. We do this by providing high availability, no-data-loss and

scalable data replication and clustering solutions for open source databases.

Page 2: Galera cluster - SkySQL Paris Meetup 17.12.2013

2www.codership.com

What is the Meaning of Galera ?

Turns out it has different semantics in:● Italy● Uruguay● Brazil● Spain, Portugal, Russia...

Page 3: Galera cluster - SkySQL Paris Meetup 17.12.2013

3www.codership.com

Galera in Italy

Che cosa significa la parola galera?

Jail / Prison

Page 4: Galera cluster - SkySQL Paris Meetup 17.12.2013

4www.codership.com

Galera in Uruguay

Que significaca galera en Uruguai?

Traditional tall hat

Page 5: Galera cluster - SkySQL Paris Meetup 17.12.2013

5www.codership.com

Galera in Brazil

A Group of Happy People

Page 6: Galera cluster - SkySQL Paris Meetup 17.12.2013
Page 7: Galera cluster - SkySQL Paris Meetup 17.12.2013

7www.codership.com

Galera in Spain, Portugal, Russia...

Galley

Page 8: Galera cluster - SkySQL Paris Meetup 17.12.2013

8www.codership.com

Asynchronous Replication

Can be a mess....

Page 9: Galera cluster - SkySQL Paris Meetup 17.12.2013

9www.codership.com

Synchronous Replication

That's more like it !!

Page 10: Galera cluster - SkySQL Paris Meetup 17.12.2013

10www.codership.com

MariaDB

Synchronous Multi-Master Replication

Galera Replication

Page 11: Galera cluster - SkySQL Paris Meetup 17.12.2013

11www.codership.com

MariaDB MariaDB

Synchronous Multi-Master Replication

Galera Replication

There can be several nodes

Page 12: Galera cluster - SkySQL Paris Meetup 17.12.2013

12www.codership.com

MariaDB MariaDB MariaDB

Synchronous Multi-Master Replication

Galera Replication

There can be several nodes

Nodes can be added on the fly

Page 13: Galera cluster - SkySQL Paris Meetup 17.12.2013

13www.codership.com

MySQL MySQL MySQL

Synchronous Multi-Master Replication

Galera Replication

Client can connect to any node

There can be several nodes

Nodes can be added on the fly

Page 14: Galera cluster - SkySQL Paris Meetup 17.12.2013

14www.codership.com

MariaDB MariaDB MariaDB

Synchronous Multi-Master Replication

Galera Replication

Client can connect to any node

There can be several nodes

read & write read & write read & write Read & write access to any node

Nodes can be added on the fly

Page 15: Galera cluster - SkySQL Paris Meetup 17.12.2013

15www.codership.com

MariaDB MariaDB MariaDB

Synchronous Multi-Master replication

Galera ReplicationReplication is synchronous

read & write read & write read & write

Client can connect to any node

Each node have identical data

Read & write access to any node

Add nodes on the fly

There can be several nodes

Page 16: Galera cluster - SkySQL Paris Meetup 17.12.2013

16www.codership.com

MariaDB

Multi-Master Replication

Multi-master cluster looks like one big database with multiple entry points

read & write read & write read & write

Page 17: Galera cluster - SkySQL Paris Meetup 17.12.2013

17www.codership.com

MariaDB MariaDB MariaDB

Synchronous Replication

aGalera Replication

Read & write

Transaction is processed locally up to commit time

Page 18: Galera cluster - SkySQL Paris Meetup 17.12.2013

18www.codership.com

MariaDB MariaDB MariaDB

Synchronous Replication

Galera Replication

commit

Transaction's write set is replicated to whole cluster

Slave queueSlave queue

Page 19: Galera cluster - SkySQL Paris Meetup 17.12.2013

19www.codership.com

Galera Replication

MariaDB MariaDB MariaDB

Synchronous Replication

OK

Client gets OK status

Slave queueSlave queue

Page 20: Galera cluster - SkySQL Paris Meetup 17.12.2013

20www.codership.com

Galera Replication

MariaDB MariaDB MariaDB

Synchronous Replication

Transaction is applied in slaves

Slave queueSlave queue

Page 21: Galera cluster - SkySQL Paris Meetup 17.12.2013

21www.codership.com

MariaDB MariaDB MariaDB

How node failures are handled

a

Galera Replication

Load Balancing

Page 22: Galera cluster - SkySQL Paris Meetup 17.12.2013

22www.codership.com

MariaDB MariaDB MariaDB

Quorum, handling the failure

a

Galera Replication

Load Balancing

● Galera uses quorum based failure handling:

– When cluster partitioning is detected, the majority partition "has quorum" and can continue

– A minority partition cannot commit transactions, but will attempt to re-connect to primary partition

– Note: 50% is not majority!=> Minimum 3 nodes recommended.

● Load balancer will notice errors & remove node from pool

Page 23: Galera cluster - SkySQL Paris Meetup 17.12.2013

23www.codership.com

Galera ReplicationA

Optimistic Concurrency Control

commit

Trx A

B

commit

Trx B

Page 24: Galera cluster - SkySQL Paris Meetup 17.12.2013

24www.codership.com

Optimistic Concurrency Control

●Transactions process independently in each cluster node

●Transaction write sets will be replicated at commit time (before commit)

●Cluster wide conflicts will be resolved and conflict victim must rollback

Optimistic Concurrency Control

Page 25: Galera cluster - SkySQL Paris Meetup 17.12.2013

25www.codership.com

MariaDB

Parallel Replication

Slave queue

Slave thd Slave thd

Slave control

Any number of slave applier threads can be started

Slave control assigns write sets for slave appliers

Slave control is on ROW level

Only applying is parallel, commit order is dictated

Page 26: Galera cluster - SkySQL Paris Meetup 17.12.2013

26www.codership.com

Galera Cluster benefits

➢ Synchronous multi-master cluster➢ no data loss➢ no slave lag➢ No complex slave failover

➢ For MySQL/MariaDB InnoDB➢ No single point of failure

Page 27: Galera cluster - SkySQL Paris Meetup 17.12.2013

27www.codership.com

Galera Cluster benefits

➢ Good Performance and scalability➢ Optimistic concurrency control➢ Parallel Replication➢ Optimized Group Communication

➢ 99.99% transparent➢ InnoDB look & feel

➢ Automatic node joining➢ Works in LAN / WAN / Cloud

Page 28: Galera cluster - SkySQL Paris Meetup 17.12.2013

28www.codership.com

Codership Company

● Established 2007 ● Three MySQL Clusters before Galera

Cluster● Open source + support sales● Active community, hundreds of users● Latest release 3.1 Galera Cluster● MariaDB Galera Cluster 5.5.33

Page 29: Galera cluster - SkySQL Paris Meetup 17.12.2013

29

Who is using Galera?

Page 30: Galera cluster - SkySQL Paris Meetup 17.12.2013

Mercadolibre OpenStack Galera deployment

If you live in Latin America (and even if you don't) you most likely know the online trading platform

MercadoLibre. MercadoLibre is where 58 million consumers in Argentina, Brazil, Chile, Colombia,

Ecuador, Mexico, Peru, Uruguay, and Venezuela go to buy and sell. Among the world's e-commerce market

leaders, MercadoLibre was recognized in 2010 as one of the top 30 world's hottest brands.

Page 31: Galera cluster - SkySQL Paris Meetup 17.12.2013

31www.codership.com

Galera Project

MySQL

MariaDBmerge

merge

MySQL Community Edition

MariaDBGalera Cluster for MySQL

MariaDB FeaturesAPI

MySQL

Galera Replication plugin

Page 32: Galera cluster - SkySQL Paris Meetup 17.12.2013

32www.codership.com

Galera Project

API

Galera Replication plugin

API

MariaDB

MySQL Community Edition

MariaDB Galera Cluster

MySQL

Galera Cluster for MySQL

merge

Galera Replication plugin

MySQL

Page 33: Galera cluster - SkySQL Paris Meetup 17.12.2013

33www.codership.com

Galera Support

CodershipLevel 3 support, Galera

MontyProgramLevel 3 Support, MariaDB

GaleraCluster

MariaDBGaleraCluster

SkySQLSupport Subscriptions

Page 34: Galera cluster - SkySQL Paris Meetup 17.12.2013

More info www.codersip.com

[email protected]