SlideShare une entreprise Scribd logo
1  sur  41
Télécharger pour lire hors ligne
1
Galera Cluster For MySQL
Alexey Yurchenko, Codership Oy
Percona Live MySQL User Conference and Expo, 2012
2
Follow the tutorial
Using Percona XtraDB Cluster RPMs, at Amazon
EC2
Datacenters:
us-west-1
us-east-1
eu-west-1
(look for galera_tutorial_* images)
3
Agenda
1. Introduction (30-45 min)
a. Galera architecture overview
b.Important terms and concepts
2. Migration from stock MySQL replication (30 min)
3. LAN cluster setup (30 min)
a. Node configuration
b.Joining the cluster, state transfer
c. Executing SQL load
4. Node failure and recovery under load (30 min)
a. Planned restart
b.Hard crash
c. Split-brain
5. WAN replication (30 min)
6. Troubleshooting
7. Q&A
4
What Is Galera Cluster for MySQL?
MySQL
server ✕ N
Galera
Cluster
for
MySQL
=
5
What is Galera Cluster for MySQL
Each node is fully representative of the cluster:
1. No single point of failure
2. Synchronous...............
3. 99.9% transparency
●
No data loss
●
No slave lag
●
No master failover
●
Full multi-master
6
What Is Galera Cluster for MySQL?
MySQL
Galera
Cluster
for
MySQLMySQL
MySQL
MySQL
7
What Is Galera Cluster for MySQL?
Galera
Cluster
for
MySQL
MySQL
server
Server
as a
part of
the
cluster
8
Migrating from MySQL master-slave
to Galera
9
What will happen 1
Master Slave
MySQL
master-slave replication
Clients
We start with regular MySQL master-slave
10
What will happen 2
Master
Slave /
G. node1
MySQL
master-slave replication
Clients
Upgrade MySQL slave to Galera node
Single node
Galera cluster
11
What will happen 3
Master
Slave /
G. node1
MySQL
master-slave replication
Clients
Add a second Galera node using state
snapshot transfer (SST) 2-node
Galera cluster
G. node2
12
What will happen 4
Master
Slave /
G. node1
Clients
Failover client connections to Galera cluster
and stop master-slave. 2-node
Galera cluster
G. node2
13
What will happen 5
Master /
G. node3
Slave /
G. node1
Clients
Upgrade MySQL master to Galera and join to
cluster using incremental state transfer (IST)
3-node Galera cluster
G. node2
14
Converting slave to Galera node
1. Stop the slave: slave> STOP SLAVE;
2. Upgrade the software:
slave# rpm -e MySQL-server
slave# rpm -Uvh percona-xtrabackup-2.0.0-*.rpm 
Percona-XtraDB-Cluster-galera-2.0-*.rpm 
Percona-XtraDB-Cluster-server-5.5.20-23.4*.rpm
3. Configure wsrep options in my.cnf
4. Add log_slave_updates=1 to my.cnf
Remove read_only = 1 from my.cnf
5. Restart the server.
6. Start the slave: slave> START SLAVE;
15
Sample my.cnf for slave after upgrade
[mysqld]
wsrep_cluster_address=/usr/lib64/libgalera_smm.so
wsrep_node_address=gcomm:// # NOTE: This must be changed to peer address ASAP!
wsrep_node_name=node1
wsrep_provider='/usr/lib64/galera/libgalera_smm.so'
wsrep_provider_options='gcache.size=1G;socket.ssl_key=my_key;socket.ssl_cert=my_cert'
wsrep_slave_threads=16
wsrep_sst_method=xtrabackup
wsrep_sst_auth=root:
innodb_buffer_pool_size=1G
innodb_log_file_size=256M
innodb_autoinc_lock_mode=2
innodb_flush_log_at_trx_commit=0
innodb_doublewrite=0
innodb_file_per_table=1
binlog_format=ROW
datadir=/var/lib/mysql
log-bin = mysql-bin
server-id = 2
relay-log = mysql-relay-bin
#read-only = 1
log-slave-updates = 1
16
Important wsrep variables 1
wsrep_provider:
A path to wsrep provider library.
17
Important wsrep variables 2
wsrep_cluster_address:
Where to connect to cluster. Has a URI form:
'gcomm://another_node_address?opt1=val1&opt2=val2'
But normally just
'gcomm://another_node_address'
A special form to start a new cluster:
'gcomm://'
!!! Danger !!! Never leave it in my.cnf !!!
18
Important wsrep variables 3
wsrep_node_address:
An optional address of the node. A short-cut
way to configure listen addresses for
replication and state transfers.
By default it will be initialized to the first
network interface returned by ifconfig. This
however is unreliable. For best results it must
be initialized explicitly.
19
Important wsrep variables 4
wsrep_node_name:
An optional name for the node. It will be used
in logging and to identify the desired donor
for state transfer.
By default it will be initialized to hostname,
but that may turn out to be not unique (it does
not have to) or unwieldy.
20
Important wsrep variables 5
wsrep_provider_options:
Semicolon-separated list of options specific to
provider. Some useful Galera options:
gcache.size – a size of the permanent
transaction on-disk cache.
socket.ssl_key, socket.ssl_cert – SSL key and
certificate files.
21
Important wsrep variables 6
wsrep_slave_threads:
How many threads to launch for parallel
applying.
> 1 requires certain InnoDB settings. Applying
of STATEMENT-based events is always
serialized.
22
Important wsrep variables 7
wsrep_sst_method:
Base package contains scripts for mysqldump,
rsync and xtrabackup based state snapshot
transfers. Own scripts can be crafted (handy for
backup). Default is mysqldump. It also requires
setting wsrep_sst_auth to MySQL root
user:password pair.
23
Status of Galera Replication
wsrep_ready
wsrep_cluster_status
wsrep_connected
Wait for node to sync with
cluster
No
Non-Primary
Primary
Network partitioning!
wsrep_local_state_uuid
wsrep_last_committed
Yes
Yes
No: reconnect
24
Starting a 2nd
Galera node
1. Install Percona RPMs. No need to configure
initial database, it will be brought by SST.
2. Edit my.cnf. Set wsrep_cluster_address to
slave node IP.
3. Start mysqld:
node2# service mysql start
4. Update my.cnf on slave:
set wsrep_cluster_address to 2nd
node IP.
25
Important Concepts 1
Application State:
For Galera application state is a set of data that
application decides to replicate. By default it is a
whole of MySQL databases (i.e. every node is a
complete replica of another).
Application state is identified by a Global Transation
ID.
26
Important Concepts 1
Global Transaction ID (GTID):
f7720ae0-6f9b-11e1-0800-598d1b386dce:13989753562f7720ae0-6f9b-11e1-0800-598d1b386dce 32520198989
CLUSTER/HISTORY/STATE
UUID
TRX/STATE
SEQNO
27
Important Concepts 1
Initial State:
f7720ae0-6f9b-11e1-0800-598d1b386dce:0
Undefined State:
00000000-0000-0000-0000-000000000000:-1
28
Important Concepts 1
State Snapshot Transfer (SST):
A transfer of a consistent snapshot of a node
state corresponding to a certain GTID in order to
initialize the state of a newly joining cluster node
from an already initialized node (donor).
29
Performance of Galera replication
wsrep_flow_control_paused: what fraction of the
time replication was paused.
wsrep_flow_control_sent: how many times this
node paused replication.
wsrep_local_recv_queue_avg: average length of
slave trx queue – a sign of slave side bottleneck.
wsrep_cert_deps_distance: how many transactions
can be applied in parallel.
wsrep_local_send_queue_avg: a sign of network
bottleneck.
30
Failover to Galera cluster
1. Briefly pause the load.
2. Make sure slave caught up with the master:
master> SHOW MASTER STATUSG
slave> SHOW SLAVE STATUSG
3. Take note of GTID on slave:
slave> SHOW STATUS LIKE 'wsrep_%';
4. Set binary log format to ROW on slave:
slave> SET GLOBAL binlog_format=ROW;
5. Direct the load to slave and the 2nd
Galera node.
31
Make former master a Galera node
1. Upgrade software.
2. Configure my.cnf.
Set wsrep_cluster_address to any of Galera
nodes' names.
3. Copy/forge grastate.dat file. Set state
information to the GTID we noted previous
page.
4. Start mysqld.
32
Important Concepts 2
Incremental State Transfer (IST):
Catch up with the cluster by replaying
missing transactions. Requires
➔
known initial node state;
➔
enough transactions cached at the donor.
33
Important Concepts 3
Node Failure:
For Galera node a peer crash is indistinguishable from
network failure. Hence node is considered failed when it
no longer can be communicated with. Communication is
verified by receiving messages or keepalives.
evs.inactive_timeout sets the timeout after which node
is considered inactive (dead).
evs.suspect_timeout sets the timeout after which the
node can be pronounced dead if everyone else agrees.
34
Galera WAN Replication
Currently Galera has no notion of a local or
remote node – it works as long as TCP works.
May need tuning to be more tolerant to
network hiccups – Galera (wsrep provider)
options:
evs.keepalive_period = PT3S;
evs.inactive_check_period = PT10S;
evs.suspect_timeout = PT30S;
evs.inactive_timeout = PT1M;
evs.consensus_timeout = PT1M
35
Important Concepts 4
Primary Component (PC):
PC
PC PC
36
Important Concepts 5
Split-brain:
PC
?
DC1
DC2
37
Galera Arbitrator
DC1 DC2
garbd
38
Galera Arbitrator
DC1 DC2
garbd
X
39
Galera Arbitrator
DC1 DC2
garbd
+
X
40
Galera Arbitrator
DC1 DC2
garbd
X
relay
41
Backup, backup, backup
Just backup one of the nodes. But backup
without GTID is not that useful - backup with
GTID:
1) xtrabackup:
node# innobackupex --galera-info
creates xtrabackup_galera_info in the datadir
2) Custom backup with arbitrator:
node# garbd … --donor node1 --sst custom
calls wsrep_sst_custom on node1.

