MySQL HA Percona cluster @ MySQL Meetup Mumbai

Post on 06-Jul-2015

225 views 6 download

Tags:

description

Percona Cluster ( Galera ) is one of the best database solution that provides synchronous replication. The feature like automatic recovery, GTID and multi threaded replication makes it powerful along with ( XtraDB and Xtrabackup ). A good solution for MySQL HA.

Transcript of MySQL HA Percona cluster @ MySQL Meetup Mumbai

1

MySQL HA Solution - Percona Cluster

Agenda

• Need for HA• Principle of Distributed computing.• MySQL HA Solutions Available. • Introduction to Galera.• Percona Cluster.• Node Recovery.• Things to be considered.

2

3

• Senior MySQL DBA Yahoo!

• Focus MySQL HA and Sharding• MySQL Experience 4 Years• Student MS ( FOSS ) MIT • Blogger remotemysqldba.blogspot.in

About Myself : P.R.KarthiK

Need For HA

• Site Reliability • Failover • Disaster Recovery• Scheduled / Unscheduled downtime.• Avoid Single Point Failure

4

Principle of Distributed Computing

CAP Theorem

5

Principle of Distributed Computing

CAP Theorem

•Only Two out of three

AP – MySQL Replication

CA – Galera Cluster

6

MySQL HA Solutions Available

• Master – Slave• Master – Master• Single Writer• NDB Cluster ( MySQL )• Galera Cluster• Tungsten Replicator• Storage Level Replication ( DRDB)

7

Introduction To Galera

• Founded By Codership• Synchronous Replication• Parallel Replication• Multi-Threaded• Automated node recovery• Zero slave lag• Read/ Write Scalable• WAN Based Optimization.• A True Open Source.

8

Introduction To Galera

What is Galera ?

Galera is a replication plugin for the synchronous and multi-master replication to achieve HA.

“Wsrep_provider_options” controls library.

Percona ClusterMariaDB Cluster Used over MySQL

9

Introduction To Galera

• Shared nothing Architecture.• Network is the heart.

What is wsrep ? (Write Set REPlication )

It is an API to connect the Galera library and control characteristics. It helps to implement synchronous replication and certification based multi-master-replication.

10

Introduction To Galera

Simple Architecture

11

Percona Cluster

• Use Galera Library • XtraDB • Xtrabackup

+ +

12

Percona Cluster

Why Percona Server ?

•Enhanced InnoDB (XtraDB )•Performance Improvement•Xtrabackup ( Makes SST better )•A better MySQL

13

Transaction in Galera.

• Transaction is handled by Galera Plugin.• Uses traditional dual phase commit.• It also handles locking.• Uses the optimistic locking method.• The commits are based on certifications (keys).• Smaller transaction are always better. • Increase in network latency increases query time.

14

Transaction in Galera.

15

Transaction in Galera.

• Synchronous ( Virtual ) Replication.• Wsrep_causal_reads=ON ( true synchronous)• Auto_increment is handled by cluster.• Uses GTID for Transaction.

16

Node Recovery

17

• Node recovery is automated.• Validates the gcache for state files.• Chooses the State Transfer method

1) IST (Incremental State Transfer)

2)SST (State Snapshot Transfer )

Node Recovery

18

IST :•Recover from write sets in gcache.•Faster recovery method.•Have good gcache size.

Node Recovery

19

SST :

State Snapshot Transfer the complete transfer ( Cloning ) of data to recreate a node.

*when not in Gcache

*Adding a new node

Different Methods of SST

Xtrabackup (best ) , rsync , mysqldump .

Node Recovery

20

Validate Node after recovery

Wsrep_local_state_Comment

1)Joining

2)Donor/desynced

3)Joined

4)Synced

Things should be considered.

21

• Support only Transactional engines.• Row Based replication.• Read commited Isolation.• Innodb_autoinc_lock_mode=2.• Avoid huge transactions.• Wsrep_max_ws_rows (128K)• Wsrep_max_ws_size. (1G)• Network is the heart.• Keep the DB design simple

IMAGE Courtesy

•Galera and Percona cluster documentation•http://opentodo.net/2012/12/mysql-multi-master-replication-with-galera/

22

Queries ?

remotemysqldba.blogspot.in

23