SlideShare una empresa de Scribd logo
1 de 25
Galera Cluster Best Practices
for DBAs and DevOps
Philip Stoev
Codership Oy
Agenda
• A very quick overview of Galera Cluster
• Ongoing monitoring of the cluster and detection of
bottlenecks
• Backup strategies
• Selecting the optimal State Snapshot Transfer (SST)
method
Galera Cluster Overview
Synchronous
– each transaction is immediately replicated on all nodes at commit
– no stale slaves
Multi-Master
– read from and write to any node
– automatic transaction conflict detection
Replication
– a copy of the entire dataset is available on all nodes
– new nodes can join automatically
For MySQL
– based on a modified version of MySQL (5.5, 5.6 with 5.7 coming up)
– InnoDB storage engine
And more …
• Recovers from node failures within seconds
• Data consistency protections
– avoids reading stale data
– prevents unsafe data modifications
• Cloud and WAN support
Monitoring Galera Cluster
General Principles of Monitoring
• Galera Cluster is first and foremost MySQL + InnoDB:
– all traditional advice still applies (e.g. slow query log)
– InnoDB still does most of the heavy lifting (e.g. I/O)
• Galera reports metrics via SHOW GLOBAL STATUS
– FLUSH STATUS resets counters
• Galera reports events via the MySQL server error log
– good idea to check you logs or log rotation scripts
• Monitor each node separately for maximum visibility
Monitoring the Network
Especially in WAN or complex network environments:
• monitor the health of the network using a third-party
tool:
– round-trip (ping) times
– bandwidth utilization
• monitor each network link between any two segments
separately
– Galera assumes all links perform equally well
Detecting Issues With Cluster Health
• SHOW GLOBAL STATUS variables:
MySQL [test]> show status like '%wsrep%';
+------------------------------+-------------------------------------------+
| Variable_name | Value |
+------------------------------+-------------------------------------------+
| wsrep_ready | ON |
| wsrep_cluster_status | Primary (or non-Primary) |
| wsrep_local_state_comment | Synced (or Donor/Desynced, Joiner) |
| wsrep_cluster_size | 3 |
+------------------------------+-------------------------------------------+
Detecting Galera-Specific Bottlenecks
MySQL [test]> show global status like '%wsrep%';
+------------------------------+--------------------------------------------
+
| Variable_name | Value
|
+------------------------------+--------------------------------------------
+
| wsrep_flow_control_paused | 0.100000
|
| wsrep_flow_control_sent | 123
|
| wsrep_local_bf_aborts | 77
|
| wsrep_local_cert_failures | 24
|
+------------------------------+--------------------------------------------
+
In case of BF aborts or cert failures:
Detecting Galera-Specific Bottlenecks #2
• SHOW PROCESSLIST:
MySQL [test]> show processlist;
+----+------+-----------+------+---------+------+----------+---------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+------+---------+------+----------+---------------------------+
...
| 5 | root | localhost | test | Query | 10 | query end| INSERT INTO t1 VALUES (1) |
...
3 rows in set (0.05 sec)
Backups
Backups
• Multiple nodes do not remove the need for backups
– backups also help in case of human error
• All nodes in Galera have the same information, so
backing up one node is sufficient
• Galera does not use the binary log files, so generate
and back those up only if you have a specific need
• Practicing the restore operation is highly recommended
Performance Considerations
• Backups slow down the node being backed up
– which in turn can cause the entire cluster to slow down
• or reduce the number of available nodes in the cluster
– can affect quorum calculations
• you can have an async slave and take backups from it
– Just do not let it fall far behind the master cluster
XtraBackup
Non-blocking backup for InnoDB
• --galera-info option records the precise position
when the backup was taken in a file named
xtrabackup_galera_info
• a short lock is still taken
Backup Procedure with a Dedicated Node
• Make sure backup node will get no write traffic
– make sure all existing sessions are disconnected
• Temporarily disconnect a node from the cluster
– SET GLOBAL wsrep_provider = ‘none’
• Perform backup
• Restore the value of wsrep_provider; check for
wsrep_ready=ON
Restoring Single Node from Backup
Option #1:
– wipe the data directory clean and restart
– let it rejoin the cluster via SST
– the operation will involve a donating node as well
Option #2:
– use a backup that was recently taken
– wipe the data directory clean and restore data
– put the information from xtrabackup_galera_info into grastate.dat
# GALERA saved state
version: 2.1
uuid: 021a77ed-80cf-11e6-9e8e-6249ad0d3a57
seqno: 1234
cert_index:
– restart node and it will catch up via IST
Restoring Entire Cluster #1
Note: a new logical cluster is being created
Easiest approach:
1. Restore data on one node and restart first node with –
wsrep-new-cluster
2. Start one more node. Node rejoins via SST, with first
node as donor
3. Restart two more nodes, first two nodes serve as
donors, and so forth.
Restoring Entire Cluster #2
Optimized approach:
1. Restore backup on first node, bootstrap 1-node
cluster. Prevent new transactions from being issued.
2. Restore backup on other nodes and create
grastate.dat on them:
# GALERA saved state
version: 2.1
uuid: <new-cluster-uuid>
seqno: 0
cert_index:
SST
General Principles
• It is always best to avoid SST altogether by sizing
gcache.size appropriately
• SST choice is determined by:
– availability of a dedicated donating node
– encryption requirements (SST encryption is configured
separately from other cluster operations)
– bandwidth utilization
SST Methods
• Rsync (the default)
– causes the donor to block new transactions
• XtraBackup
– Donor remains operational
• Mysqldump
– logical, rather than physical database copy
Configuration without a Dedicated Donor
• Use xtrabackup-v2 SST method
– requires the installation of XtraBackup
– there is still performance impact on the donor
– encryption, compression are available
Configuration with Dedicated Donor
• rsync may be the best method to use:
– available on any machine
– compression and partial file transfers are possible
• use wsrep_sst_donor to specify donor node to use:
– takes a list of node names as configured with
wsrep_node_name
– if the list terminates with a comma, other nodes can also be
used for donors if none of the nodes from the list are available
• if using an arbitrator, consider switching it to a full
Galera node that can then act as a dedicated donor
Questions
• Please use the Question/Chat box in the GoToWebinar
panel
• Ideas welcome for future webinars
Thank You
http://www.galeracluster.com
Discussion group:
codership-team@googlegroups.com

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Ceph and RocksDB
Ceph and RocksDBCeph and RocksDB
Ceph and RocksDB
 