Contenu connexe

Tendances

Мастер-класс "Логическая репликация и Avito" / Константин Евтеев, Михаил Тюр...
Мастер-класс "Логическая репликация и Avito" / Константин Евтеев,  Михаил Тюр...Мастер-класс "Логическая репликация и Avito" / Константин Евтеев,  Михаил Тюр...
Мастер-класс "Логическая репликация и Avito" / Константин Евтеев, Михаил Тюр...Ontico
 
Fosdem 2014 - MySQL & Friends Devroom: 15 tips galera cluster
Fosdem 2014 - MySQL & Friends Devroom: 15 tips galera clusterFosdem 2014 - MySQL & Friends Devroom: 15 tips galera cluster
Fosdem 2014 - MySQL & Friends Devroom: 15 tips galera clusterFrederic Descamps
 
MySQL replication & cluster
MySQL replication & clusterMySQL replication & cluster
MySQL replication & clusterelliando dias
 
Troubleshooting containerized triple o deployment
Troubleshooting containerized triple o deploymentTroubleshooting containerized triple o deployment
Troubleshooting containerized triple o deploymentSadique Puthen
 
GitLab PostgresMortem: Lessons Learned
GitLab PostgresMortem: Lessons LearnedGitLab PostgresMortem: Lessons Learned
GitLab PostgresMortem: Lessons LearnedAlexey Lesovsky
 
