Mysql Always Up Mit Galera Cluster
Mysql Always Up Mit Galera Cluster
Mysql Always Up Mit Galera Cluster
com
MySQL always-up
with Galera Cluster
SLAC 2014
May 14, 2014, Berlin
www.fromdual.com
1 / 31
About FromDual GmbH www.fromdual.com
www.fromdual.com
2 / 31
Always-up? :-( www.fromdual.com
4 / 31
Maintenance time... www.fromdual.com
App
Upgrade
RAM/HW
Node 1 Node 2 Node O/S 3
wsrep wsrep DB?
wsrep
Galera replication
5 / 31
Advantages / Disadvantages www.fromdual.com
Based on InnoDB SE
Synchronous replication → No lost transaction
Active-active multi-master Cluster
→ Read and write to any cluster node (no r/w split any more!)
Read scalability and higher write throughput (Flash-Cache?)
Automatic node membership control
Rolling Restart (Upgrade of Hardware, O/S, DB release, etc.)
True parallel replication, on row level → No slave lag
A bit more complicated than normal MySQL, but similar
complexity as M/S Replication!
No original MySQL binaries → Codership MySQL binaries
Be aware of Hot Spots on rows: Higher probability of deadlocks
6 / 31
Quorum and Split-brain www.fromdual.com
8 / 31
www.fromdual.com
9 / 31
Installation www.fromdual.com
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!
11 / 31
Galera Configuration www.fromdual.com
my.cnf (conf.d/wsrep.cnf)
[mysqld]
# wsrep_provider = none
wsrep_provider = …/lib/plugin/libgalera_smm.so
# wsrep_cluster_address = "gcomm://"
wsrep_cluster_address = "gcomm://ip_node2,ip_node3"
wsrep_sst_method = mysqldump
wsrep_sst_auth = sst:secret
12 / 31
www.fromdual.com
Operations
13 / 31
Initial Cluster start www.fromdual.com
14 / 31
Rolling Restart www.fromdual.com
● Scenario:
● Hardware-, O/S-, DB- and Galera-Upgrade
● MySQL configuration change
● During full operation!!! (99.999% HA, 5x9 HA)
● → Rolling Restart
● Start one node after the other in a cycle
● New features or settings are used after Rolling
Restart is completed
15 / 31
www.fromdual.com
Demo?
16 / 31
Load Balancing www.fromdual.com
● Connectors
● Connector/J
● PHP: MySQLnd replication and load balancing
plug-in
● SW Load Balancer
● GLB, LVS/IPVS/Ldirector, HAProxy
● HW Load Balancer
17 / 31
Location of Load Balancing www.fromdual.com
18 / 31
www.fromdual.com
Demo?
19 / 31
Catch Node State Change www.fromdual.com
Demo?
21 / 31
Online Schema Upgrade (OSU) www.fromdual.com
22 / 31
Total Order Isolation (TOI) www.fromdual.com
● Default
● Part of the database is locked for the
duration of the DDL.
+ Simple, predictable and guaranteed data
consistency.
- Locking operation
● Good for fast DDL operations
23 / 31
Rolling Schema Upgrade (RSU) www.fromdual.com
25 / 31
Caution! www.fromdual.com
!
26 / 31
Galera Network Configuration
www.fromdual.com
27 / 31
WAN – Cluster www.fromdual.com
28 / 31
Communication encryption www.fromdual.com
● 2 Possibilities:
1.) Make Network secure (V-LAN, VPN with SSL, stunnel)
2.) Encrypt Galera communication with SSL
● Caution: only Galera replication is affected!
● NOT State Snapshot Transfer (SST, mysqldump | mysql,
rsync)
● NOT Client connection (mysql), use MySQL SSL
encryption!
● But Incremental State Transfer (IST) IS affected (= Galera
Protocol)!
● We recommend for ease of use: Do it on Network
level!
29 / 31
Wir suchen noch: www.fromdual.com
30 / 31
Q&A www.fromdual.com
Questions ?
Discussion?