You are on page 1of 22

www.fromdual.

com
1 / 22
High-availability with
Galera Cluster
for MySQ
i!u"#ag 2$1%
1$. Mai 2$1%& 'erli!
by oli.se!!hauser(fromdual.com
www.fromdual.com
www.fromdual.com
2 / 22
)bout *rom+ual GmbH

*rom+ual ,rovides !eutral a!d i!de,e!de!t-

Co!sulti!g for MySQ& Galera Cluster& Maria+' a!d


.erco!a Server

Su,,ort for all MySQ a!d Galera Cluster

/emote-+') Services for all MySQ

MySQ #rai!i!g

0,e! Source 'usi!ess )llia!ce 10S')2

Member of S03G& +0)G& /ch/o,e!


www.fromdual.com
www.fromdual.com
4 / 22
High-)vailability --1

5ts also about mai!te!a!ce...

6ho loves !ight-shifts7

6ho loves wee8e!d-wor87

6ho does regular u,grade 1+'& 8er!el& etc.27

6ho does regular reboots 1after 8er!el


u,grade27

6hy are you !ot doi!g it i! your office hours7


www.fromdual.com
% / 22
#he Galera Cluster for MySQ
www.fromdual.com
9 / 22
Mai!te!a!ce time...
),,
oad bala!ci!g 1'2
:ode 2 :ode 1
wsre,
Galera re,licatio!
wsre,
:ode 4
wsre,
3,grade
/)M/H6
0/S
+'7
www.fromdual.com
; / 22
)dva!tages / +isadva!tages
'ased o! 5!!o+' S<
Sy!chro!ous re,licatio! = :o lost tra!sactio!
)ctive-active multi-master Cluster
= /ead a!d write to a!y cluster !ode 1!o r/w s,lit a!y more>2
/ead scalability a!d higher write through,ut 1*lash-Cache72
)utomatic !ode membershi, co!trol
/olli!g /estart 13,grade of Hardware& 0/S& +' release& etc.2
#rue ,arallel re,licatio!& o! row level
= :o slave lag
) bit more com,licated tha! !ormal MySQ& but similar com,le"ity
as M/S /e,licatio!>
:o origi!al MySQ bi!aries = Codershi, MySQ bi!aries
'e aware of Hot S,ots o! rows- Higher ,robability of deadloc8s
www.fromdual.com
? / 22
Quorum a!d s,lit-brai!

6hat is the ,roblem7

S,lit-brai! = bad>

Galera is a ,essimistic Cluster = good>

Quorum- FLOOR(n/2+1)
= more tha! half> = 4-!ode Cluster 1or 2@12
7
www.fromdual.com
A / 22
Quorum
www.fromdual.com
B / 22
5!stallatio! a!d Co!figuratio!
www.fromdual.com
1$ / 22
5!stallatio!

Galera Cluster co!sists of-

) ,atched Codershi, MySQ 1mysqld2

0r Maria+' Galera Cluster

0r .erco!a Ctra+' Cluster

#he Galera .lugi! 1libgalera_smm.so2

6ays of i!stallatio!

.ac8ets 1/.M& +<'2

'i!ary tar-ball

.atch MySQ source a!d com,ile both

+ow!load htt,-//galeracluster.com/dow!loads/
www.fromdual.com
11 / 22
MySQ Co!figuratio!
my.cnf
[mysqld]
default_storage_engine = InnoDB
binlog_format = row
innodb_autoinc_lock_mode = 2 # parallel applying
innodb_flush_log_at_trx_commit = 0 # performance only!
query_cache_size = 0 # Galera 3 experimental
query_cache_type = 0 # Mutex! Consistency!
www.fromdual.com
12 / 22
Galera Co!figuratio!
my.cnf 1conf.d/wsrep.cnf2
[mysqld]
# wsrep_provider = none
wsrep_provider = /lib/plugin/libgalera_smm.so
# wsrep_cluster_address = "gcomm://"
wsrep_cluster_address = "gcomm://ip_node!ip_node""
wsrep_cluster_name = #$alera %luster#
wsrep_node_name = #&ode '#
wsrep_sst_met(od = mysqldump
wsrep_sst_aut( = sst:secret
www.fromdual.com
14 / 22
0,eratio!s
www.fromdual.com
1% / 22
5!itial Cluster start

Start very 1
st
!ode with-
wsrep_cluster_address = "gcomm://"
or
mysqld_safe --wsrep-cluster-address="gcomm://"

= this tells the !ode to be the first o!e>

)ll other !odes !ormal-


service mysqld start
www.fromdual.com
19 / 22
/olli!g /estart

Sce!ario-

Hardware-& 0/S-& +'- a!d Galera-3,grade

MySQ co!figuratio! cha!ge

+uri!g full o,eratio!>>> 1BB.BBBD H)& 9"B H)2

= /olli!g /estart

Start o!e !ode after the other i! a cycle

:ew features or setti!gs are used after /olli!g


/estart is com,leted
www.fromdual.com
1; / 22
oad 'ala!ci!g

Co!!ectors

Co!!ector/E

.H.- MySQ!d re,licatio! a!d load bala!ci!g


,lug-i!

S6 oad 'ala!cer

G'& FS/5.FS/director& H).ro"y

H6 oad 'ala!cer
www.fromdual.com
1? / 22
ocatio! of oad 'ala!ci!g
www.fromdual.com
1A / 22
+emo7
www.fromdual.com
1B / 22
0!li!e Schema 3,grade 10S32

Schema 3,grade G ++ ru! agai!st the +'

Cha!ge +' structure

:o! tra!sactio!al

2 Methods-

#otal 0rder 5solatio! 1#052 1default2

/olli!g Schema 3,grade 1/S32

wsrep_osu_method = {TOI|RSU}
www.fromdual.com
2$ / 22
0!li!e Schema 3,grade

#otal 0rder 5solatio! 1#052 1default2

.art of the database is loc8ed for the duratio! of the ++.

@ Sim,le& ,redictable a!d guara!teed data co!siste!cy.

- oc8i!g o,eratio!

Good for fast ++ o,eratio!s

/olli!g Schema 3,grade 1/S32

++ will be o!ly ,rocessed locally at the !ode.

:ode is desy!chro!iHed for the duratio! of the ++ ,rocessi!g.

)fter ++ com,letio!& delayed write sets are a,,lied 1similar to 5S#2.

++ should be ma!ually e"ecuted at each !ode.

@ o!ly bloc8i!g o!e !ode at a time

- ,ote!tially u!safe a!d may fail if !ew a!d old schema are
i!com,atible

Good for slow ++ o,eratio!s


www.fromdual.com
21 / 22
6ir suche! !och-

+ate!ba!8 <!thusiast/i! fIr


Su,,ort / remote-+') / 'eratu!g
www.fromdual.com
22 / 22
Q J )
Questio!s 7
+iscussio!7
6e have time for some face-to-face tal8s...

*rom+ual ,rovides !eutral a!d i!de,e!de!t-

Co!sulti!g

/emote-+')

Su,,ort for MySQ& Galera& .erco!a Server a!d Maria+'

#rai!i!g
www.fromdual.com

You might also like