Você está na página 1de 53

Galera Replication

Release 1.0
Seppo Jaakola, Codership
Alexey Yurchenko, Codership

Contents
1.Galera Cluster
2.Advanced Features
3.Release 1.0
4.Benchmarking
5.Installation & Management
6.Summary
10/27/11

Codership @ PerconaLive London 2011

Galera Cluster
clients

MySQL

MySQL

MySQL

wsrep

wsrep

wsrep

G a l e r a R e p l i c a t i o n
10/27/11

Codership @ PerconaLive London 2011

Galera Cluster
clients
Transparent
connections

MySQL

MySQL

MySQL

wsrep

wsrep

wsrep

G a l e r a R e p l i c a t i o n
10/27/11

Codership @ PerconaLive London 2011

Galera Cluster
clients
Transparent
connections

MySQL

MySQL

MySQL

wsrep

wsrep

wsrep

Multimaster

G a l e r a R e p l i c a t i o n
10/27/11

Codership @ PerconaLive London 2011

Galera Cluster
clients
Reads
&
Writes

Reads
&
Writes

Reads
&
Writes

MySQL

MySQL

MySQL

wsrep

wsrep

wsrep

Transparent
connections
Multimaster

G a l e r a R e p l i c a t i o n
10/27/11

Codership @ PerconaLive London 2011

Galera Cluster
clients
Transparent
connections

MySQL

MySQL

MySQL

wsrep

wsrep

wsrep

G a l e r a R e p l i c a t i o n
10/27/11

Codership @ PerconaLive London 2011

Multimaster
Synchronous
replication
7

Galera Replication

Synchronous multi-master replication

No middle-ware, direct DBMS connections

Transparency

Row events, row level locking


Parallel Applying

10/27/11

High Availability

Write scalability
Codership @ PerconaLive London 2011

Galera Replication

Global Transaction ID
Failure Detection
Automatic node join/provisioning

10/27/11

Simple cluster management

Certification based replication method

Group Communication System


Codership @ PerconaLive London 2011

Advanced Features

Codership @ PerconaLive London 2011

Synchronous Replication
Client
commit

trx

wsrep

wsrep

wsrep

Galera Replication
10/27/11

Codership @ PerconaLive London 2011

11

Synchronous Replication
Transaction is replicated
in all nodes => HA

Client
commit

trx

wsrep

wsrep
WS

wsrep
WS

Galera Replication
10/27/11

Codership @ PerconaLive London 2011

12

Synchronous Replication
Client

Transaction is applied at later time


=> virtually synchronous

trx
wsrep

wsrep

trx
wsrep

Galera Replication
10/27/11

Codership @ PerconaLive London 2011

13

Certification Based Replication

10/27/11

Transactions process independently in


each cluster node
Transaction write sets will be replicated
at commit time
Cluster wide conflicts resolved by
certification test

Codership @ PerconaLive London 2011

14

Parallel Applying

10/27/11

Galera assigns non-conflicting WS tasks


to parallel appliers
Applier threads launched at MySQL
startup
Any number of appliers can be launched
Optimal applier count depends on work
load
Codership @ PerconaLive London 2011

15

Parallel Applying
MySQL
applier

applier

Pre-configured
applier threads

Replication
Applier control

WS

WS WS WS

Slave queue

certification
test

Group Communication
10/27/11

Codership @ PerconaLive London 2011

16

Global Transaction ID

10/27/11

Galera assigns Global Transaction ID for


all replicated transactions
Transactions can be uniquely referenced
in any node
Helps in provisioning new nodes

Codership @ PerconaLive London 2011

17

Node Provisioning

Automatic node joining

Cluster chooses 'donor' for the 'joiner'

State Snapshot Transfer

Scriptable interface, currently implemented:


mysqldump
rsync
Xtrabackup by Percona

10/27/11

Codership @ PerconaLive London 2011

18

Joining New Nodes


Install Galera

Clients
10.0.0.2

10.0.0.1
MySQL

MySQL

10.0.0.3

MySQL

GaleraReplication

A c t i v e
10/27/11

c l u s t e r
Codership @ PerconaLive London 2011

19

Joining New Nodes


Clients
10.0.0.3

10.0.0.2

10.0.0.1

SST Request
MySQL

GaleraReplication

A c t i v e
10/27/11

MySQL

MySQL