1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera clusterOlinData
 
MySQL async message subscription platform
MySQL async message subscription platformMySQL async message subscription platform
MySQL async message subscription platformLouis liu
 
Anatomy of neutron from the eagle eyes of troubelshoorters
Anatomy of neutron from the eagle eyes of troubelshoortersAnatomy of neutron from the eagle eyes of troubelshoorters
Anatomy of neutron from the eagle eyes of troubelshoortersSadique Puthen
 
Training Slides: Advanced 302: Performing Schema Changes in a Multi-Site/Mult...
Training Slides: Advanced 302: Performing Schema Changes in a Multi-Site/Mult...Training Slides: Advanced 302: Performing Schema Changes in a Multi-Site/Mult...
Training Slides: Advanced 302: Performing Schema Changes in a Multi-Site/Mult...Continuent
 
Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...
Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...
Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...Continuent
 
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestratorYoungHeon (Roy) Kim
 
PostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication CheatsheetPostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication CheatsheetAlexey Lesovsky
 
Streaming Replication Made Easy in v9.3
Streaming Replication Made Easy in v9.3Streaming Replication Made Easy in v9.3
Streaming Replication Made Easy in v9.3Sameer Kumar
 
Oracle cluster installation with grid and nfs
Oracle cluster  installation with grid and nfsOracle cluster  installation with grid and nfs
Oracle cluster installation with grid and nfsChanaka Lasantha
 
Sdnds tw-meetup-2
Sdnds tw-meetup-2Sdnds tw-meetup-2
Sdnds tw-meetup-2Fei Ji Siao
 
Corosync and Pacemaker
Corosync and PacemakerCorosync and Pacemaker
Corosync and PacemakerMarian Marinov
 
MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017Dave Stokes
 

Tendances (20)

Мастер-класс "Логическая репликация и Avito" / Константин Евтеев, Михаил Тюр...
Мастер-класс "Логическая репликация и Avito" / Константин Евтеев,  Михаил Тюр...Мастер-класс "Логическая репликация и Avito" / Константин Евтеев,  Михаил Тюр...
Мастер-класс "Логическая репликация и Avito" / Константин Евтеев, Михаил Тюр...
 
Query logging with proxysql
Query logging with proxysqlQuery logging with proxysql
Query logging with proxysql
 
Fosdem 2014 - MySQL & Friends Devroom: 15 tips galera cluster
Fosdem 2014 - MySQL & Friends Devroom: 15 tips galera clusterFosdem 2014 - MySQL & Friends Devroom: 15 tips galera cluster
Fosdem 2014 - MySQL & Friends Devroom: 15 tips galera cluster
 
MySQL replication & cluster
MySQL replication & clusterMySQL replication & cluster
MySQL replication & cluster
 
Troubleshooting containerized triple o deployment
Troubleshooting containerized triple o deploymentTroubleshooting containerized triple o deployment
Troubleshooting containerized triple o deployment
 
Multimaster
MultimasterMultimaster
Multimaster
 
GitLab PostgresMortem: Lessons Learned
GitLab PostgresMortem: Lessons LearnedGitLab PostgresMortem: Lessons Learned
GitLab PostgresMortem: Lessons Learned
 
1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster1 m+ qps on mysql galera cluster
1 m+ qps on mysql galera cluster
 
MySQL async message subscription platform
MySQL async message subscription platformMySQL async message subscription platform
MySQL async message subscription platform
 
Anatomy of neutron from the eagle eyes of troubelshoorters
Anatomy of neutron from the eagle eyes of troubelshoortersAnatomy of neutron from the eagle eyes of troubelshoorters
Anatomy of neutron from the eagle eyes of troubelshoorters
 