Introduction to Galera Cluster
Introduction to Galera ClusterIntroduction to Galera Cluster
Introduction to Galera Cluster
 
The Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication TutorialThe Full MySQL and MariaDB Parallel Replication Tutorial
The Full MySQL and MariaDB Parallel Replication Tutorial
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
Ceph issue 해결 사례
Ceph issue 해결 사례Ceph issue 해결 사례
Ceph issue 해결 사례
 
Maxscale switchover, failover, and auto rejoin
Maxscale switchover, failover, and auto rejoinMaxscale switchover, failover, and auto rejoin
Maxscale switchover, failover, and auto rejoin
 
BlueStore, A New Storage Backend for Ceph, One Year In
BlueStore, A New Storage Backend for Ceph, One Year InBlueStore, A New Storage Backend for Ceph, One Year In
BlueStore, A New Storage Backend for Ceph, One Year In
 
Ceph Object Storage Reference Architecture Performance and Sizing Guide
Ceph Object Storage Reference Architecture Performance and Sizing GuideCeph Object Storage Reference Architecture Performance and Sizing Guide
Ceph Object Storage Reference Architecture Performance and Sizing Guide
 
MariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly AvailableMariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Galera Cluster - Simple, Transparent, Highly Available
 
MySQL GTID 시작하기
MySQL GTID 시작하기MySQL GTID 시작하기
MySQL GTID 시작하기
 
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
MySQL Parallel Replication: All the 5.7 and 8.0 Details (LOGICAL_CLOCK)
 