wsrep_cluster_address= 10.0.0.2

c l u s t e r
Codership @ PerconaLive London 2011

Joining node

20

Joining New Nodes


Clients
Donor node

Joiner node

1. mysqldump
MySQL

MySQL

MySQL

GaleraReplication

10/27/11

Codership @ PerconaLive London 2011

21

Joining New Nodes


Clients
Donor node
MySQL

MySQL

2. load

Joiner node
MySQL

GaleraReplication

10/27/11

Codership @ PerconaLive London 2011

22

Joining New Nodes


Clients

MySQL

MySQL

MySQL

GaleraReplication
A c t i v e
10/27/11

Catch up

WS

c l u s t e r

Codership @ PerconaLive London 2011

23

Joining New Nodes


Clients

MySQL

MySQL

MySQL

GaleraReplication
A c t i v e
10/27/11

c l u s t e r

Codership @ PerconaLive London 2011

24

Release 1.0

Codership @ PerconaLive London 2011

New Features

10/27/11

MySQL 5.5 Support

On-disk write set caching

Fully synchronous reads

SSL encrypted replication

Garbd lightweight arbitrator daemon


Codership @ PerconaLive London 2011

26

MySQL Support
MySQL 5.5

MySQL 5.1

Still actively maintained


Bug fixes

Percona Server

10/27/11

Development head, all new features go here

Developed by Percona
https://code.launchpad.net/~perconadev/percona
server/perconaservergalera5.5.15

Codership @ PerconaLive London 2011

27

On-disk Write Set Cache


All write sets are allocated in
mmapped files.
Full use of OS buffering, negligible
overhead.
Used in:

10/27/11

Node Provisioning
State Transfer
Rolling Schema update
Codership @ PerconaLive London 2011

28

On-disk Write Set Cache

Preallocated fixed-size ring buffer:


KEEPS SOME HISTORY FOR RECOVERY
AFTER SHORT CONNECTIVITY BREAKS OR
GRACEFUL RESTARTS

Additional dynamic pages if ring


buffer is too small:
DISK SPACE IS THE LIMIT

10/27/11

Codership @ PerconaLive London 2011

29

Synchronous Reads
Client
WRITE

READ

MySQL

MySQL

wsrep

wsrep

G a l e r a R e p l i c a t i o n
10/27/11

Codership @ PerconaLive London 2011

30

Encrypted Replication

TLS/SSL v3 support added in 0.8.2


release

Whole cluster replicated either in plain


text or through encryption

VPN tunneling is optimal for data center


linking

10/27/11

Codership @ PerconaLive London 2011

31

Split-Brain

SYNCED
MASTER

10/27/11

BY REPLICATION

Codership @ PerconaLive London 2011

MASTER

32

Split-Brain

10/27/11

X
Codership @ PerconaLive London 2011

33

Galera Arbitrator (garbd)

Resolves split-brain

Stateless

Can be strategically placed to improve


quorum resolution odds.

10/27/11

Codership @ PerconaLive London 2011

34

WAN Replication
Client

garbd

Client

SSL

Data Center 1

10/27/11

Data Center 2

Codership @ PerconaLive London 2011

35

Benchmarking

Codership @ PerconaLive London 2011

Benchmarking

Tested with several benchmarks


Sysbench, dbt2, DOTS, osdb, jmeter,
sqlgen...

10/27/11

Tested with 'physical hardware' and with


Amazon EC2 instances
In general, shows good scalability even
with write intensive work loads
Codership @ PerconaLive London 2011

37

Scale Out: Throughput

10/27/11

Codership @ PerconaLive London 2011

38

Installation & Management

Codership @ PerconaLive London 2011

Installing MySQL/Galera

Download from www.codership.com

Distributions choices:
1.Pre-built RPM or Debian package
2.demo tar distribution
3.Source build

10/27/11

Codership @ PerconaLive London 2011

40

Demo Distribution

10/27/11

Pre-built 32/64 bit linux binaries


Installs in one directory path
Contains a sample database
Good for testing/evaluation

Codership @ PerconaLive London 2011

41