Training Slides: Advanced 302: Performing Schema Changes in a Multi-Site/Mult...
Training Slides: Advanced 302: Performing Schema Changes in a Multi-Site/Mult...Training Slides: Advanced 302: Performing Schema Changes in a Multi-Site/Mult...
Training Slides: Advanced 302: Performing Schema Changes in a Multi-Site/Mult...
 
Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...
Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...
Training Slides: Basics 105: Backup, Recovery and Provisioning Within Tungste...
 
My sql failover test using orchestrator
My sql failover test  using orchestratorMy sql failover test  using orchestrator
My sql failover test using orchestrator
 
PostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication CheatsheetPostgreSQL Streaming Replication Cheatsheet
PostgreSQL Streaming Replication Cheatsheet
 
Streaming Replication Made Easy in v9.3
Streaming Replication Made Easy in v9.3Streaming Replication Made Easy in v9.3
Streaming Replication Made Easy in v9.3
 
Oracle cluster installation with grid and nfs
Oracle cluster  installation with grid and nfsOracle cluster  installation with grid and nfs
Oracle cluster installation with grid and nfs
 
Sdnds tw-meetup-2
Sdnds tw-meetup-2Sdnds tw-meetup-2
Sdnds tw-meetup-2
 
Corosync and Pacemaker
Corosync and PacemakerCorosync and Pacemaker
Corosync and Pacemaker
 
MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017
 
Ceph issue 해결 사례
Ceph issue 해결 사례Ceph issue 해결 사례
Ceph issue 해결 사례
 

Similaire à MySQL Galera 集群

Percona XtraDB 集群文档
Percona XtraDB 集群文档Percona XtraDB 集群文档
Percona XtraDB 集群文档YUCHENG HU
 
Percona Cluster Installation with High Availability
Percona Cluster Installation with High AvailabilityPercona Cluster Installation with High Availability
Percona Cluster Installation with High AvailabilityRam Gautam
 
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaSMariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaSJelastic Multi-Cloud PaaS
 
Container Orchestration from Theory to Practice
Container Orchestration from Theory to PracticeContainer Orchestration from Theory to Practice
Container Orchestration from Theory to PracticeDocker, Inc.
 
Container orchestration from theory to practice
Container orchestration from theory to practiceContainer orchestration from theory to practice
Container orchestration from theory to practiceDocker, Inc.
 
Using Galera Cluster to Power Geo-distributed Applications on the WAN
Using Galera Cluster to Power Geo-distributed Applications on the WANUsing Galera Cluster to Power Geo-distributed Applications on the WAN
Using Galera Cluster to Power Geo-distributed Applications on the WANphilip_stoev
 
Highly Available Load Balanced Galera MySql Cluster
Highly Available Load Balanced  Galera MySql ClusterHighly Available Load Balanced  Galera MySql Cluster
Highly Available Load Balanced Galera MySql ClusterAmr Fawzy
 
Plny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practicesPlny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practicesDimas Prasetyo
 
FOSDEM 2012: MySQL synchronous replication in practice with Galera
FOSDEM 2012: MySQL synchronous replication in practice with GaleraFOSDEM 2012: MySQL synchronous replication in practice with Galera
FOSDEM 2012: MySQL synchronous replication in practice with GaleraFromDual GmbH
 
Nagios Conference 2014 - Troy Lea - Monitoring VMware Virtualization Using vMA
Nagios Conference 2014 - Troy Lea - Monitoring VMware Virtualization Using vMANagios Conference 2014 - Troy Lea - Monitoring VMware Virtualization Using vMA
Nagios Conference 2014 - Troy Lea - Monitoring VMware Virtualization Using vMANagios
 
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6Severalnines
 
My SQL Portal Database (Cluster)
My SQL Portal Database (Cluster)My SQL Portal Database (Cluster)
My SQL Portal Database (Cluster)Nicholas Adu Gyamfi
 
RAC-Installing your First Cluster and Database
RAC-Installing your First Cluster and DatabaseRAC-Installing your First Cluster and Database
RAC-Installing your First Cluster and DatabaseNikhil Kumar
 
MySQL Live Migration - Common Scenarios
MySQL Live Migration - Common ScenariosMySQL Live Migration - Common Scenarios
MySQL Live Migration - Common ScenariosMydbops
 

Similaire à MySQL Galera 集群 (20)

Percona XtraDB 集群文档
Percona XtraDB 集群文档Percona XtraDB 集群文档
Percona XtraDB 集群文档
 
Percona Cluster Installation with High Availability
Percona Cluster Installation with High AvailabilityPercona Cluster Installation with High Availability
Percona Cluster Installation with High Availability
 
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaSMariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
MariaDB Auto-Clustering, Vertical and Horizontal Scaling within Jelastic PaaS
 
Container Orchestration from Theory to Practice
Container Orchestration from Theory to PracticeContainer Orchestration from Theory to Practice
Container Orchestration from Theory to Practice
 