What is new in MariaDB 10.6?
What is new in MariaDB 10.6?What is new in MariaDB 10.6?
What is new in MariaDB 10.6?
 
Zero Downtime Schema Changes - Galera Cluster - Best Practices
Zero Downtime Schema Changes - Galera Cluster - Best PracticesZero Downtime Schema Changes - Galera Cluster - Best Practices
Zero Downtime Schema Changes - Galera Cluster - Best Practices
 
Ceph Day Beijing - Ceph All-Flash Array Design Based on NUMA Architecture
Ceph Day Beijing - Ceph All-Flash Array Design Based on NUMA ArchitectureCeph Day Beijing - Ceph All-Flash Array Design Based on NUMA Architecture
Ceph Day Beijing - Ceph All-Flash Array Design Based on NUMA Architecture
 
Ceph RBD Update - June 2021
Ceph RBD Update - June 2021Ceph RBD Update - June 2021
Ceph RBD Update - June 2021
 
Demystifying MySQL Replication Crash Safety
Demystifying MySQL Replication Crash SafetyDemystifying MySQL Replication Crash Safety
Demystifying MySQL Replication Crash Safety
 
Optimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performanceOptimizing MariaDB for maximum performance
Optimizing MariaDB for maximum performance
 
Galera Cluster - Node Recovery - Webinar slides
Galera Cluster - Node Recovery - Webinar slidesGalera Cluster - Node Recovery - Webinar slides
Galera Cluster - Node Recovery - Webinar slides
 
RocksDB compaction
RocksDB compactionRocksDB compaction
RocksDB compaction
 
ceph optimization on ssd ilsoo byun-short
ceph optimization on ssd ilsoo byun-shortceph optimization on ssd ilsoo byun-short
ceph optimization on ssd ilsoo byun-short
 

Destacado

Webinar Slides: Migrating to Galera Cluster
Webinar Slides: Migrating to Galera ClusterWebinar Slides: Migrating to Galera Cluster
Webinar Slides: Migrating to Galera Cluster
Severalnines
 
Deep Dive Into How To Monitor MySQL or MariaDB Galera Cluster / Percona XtraD...
Deep Dive Into How To Monitor MySQL or MariaDB Galera Cluster / Percona XtraD...Deep Dive Into How To Monitor MySQL or MariaDB Galera Cluster / Percona XtraD...
Deep Dive Into How To Monitor MySQL or MariaDB Galera Cluster / Percona XtraD...
Severalnines
 

Destacado (13)

Galera Cluster DDL and Schema Upgrades 220217
Galera Cluster DDL and Schema Upgrades 220217Galera Cluster DDL and Schema Upgrades 220217
Galera Cluster DDL and Schema Upgrades 220217
 
Taking Full Advantage of Galera Multi Master Cluster
Taking Full Advantage of Galera Multi Master ClusterTaking Full Advantage of Galera Multi Master Cluster
Taking Full Advantage of Galera Multi Master Cluster
 
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
 
MySQL High Availability Solutions - Feb 2015 webinar
MySQL High Availability Solutions - Feb 2015 webinarMySQL High Availability Solutions - Feb 2015 webinar
MySQL High Availability Solutions - Feb 2015 webinar
 
Introduction to Galera
Introduction to GaleraIntroduction to Galera
Introduction to Galera
 
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
 
Codership's galera cluster installation and quickstart webinar march 2016
Codership's galera cluster installation and quickstart webinar march 2016Codership's galera cluster installation and quickstart webinar march 2016
Codership's galera cluster installation and quickstart webinar march 2016
 
Webinar Slides: Migrating to Galera Cluster
Webinar Slides: Migrating to Galera ClusterWebinar Slides: Migrating to Galera Cluster
Webinar Slides: Migrating to Galera Cluster
 
Maria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityMaria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High Availability
 
Deep Dive Into How To Monitor MySQL or MariaDB Galera Cluster / Percona XtraD...
Deep Dive Into How To Monitor MySQL or MariaDB Galera Cluster / Percona XtraD...Deep Dive Into How To Monitor MySQL or MariaDB Galera Cluster / Percona XtraD...
Deep Dive Into How To Monitor MySQL or MariaDB Galera Cluster / Percona XtraD...
 