wsrep Variables
mysql>showvariableslike'wsrep%';
+++
|Variable_name|Value|
+++
|wsrep_auto_increment_control|OFF|
|wsrep_certify_nonPK|OFF|
|wsrep_cluster_address|gcomm://?gmcast.listen_addr=tcp://127.0.0.1:4568|
|wsrep_cluster_name|my_wsrep_cluster|
|wsrep_convert_LOCK_to_trx|OFF|
|wsrep_data_home_dir|/codership/data/galeranode1/|
|wsrep_dbug_option||
|wsrep_debug|OFF|
|wsrep_drupal_282555_workaround|OFF|
|wsrep_local_cache_size|20971520|
|wsrep_max_ws_rows|65636|
|wsrep_max_ws_size|0|
|wsrep_node_incoming_address|10.1.198.1:3307|
|wsrep_node_name|node1|
|wsrep_notify_cmd||
|wsrep_on|ON|
|wsrep_provider|/codership/node1/mysql5.1.52/galera/lib/libmmgalera++.so|
|wsrep_provider_options||
|wsrep_retry_autocommit|OFF|
|wsrep_slave_threads|1|
|wsrep_sst_auth|test:testpass|
|wsrep_sst_donor||
|wsrep_sst_method|mysqldump|
|wsrep_sst_receive_address|AUTO|
|wsrep_start_position|00000000000000000000000000000000:1|
|wsrep_ws_persistency|OFF|
10/27/11
Codership @ PerconaLive London 2011
+++

42

wsrep Status
|wsrep_local_state_uuid|a398eaf82aba11e00800432d0098b829|
|wsrep_last_committed|2989366|
|wsrep_replicated|122|
|wsrep_replicated_bytes|161514094|
|wsrep_received|0|
|wsrep_received_bytes|0|
|wsrep_local_commits|110|
|wsrep_local_cert_failures|0|
|wsrep_local_bf_aborts|0|
|wsrep_local_replays|0|
|wsrep_local_send_queue|0|
|wsrep_local_send_queue_avg|0.007752|
|wsrep_local_recv_queue|0|
|wsrep_local_recv_queue_avg|0.000000|
|wsrep_flow_control_paused|0.000000|
|wsrep_flow_control_sent|0|
|wsrep_flow_control_recv|0|
|wsrep_cert_deps_distance|1.750000|
|wsrep_apply_oooe|0.000000|
|wsrep_apply_oool|0.000000|
|wsrep_apply_window|1.000000|
|wsrep_local_state|4|
|wsrep_local_state_comment|Synced(6)|
|wsrep_cluster_conf_id|4|
|wsrep_cluster_size|2|
|wsrep_cluster_state_uuid|a398eaf82aba11e00800432d0098b829|
|wsrep_cluster_status|Primary|
|wsrep_local_index|1|
10/27/11
Codership @ PerconaLive London 2011
|wsrep_ready|ON|

43

Severalnines ClusterControl
Severalnines has developed Galera
support for the ClusterControl tool for:

10/27/11

Configurator
Monitoring
Management

Install in a separate management server

Codership @ PerconaLive London 2011

44

ClusterControl - Configurator
1.Fill your architecture specs in:
http://www.severalnines.com/galeraconfigurator

You'll get a tarball in mail,


2.Untar and run deploy script
3.Sit back and relax

10/27/11

Codership @ PerconaLive London 2011

45

10/27/11

Codership @ PerconaLive London 2011

46

10/27/11

Codership @ PerconaLive London 2011

47

10/27/11

Codership @ PerconaLive London 2011

48

ClusterControl
Use in management server:

10/27/11

Monitor to visualize the cluster state


Manage your cluster

Monitor/manage cluster as a whole

Codership @ PerconaLive London 2011

49

Summary

Codership @ PerconaLive London 2011

Galera Support

Codership offers support services for


MySQL/Galera users
We are building support partner network
with local support providers

10/27/11

Local timezone
Local Language & Culture
Codership on level 3 support to back up

FromDual starting now


Codership @ PerconaLive London 2011

51

Summary
Galera is Replication Redefined

Severalnines ClusterControl

ease of use experience

Support available

10/27/11

No slave lag, no lost transactions


Native InnoDB look & feel
Ultimate performance
WAN/LAN/Cloud

FromDual
Codership @ PerconaLive London 2011

52

R&D consulting services


Galera Support

Web-site: http://www.codership.com

Downloads: https://launchpad.net/codership-mysql

Mailing list: codership-team@googlegroups.com

10/27/11

Codership @ PerconaLive London 2011

53

Você também pode gostar