Container orchestration from theory to practice
Container orchestration from theory to practiceContainer orchestration from theory to practice
Container orchestration from theory to practice
 
Using Galera Cluster to Power Geo-distributed Applications on the WAN
Using Galera Cluster to Power Geo-distributed Applications on the WANUsing Galera Cluster to Power Geo-distributed Applications on the WAN
Using Galera Cluster to Power Geo-distributed Applications on the WAN
 
Highly Available Load Balanced Galera MySql Cluster
Highly Available Load Balanced  Galera MySql ClusterHighly Available Load Balanced  Galera MySql Cluster
Highly Available Load Balanced Galera MySql Cluster
 
Plny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practicesPlny12 galera-cluster-best-practices
Plny12 galera-cluster-best-practices
 
FOSDEM 2012: MySQL synchronous replication in practice with Galera
FOSDEM 2012: MySQL synchronous replication in practice with GaleraFOSDEM 2012: MySQL synchronous replication in practice with Galera
FOSDEM 2012: MySQL synchronous replication in practice with Galera
 
Nagios Conference 2014 - Troy Lea - Monitoring VMware Virtualization Using vMA
Nagios Conference 2014 - Troy Lea - Monitoring VMware Virtualization Using vMANagios Conference 2014 - Troy Lea - Monitoring VMware Virtualization Using vMA
Nagios Conference 2014 - Troy Lea - Monitoring VMware Virtualization Using vMA
 
Galera Cluster Best Practices for DBA's and DevOps Part 1
Galera Cluster Best Practices for DBA's and DevOps Part 1Galera Cluster Best Practices for DBA's and DevOps Part 1
Galera Cluster Best Practices for DBA's and DevOps Part 1
 
How to understand Galera Cluster - 2013
How to understand Galera Cluster - 2013How to understand Galera Cluster - 2013
How to understand Galera Cluster - 2013
 
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
 
MySQL Cluster Basics
MySQL Cluster BasicsMySQL Cluster Basics
MySQL Cluster Basics
 
Introducing Galera 3.0
Introducing Galera 3.0Introducing Galera 3.0
Introducing Galera 3.0
 
Neutron DVR
Neutron DVRNeutron DVR
Neutron DVR
 
My SQL Portal Database (Cluster)
My SQL Portal Database (Cluster)My SQL Portal Database (Cluster)
My SQL Portal Database (Cluster)
 
RAC-Installing your First Cluster and Database
RAC-Installing your First Cluster and DatabaseRAC-Installing your First Cluster and Database
RAC-Installing your First Cluster and Database
 
MySQL Live Migration - Common Scenarios
MySQL Live Migration - Common ScenariosMySQL Live Migration - Common Scenarios
MySQL Live Migration - Common Scenarios
 
Galera webinar migration to galera cluster from my sql async replication
Galera webinar migration to galera cluster from my sql async replicationGalera webinar migration to galera cluster from my sql async replication
Galera webinar migration to galera cluster from my sql async replication
 

Plus de YUCHENG HU

Confluencewiki 使用空间
Confluencewiki 使用空间Confluencewiki 使用空间
Confluencewiki 使用空间YUCHENG HU
 
Presta shop 1.6 如何安装简体中文语言文件
Presta shop 1.6 如何安装简体中文语言文件Presta shop 1.6 如何安装简体中文语言文件
Presta shop 1.6 如何安装简体中文语言文件YUCHENG HU
 
Logback 介绍
Logback 介绍Logback 介绍
Logback 介绍YUCHENG HU
 
Presta shop 1.6 详细安装指南
Presta shop 1.6 详细安装指南Presta shop 1.6 详细安装指南
Presta shop 1.6 详细安装指南YUCHENG HU
 
Presta shop 1.6 的安装环境
Presta shop 1.6 的安装环境Presta shop 1.6 的安装环境
Presta shop 1.6 的安装环境YUCHENG HU
 
Presta shop 1.6 如何安装简体中文语言文件
Presta shop 1.6 如何安装简体中文语言文件Presta shop 1.6 如何安装简体中文语言文件
Presta shop 1.6 如何安装简体中文语言文件YUCHENG HU
 
Presta shop 1.6 图文安装教程
Presta shop 1.6 图文安装教程Presta shop 1.6 图文安装教程
Presta shop 1.6 图文安装教程YUCHENG HU
 
V tiger 5.4.0 图文安装教程
V tiger 5.4.0 图文安装教程V tiger 5.4.0 图文安装教程
V tiger 5.4.0 图文安装教程YUCHENG HU
 
Confluence 回顾(retrospectives) 蓝图 cwikiossez
Confluence 回顾(retrospectives) 蓝图   cwikiossezConfluence 回顾(retrospectives) 蓝图   cwikiossez
Confluence 回顾(retrospectives) 蓝图 cwikiossezYUCHENG HU
 
Confluence 会议记录(meeting notes)蓝图 cwikiossez
Confluence 会议记录(meeting notes)蓝图   cwikiossezConfluence 会议记录(meeting notes)蓝图   cwikiossez
Confluence 会议记录(meeting notes)蓝图 cwikiossezYUCHENG HU
 