Best practices for MySQL High Availability
Best practices for MySQL High AvailabilityBest practices for MySQL High Availability
Best practices for MySQL High Availability
 
Galera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction SlidesGalera cluster for MySQL - Introduction Slides
Galera cluster for MySQL - Introduction Slides
 
Universitas terbuka at a glance
Universitas terbuka at a glanceUniversitas terbuka at a glance
Universitas terbuka at a glance
 

Similar a Galera Cluster Best Practices for DBA's and DevOps Part 1

Cassandra
CassandraCassandra
Cassandra
exsuns
 
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseNoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
Paresh Patel
 
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
FromDual GmbH
 
London + Dublin Cassandra 2.0
London + Dublin Cassandra 2.0London + Dublin Cassandra 2.0
London + Dublin Cassandra 2.0
jbellis
 

Similar a Galera Cluster Best Practices for DBA's and DevOps Part 1 (20)

Training Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & RecoveryTraining Slides: 203 - Backup & Recovery
Training Slides: 203 - Backup & Recovery
 
Training Slides: Basics 102: Introduction to Tungsten Clustering
Training Slides: Basics 102: Introduction to Tungsten ClusteringTraining Slides: Basics 102: Introduction to Tungsten Clustering
Training Slides: Basics 102: Introduction to Tungsten Clustering
 
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
 
Migrating to XtraDB Cluster
Migrating to XtraDB ClusterMigrating to XtraDB Cluster
Migrating to XtraDB Cluster
 
Migrating to XtraDB Cluster
Migrating to XtraDB ClusterMigrating to XtraDB Cluster
Migrating to XtraDB Cluster
 
Cassandra
CassandraCassandra
Cassandra
 
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_DatabaseNoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
NoCOUG_201411_Patel_Managing_a_Large_OLTP_Database
 
Using galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wanUsing galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wan
 
Using galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wanUsing galera replication to create geo distributed clusters on the wan
Using galera replication to create geo distributed clusters on the wan
 
Training Slides: Intermediate 202: Performing Cluster Maintenance with Zero-D...
Training Slides: Intermediate 202: Performing Cluster Maintenance with Zero-D...Training Slides: Intermediate 202: Performing Cluster Maintenance with Zero-D...
Training Slides: Intermediate 202: Performing Cluster Maintenance with Zero-D...
 
Do more with Galera Cluster in your OpenStack cloud
Do more with Galera Cluster in your OpenStack cloudDo more with Galera Cluster in your OpenStack cloud
Do more with Galera Cluster in your OpenStack cloud
 
Best Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on SolarisBest Practices with PostgreSQL on Solaris
Best Practices with PostgreSQL on Solaris
 
MySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptxMySQL8.0_performance_schema.pptx
MySQL8.0_performance_schema.pptx
 
Training Slides: Advanced 304: Upgrading From Native MySQL Replication To Tun...
Training Slides: Advanced 304: Upgrading From Native MySQL Replication To Tun...Training Slides: Advanced 304: Upgrading From Native MySQL Replication To Tun...
Training Slides: Advanced 304: Upgrading From Native MySQL Replication To Tun...
 
MySQL Galera 集群
MySQL Galera 集群MySQL Galera 集群
MySQL Galera 集群
 
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
 
Galera explained 3
Galera explained 3Galera explained 3
Galera explained 3
 
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
 
London + Dublin Cassandra 2.0
London + Dublin Cassandra 2.0London + Dublin Cassandra 2.0
London + Dublin Cassandra 2.0
 
Overview of Postgres Utility Processes
Overview of Postgres Utility ProcessesOverview of Postgres Utility Processes
Overview of Postgres Utility Processes
 

Más de Codership Oy - Creators of Galera Cluster

Más de Codership Oy - Creators of Galera Cluster (8)

Galera Cluster 4 for MySQL 8 Release Webinar slides
Galera Cluster 4 for MySQL 8 Release Webinar slidesGalera Cluster 4 for MySQL 8 Release Webinar slides
Galera Cluster 4 for MySQL 8 Release Webinar slides
 
Choosing between Codership's MySQL Galera, MariaDB Galera Cluster and Percona...
Choosing between Codership's MySQL Galera, MariaDB Galera Cluster and Percona...Choosing between Codership's MySQL Galera, MariaDB Galera Cluster and Percona...
Choosing between Codership's MySQL Galera, MariaDB Galera Cluster and Percona...
 
Planning for Disaster Recovery (DR) with Galera Cluster
Planning for Disaster Recovery (DR) with Galera ClusterPlanning for Disaster Recovery (DR) with Galera Cluster
Planning for Disaster Recovery (DR) with Galera Cluster
 
Running Galera Cluster on Microsoft Azure
Running Galera Cluster on Microsoft AzureRunning Galera Cluster on Microsoft Azure
Running Galera Cluster on Microsoft Azure
 
How to understand Galera Cluster - 2013
How to understand Galera Cluster - 2013How to understand Galera Cluster - 2013
How to understand Galera Cluster - 2013
 
Galera Cluster 3.0 Features
Galera Cluster 3.0 FeaturesGalera Cluster 3.0 Features
Galera Cluster 3.0 Features
 
Zero Downtime Schema Changes in Galera Cluster
Zero Downtime Schema Changes in Galera ClusterZero Downtime Schema Changes in Galera Cluster
Zero Downtime Schema Changes in Galera Cluster
 
Introducing Galera 3.0
Introducing Galera 3.0Introducing Galera 3.0
Introducing Galera 3.0
 

Último

CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Último (20)

How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 