VTIGER - 销售机会 - CWIKIOSSEZ
VTIGER - 销售机会 - CWIKIOSSEZ VTIGER - 销售机会 - CWIKIOSSEZ
VTIGER - 销售机会 - CWIKIOSSEZ YUCHENG HU
 
Confluence 使用一个模板新建一个页面 cwikiossez
Confluence 使用一个模板新建一个页面     cwikiossezConfluence 使用一个模板新建一个页面     cwikiossez
Confluence 使用一个模板新建一个页面 cwikiossezYUCHENG HU
 
Confluence 使用模板
Confluence 使用模板Confluence 使用模板
Confluence 使用模板YUCHENG HU
 
Cwikiossez confluence 订阅页面更新邮件通知
Cwikiossez confluence 订阅页面更新邮件通知Cwikiossez confluence 订阅页面更新邮件通知
Cwikiossez confluence 订阅页面更新邮件通知YUCHENG HU
 
Cwikiossez confluence 关注页面 博客页面和空间
Cwikiossez confluence 关注页面 博客页面和空间Cwikiossez confluence 关注页面 博客页面和空间
Cwikiossez confluence 关注页面 博客页面和空间YUCHENG HU
 
My sql università di enna a.a. 2005-06
My sql   università di enna a.a. 2005-06My sql   università di enna a.a. 2005-06
My sql università di enna a.a. 2005-06YUCHENG HU
 
My sql would you like transactions
My sql would you like transactionsMy sql would you like transactions
My sql would you like transactionsYUCHENG HU
 
MySQL 简要介绍
MySQL 简要介绍MySQL 简要介绍
MySQL 简要介绍YUCHENG HU
 

Plus de YUCHENG HU (20)

Confluencewiki 使用空间
Confluencewiki 使用空间Confluencewiki 使用空间
Confluencewiki 使用空间
 
Git
GitGit
Git
 
Presta shop 1.6 如何安装简体中文语言文件
Presta shop 1.6 如何安装简体中文语言文件Presta shop 1.6 如何安装简体中文语言文件
Presta shop 1.6 如何安装简体中文语言文件
 
Logback 介绍
Logback 介绍Logback 介绍
Logback 介绍
 
Presta shop 1.6 详细安装指南
Presta shop 1.6 详细安装指南Presta shop 1.6 详细安装指南
Presta shop 1.6 详细安装指南
 
Presta shop 1.6 的安装环境
Presta shop 1.6 的安装环境Presta shop 1.6 的安装环境
Presta shop 1.6 的安装环境
 
Presta shop 1.6 如何安装简体中文语言文件
Presta shop 1.6 如何安装简体中文语言文件Presta shop 1.6 如何安装简体中文语言文件
Presta shop 1.6 如何安装简体中文语言文件
 
Presta shop 1.6 图文安装教程
Presta shop 1.6 图文安装教程Presta shop 1.6 图文安装教程
Presta shop 1.6 图文安装教程
 
V tiger 5.4.0 图文安装教程
V tiger 5.4.0 图文安装教程V tiger 5.4.0 图文安装教程
V tiger 5.4.0 图文安装教程
 
Confluence 回顾(retrospectives) 蓝图 cwikiossez
Confluence 回顾(retrospectives) 蓝图   cwikiossezConfluence 回顾(retrospectives) 蓝图   cwikiossez
Confluence 回顾(retrospectives) 蓝图 cwikiossez
 
Confluence 会议记录(meeting notes)蓝图 cwikiossez
Confluence 会议记录(meeting notes)蓝图   cwikiossezConfluence 会议记录(meeting notes)蓝图   cwikiossez
Confluence 会议记录(meeting notes)蓝图 cwikiossez
 
VTIGER - 销售机会 - CWIKIOSSEZ
VTIGER - 销售机会 - CWIKIOSSEZ VTIGER - 销售机会 - CWIKIOSSEZ
VTIGER - 销售机会 - CWIKIOSSEZ
 
Confluence 使用一个模板新建一个页面 cwikiossez
Confluence 使用一个模板新建一个页面     cwikiossezConfluence 使用一个模板新建一个页面     cwikiossez
Confluence 使用一个模板新建一个页面 cwikiossez
 
Confluence 使用模板
Confluence 使用模板Confluence 使用模板
Confluence 使用模板
 
Cwikiossez confluence 订阅页面更新邮件通知
Cwikiossez confluence 订阅页面更新邮件通知Cwikiossez confluence 订阅页面更新邮件通知
Cwikiossez confluence 订阅页面更新邮件通知
 
Cwikiossez confluence 关注页面 博客页面和空间
Cwikiossez confluence 关注页面 博客页面和空间Cwikiossez confluence 关注页面 博客页面和空间
Cwikiossez confluence 关注页面 博客页面和空间
 
My sql università di enna a.a. 2005-06
My sql   università di enna a.a. 2005-06My sql   università di enna a.a. 2005-06
My sql università di enna a.a. 2005-06
 