Galera Cluster Best Practices for DBA's and DevOps Part 1

  • 1. Galera Cluster Best Practices for DBAs and DevOps Philip Stoev Codership Oy
  • 2. Agenda • A very quick overview of Galera Cluster • Ongoing monitoring of the cluster and detection of bottlenecks • Backup strategies • Selecting the optimal State Snapshot Transfer (SST) method
  • 3. Galera Cluster Overview Synchronous – each transaction is immediately replicated on all nodes at commit – no stale slaves Multi-Master – read from and write to any node – automatic transaction conflict detection Replication – a copy of the entire dataset is available on all nodes – new nodes can join automatically For MySQL – based on a modified version of MySQL (5.5, 5.6 with 5.7 coming up) – InnoDB storage engine
  • 4. And more … • Recovers from node failures within seconds • Data consistency protections – avoids reading stale data – prevents unsafe data modifications • Cloud and WAN support
  • 6. General Principles of Monitoring • Galera Cluster is first and foremost MySQL + InnoDB: – all traditional advice still applies (e.g. slow query log) – InnoDB still does most of the heavy lifting (e.g. I/O) • Galera reports metrics via SHOW GLOBAL STATUS – FLUSH STATUS resets counters • Galera reports events via the MySQL server error log – good idea to check you logs or log rotation scripts • Monitor each node separately for maximum visibility
  • 7. Monitoring the Network Especially in WAN or complex network environments: • monitor the health of the network using a third-party tool: – round-trip (ping) times – bandwidth utilization • monitor each network link between any two segments separately – Galera assumes all links perform equally well
  • 8. Detecting Issues With Cluster Health • SHOW GLOBAL STATUS variables: MySQL [test]> show status like '%wsrep%'; +------------------------------+-------------------------------------------+ | Variable_name | Value | +------------------------------+-------------------------------------------+ | wsrep_ready | ON | | wsrep_cluster_status | Primary (or non-Primary) | | wsrep_local_state_comment | Synced (or Donor/Desynced, Joiner) | | wsrep_cluster_size | 3 | +------------------------------+-------------------------------------------+
  • 9. Detecting Galera-Specific Bottlenecks MySQL [test]> show global status like '%wsrep%'; +------------------------------+-------------------------------------------- + | Variable_name | Value | +------------------------------+-------------------------------------------- + | wsrep_flow_control_paused | 0.100000 | | wsrep_flow_control_sent | 123 | | wsrep_local_bf_aborts | 77 | | wsrep_local_cert_failures | 24 | +------------------------------+-------------------------------------------- + In case of BF aborts or cert failures:
  • 10. Detecting Galera-Specific Bottlenecks #2 • SHOW PROCESSLIST: MySQL [test]> show processlist; +----+------+-----------+------+---------+------+----------+---------------------------+ | Id | User | Host | db | Command | Time | State | Info | +----+------+-----------+------+---------+------+----------+---------------------------+ ... | 5 | root | localhost | test | Query | 10 | query end| INSERT INTO t1 VALUES (1) | ... 3 rows in set (0.05 sec)
  • 12. Backups • Multiple nodes do not remove the need for backups – backups also help in case of human error • All nodes in Galera have the same information, so backing up one node is sufficient • Galera does not use the binary log files, so generate and back those up only if you have a specific need • Practicing the restore operation is highly recommended
  • 13. Performance Considerations • Backups slow down the node being backed up – which in turn can cause the entire cluster to slow down • or reduce the number of available nodes in the cluster – can affect quorum calculations • you can have an async slave and take backups from it – Just do not let it fall far behind the master cluster
  • 14. XtraBackup Non-blocking backup for InnoDB • --galera-info option records the precise position when the backup was taken in a file named xtrabackup_galera_info • a short lock is still taken
  • 15. Backup Procedure with a Dedicated Node • Make sure backup node will get no write traffic – make sure all existing sessions are disconnected • Temporarily disconnect a node from the cluster – SET GLOBAL wsrep_provider = ‘none’ • Perform backup • Restore the value of wsrep_provider; check for wsrep_ready=ON
  • 16. Restoring Single Node from Backup Option #1: – wipe the data directory clean and restart – let it rejoin the cluster via SST – the operation will involve a donating node as well Option #2: – use a backup that was recently taken – wipe the data directory clean and restore data – put the information from xtrabackup_galera_info into grastate.dat # GALERA saved state version: 2.1 uuid: 021a77ed-80cf-11e6-9e8e-6249ad0d3a57 seqno: 1234 cert_index: – restart node and it will catch up via IST
  • 17. Restoring Entire Cluster #1 Note: a new logical cluster is being created Easiest approach: 1. Restore data on one node and restart first node with – wsrep-new-cluster 2. Start one more node. Node rejoins via SST, with first node as donor 3. Restart two more nodes, first two nodes serve as donors, and so forth.
  • 18. Restoring Entire Cluster #2 Optimized approach: 1. Restore backup on first node, bootstrap 1-node cluster. Prevent new transactions from being issued. 2. Restore backup on other nodes and create grastate.dat on them: # GALERA saved state version: 2.1 uuid: <new-cluster-uuid> seqno: 0 cert_index:
  • 19. SST
  • 20. General Principles • It is always best to avoid SST altogether by sizing gcache.size appropriately • SST choice is determined by: – availability of a dedicated donating node – encryption requirements (SST encryption is configured separately from other cluster operations) – bandwidth utilization
  • 21. SST Methods • Rsync (the default) – causes the donor to block new transactions • XtraBackup – Donor remains operational • Mysqldump – logical, rather than physical database copy
  • 22. Configuration without a Dedicated Donor • Use xtrabackup-v2 SST method – requires the installation of XtraBackup – there is still performance impact on the donor – encryption, compression are available
  • 23. Configuration with Dedicated Donor • rsync may be the best method to use: – available on any machine – compression and partial file transfers are possible • use wsrep_sst_donor to specify donor node to use: – takes a list of node names as configured with wsrep_node_name – if the list terminates with a comma, other nodes can also be used for donors if none of the nodes from the list are available • if using an arbitrator, consider switching it to a full Galera node that can then act as a dedicated donor
  • 24. Questions • Please use the Question/Chat box in the GoToWebinar panel • Ideas welcome for future webinars