My sql would you like transactions
My sql would you like transactionsMy sql would you like transactions
My sql would you like transactions
 
MySQL 指南
MySQL 指南MySQL 指南
MySQL 指南
 
MySQL 简要介绍
MySQL 简要介绍MySQL 简要介绍
MySQL 简要介绍
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 

Dernier (20)

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 

MySQL Galera 集群

  • 1. 1 Galera Cluster For MySQL Alexey Yurchenko, Codership Oy Percona Live MySQL User Conference and Expo, 2012
  • 2. 2 Follow the tutorial Using Percona XtraDB Cluster RPMs, at Amazon EC2 Datacenters: us-west-1 us-east-1 eu-west-1 (look for galera_tutorial_* images)
  • 3. 3 Agenda 1. Introduction (30-45 min) a. Galera architecture overview b.Important terms and concepts 2. Migration from stock MySQL replication (30 min) 3. LAN cluster setup (30 min) a. Node configuration b.Joining the cluster, state transfer c. Executing SQL load 4. Node failure and recovery under load (30 min) a. Planned restart b.Hard crash c. Split-brain 5. WAN replication (30 min) 6. Troubleshooting 7. Q&A
  • 4. 4 What Is Galera Cluster for MySQL? MySQL server ✕ N Galera Cluster for MySQL =
  • 5. 5 What is Galera Cluster for MySQL Each node is fully representative of the cluster: 1. No single point of failure 2. Synchronous............... 3. 99.9% transparency ● No data loss ● No slave lag ● No master failover ● Full multi-master
  • 6. 6 What Is Galera Cluster for MySQL? MySQL Galera Cluster for MySQLMySQL MySQL MySQL
  • 7. 7 What Is Galera Cluster for MySQL? Galera Cluster for MySQL MySQL server Server as a part of the cluster
  • 8. 8 Migrating from MySQL master-slave to Galera
  • 9. 9 What will happen 1 Master Slave MySQL master-slave replication Clients We start with regular MySQL master-slave
  • 10. 10 What will happen 2 Master Slave / G. node1 MySQL master-slave replication Clients Upgrade MySQL slave to Galera node Single node Galera cluster
  • 11. 11 What will happen 3 Master Slave / G. node1 MySQL master-slave replication Clients Add a second Galera node using state snapshot transfer (SST) 2-node Galera cluster G. node2
  • 12. 12 What will happen 4 Master Slave / G. node1 Clients Failover client connections to Galera cluster and stop master-slave. 2-node Galera cluster G. node2
  • 13. 13 What will happen 5 Master / G. node3 Slave / G. node1 Clients Upgrade MySQL master to Galera and join to cluster using incremental state transfer (IST) 3-node Galera cluster G. node2
  • 14. 14 Converting slave to Galera node 1. Stop the slave: slave> STOP SLAVE; 2. Upgrade the software: slave# rpm -e MySQL-server slave# rpm -Uvh percona-xtrabackup-2.0.0-*.rpm Percona-XtraDB-Cluster-galera-2.0-*.rpm Percona-XtraDB-Cluster-server-5.5.20-23.4*.rpm 3. Configure wsrep options in my.cnf 4. Add log_slave_updates=1 to my.cnf Remove read_only = 1 from my.cnf 5. Restart the server. 6. Start the slave: slave> START SLAVE;
  • 15. 15 Sample my.cnf for slave after upgrade [mysqld] wsrep_cluster_address=/usr/lib64/libgalera_smm.so wsrep_node_address=gcomm:// # NOTE: This must be changed to peer address ASAP! wsrep_node_name=node1 wsrep_provider='/usr/lib64/galera/libgalera_smm.so' wsrep_provider_options='gcache.size=1G;socket.ssl_key=my_key;socket.ssl_cert=my_cert' wsrep_slave_threads=16 wsrep_sst_method=xtrabackup wsrep_sst_auth=root: innodb_buffer_pool_size=1G innodb_log_file_size=256M innodb_autoinc_lock_mode=2 innodb_flush_log_at_trx_commit=0 innodb_doublewrite=0 innodb_file_per_table=1 binlog_format=ROW datadir=/var/lib/mysql log-bin = mysql-bin server-id = 2 relay-log = mysql-relay-bin #read-only = 1 log-slave-updates = 1
  • 16. 16 Important wsrep variables 1 wsrep_provider: A path to wsrep provider library.
  • 17. 17 Important wsrep variables 2 wsrep_cluster_address: Where to connect to cluster. Has a URI form: 'gcomm://another_node_address?opt1=val1&opt2=val2' But normally just 'gcomm://another_node_address' A special form to start a new cluster: 'gcomm://' !!! Danger !!! Never leave it in my.cnf !!!
  • 18. 18 Important wsrep variables 3 wsrep_node_address: An optional address of the node. A short-cut way to configure listen addresses for replication and state transfers. By default it will be initialized to the first network interface returned by ifconfig. This however is unreliable. For best results it must be initialized explicitly.
  • 19. 19 Important wsrep variables 4 wsrep_node_name: An optional name for the node. It will be used in logging and to identify the desired donor for state transfer. By default it will be initialized to hostname, but that may turn out to be not unique (it does not have to) or unwieldy.
  • 20. 20 Important wsrep variables 5 wsrep_provider_options: Semicolon-separated list of options specific to provider. Some useful Galera options: gcache.size – a size of the permanent transaction on-disk cache. socket.ssl_key, socket.ssl_cert – SSL key and certificate files.
  • 21. 21 Important wsrep variables 6 wsrep_slave_threads: How many threads to launch for parallel applying. > 1 requires certain InnoDB settings. Applying of STATEMENT-based events is always serialized.
  • 22. 22 Important wsrep variables 7 wsrep_sst_method: Base package contains scripts for mysqldump, rsync and xtrabackup based state snapshot transfers. Own scripts can be crafted (handy for backup). Default is mysqldump. It also requires setting wsrep_sst_auth to MySQL root user:password pair.
  • 23. 23 Status of Galera Replication wsrep_ready wsrep_cluster_status wsrep_connected Wait for node to sync with cluster No Non-Primary Primary Network partitioning! wsrep_local_state_uuid wsrep_last_committed Yes Yes No: reconnect
  • 24. 24 Starting a 2nd Galera node 1. Install Percona RPMs. No need to configure initial database, it will be brought by SST. 2. Edit my.cnf. Set wsrep_cluster_address to slave node IP. 3. Start mysqld: node2# service mysql start 4. Update my.cnf on slave: set wsrep_cluster_address to 2nd node IP.
  • 25. 25 Important Concepts 1 Application State: For Galera application state is a set of data that application decides to replicate. By default it is a whole of MySQL databases (i.e. every node is a complete replica of another). Application state is identified by a Global Transation ID.
  • 26. 26 Important Concepts 1 Global Transaction ID (GTID): f7720ae0-6f9b-11e1-0800-598d1b386dce:13989753562f7720ae0-6f9b-11e1-0800-598d1b386dce 32520198989 CLUSTER/HISTORY/STATE UUID TRX/STATE SEQNO
  • 27. 27 Important Concepts 1 Initial State: f7720ae0-6f9b-11e1-0800-598d1b386dce:0 Undefined State: 00000000-0000-0000-0000-000000000000:-1
  • 28. 28 Important Concepts 1 State Snapshot Transfer (SST): A transfer of a consistent snapshot of a node state corresponding to a certain GTID in order to initialize the state of a newly joining cluster node from an already initialized node (donor).
  • 29. 29 Performance of Galera replication wsrep_flow_control_paused: what fraction of the time replication was paused. wsrep_flow_control_sent: how many times this node paused replication. wsrep_local_recv_queue_avg: average length of slave trx queue – a sign of slave side bottleneck. wsrep_cert_deps_distance: how many transactions can be applied in parallel. wsrep_local_send_queue_avg: a sign of network bottleneck.
  • 30. 30 Failover to Galera cluster 1. Briefly pause the load. 2. Make sure slave caught up with the master: master> SHOW MASTER STATUSG slave> SHOW SLAVE STATUSG 3. Take note of GTID on slave: slave> SHOW STATUS LIKE 'wsrep_%'; 4. Set binary log format to ROW on slave: slave> SET GLOBAL binlog_format=ROW; 5. Direct the load to slave and the 2nd Galera node.
  • 31. 31 Make former master a Galera node 1. Upgrade software. 2. Configure my.cnf. Set wsrep_cluster_address to any of Galera nodes' names. 3. Copy/forge grastate.dat file. Set state information to the GTID we noted previous page. 4. Start mysqld.
  • 32. 32 Important Concepts 2 Incremental State Transfer (IST): Catch up with the cluster by replaying missing transactions. Requires ➔ known initial node state; ➔ enough transactions cached at the donor.
  • 33. 33 Important Concepts 3 Node Failure: For Galera node a peer crash is indistinguishable from network failure. Hence node is considered failed when it no longer can be communicated with. Communication is verified by receiving messages or keepalives. evs.inactive_timeout sets the timeout after which node is considered inactive (dead). evs.suspect_timeout sets the timeout after which the node can be pronounced dead if everyone else agrees.
  • 34. 34 Galera WAN Replication Currently Galera has no notion of a local or remote node – it works as long as TCP works. May need tuning to be more tolerant to network hiccups – Galera (wsrep provider) options: evs.keepalive_period = PT3S; evs.inactive_check_period = PT10S; evs.suspect_timeout = PT30S; evs.inactive_timeout = PT1M; evs.consensus_timeout = PT1M
  • 35. 35 Important Concepts 4 Primary Component (PC): PC PC PC
  • 41. 41 Backup, backup, backup Just backup one of the nodes. But backup without GTID is not that useful - backup with GTID: 1) xtrabackup: node# innobackupex --galera-info creates xtrabackup_galera_info in the datadir 2) Custom backup with arbitrator: node# garbd … --donor node1 --sst custom calls wsrep_sst_custom on node1.