SlideShare a Scribd company logo
Using all of the high
availability options in
MariaDB
WAGNER BIANCHI
MariaDB RDBA Team Lead
MariaDB Corporation
About MariaDB Corporation
MariaDB frees companies from the costs, constraints and complexity of proprietary databases, enabling them to
reinvest in what matters most – rapidly developing innovative, customer-facing applications. MariaDB uses pluggable,
purpose-built storage engines to support workloads that previously required a variety of specialized databases. With
complexity and constraints eliminated, enterprises can now depend on a single complete database for all their needs,
whether on commodity hardware or their cloud of choice. Deployed in minutes for transactional or analytical use
cases, MariaDB delivers unmatched operational agility without sacrificing key enterprise features including real ACID
compliance and full SQL. Trusted by organizations such as Deutsche Bank, DBS Bank, Nasdaq, Red Hat, The Home
Depot, ServiceNow and Verizon – MariaDB meets the same core requirements as proprietary databases at a fraction
of the cost. No wonder it’s the fastest growing open source database. Real business relies on MariaDB™.
@BIANCHI
Wagner Bianchi has been working with the MySQL ecosystem for more than 12 years now. He is an Oracle ACE
Director since 2014 and has worked on the most complex environments running Open Source solutions. Bianchi
joint MariaDB RDBA Team in 2017 where he works as Remote DBA Team Lead @ MariaDB Remote DBA
Team.
He is specialized in multi-tier/HA/FT setups when multi-integrations are needed to keep systems highly available
and fault-tolerant. MySQL Expert (DEV, DBA, NDB CLUSTER), AWS Certified Solutions Architect, and Splunk
Architect, Bianchi has worked with the biggest environments running MariaDB products like MaxScale, MariaDB
Server, AWS, Azure, providing architecture [re]design, products upgrades, and migrations.
bianchi@mariadb.com
@wagnerbianchijr
wagnerbianchi.com
mariadb.com/blog
ABSTRACT
MariaDB Corporation provides a number of high availability options, including the native MariaDB
Server replication with automatic failover and multi-master clustering, the MariaDB Cluster which
leverages the environment with a fault-tolerant solution, the MariaDB Spider that make it
possible to shard and scale the environment, and the MariaDB MaxScale that can be mixed up
with all other solutions to provide an excellent overall solution for any mission-critical application.
In this session, we’ll provide a comprehensive overview the high availability features in MariaDB,
highlight their impact on consistency and performance, discuss advanced failover strategies and
introduce new features such as casual reads and transparent connection failover.
FOCUS ON MARIADB TX
AGENDA
● High-Availability
● Fault Tolerant systems
● Single Point of Failure
● MariaDB Server Replication:
○ Asynchronous;
○ Semi-synchronous;
● MariaDB Cluster
● MaxScale HA
● MariaDB in the Cloud
● MariaDB Spider
High- Availability
● MariaDB TX provides high availability via asynchronous or semi-synchronous
master/slave replication with automatic failover and synchronous multi-master
clustering;
Fault Tolerance
● MariaDB have products that when working together can provide fault tolerance
and operations continuity:
Single Point Of Failure
● Replication clusters can failover on failures using MaxScale:
○ Switchover/Failover/Automatic Rejoin capabilities;
● The MariaDB Cluster fails can trigger new master election on MaxScale;
○ MaxScale protects environments against multi-master writes;
○ The same replication servers roles are used for MariaDB Cluster:
■ Master and Slaves, one master at a time.
● MaxScale can be setup in HA:
○ Standby redundancy, when one instance out of three is active at a given time;
○ Active redundancy, when all instances are receiving and routing traffic;
■ Maxscale active and passive configurations;
■ It should be planned since the setup.
MariaDB Server
Data Replication Options
MariaDB Server Replication - Asynchronous
● With asynchronous replication, transactions are replicated after being
committed;
MariaDB Server Replication - Semi-synchronous
● With semi-synchronous replication, a transaction is not committed until it has
been replicated to a slave;
The semi-sync repl
plugin was merged
into the server on
MariaDB Server
10.3.3 -
(MDEV-13073)
MariaDB Cluster
● MariaDB TX supports multi-master clustering via MariaDB Cluster (i.e., Galera
Cluster);
The MariaDB MaxScale
is meant to help you
keep things in good
shape in scenarios like
this one.
MariaDB MaxScale
High-Availability and Fault-Tolerance Configurations
MariaDB MaxScale - Replication Scale Reads
● If master/slave replication is used for both high availability and read scalability,
the database proxy, MariaDB MaxScale, can route writes to the master and
load balance reads across the slaves using read-write splitting;
The MariaDB MaxScale
CCR filter can help with
avoiding reading stale
data from slaves;
The MariaDB MaxScale
Cache Filter can help
adding a cache layer
with a dedicated port to
read cached data,
avoiding hitting the
databases for recurrent
read operations;
MariaDB MaxScale - Replication Failover
● The MariaDB MaxScale has built-in automatic failover. If it is enabled, and the
master fails, it will promote the most up-to-date slave (based on GTID) to
master and reconfigure the remaining slaves (if any) to replicate from it:
MariaDB MaxScale - Replication Switchover
● When having operational issues with the current master or even having the
need to move the current master away, promoting one of the existing slaves as
the new master, the switchover is welcome;
○ replication_user=mariadb #: replication user
○ replication_password=ACEEF153D52F8391E3218F9F2B259EAD #: replication password
○ switchover_timeout=90 #: time to complete
● There is a command to call out a monitor module so the switchover happens:
$ maxctrl call command mariadbmon switchover replication-monitor opmdb02
OK
#: what does the maxscale log says?
2019-01-06 20:29:14.596 notice : (redirect_slaves_ex): All redirects successful.
2019-01-06 20:29:14.607 notice : (manual_switchover): Switchover 'opmdb01' -> 'opmdb02' performed.
2019-01-06 20:29:14.765 notice : (mon_log_state_change): Server changed state: opmdb01[10.0.0.11:3306]: new_slave.
[Master, Running] -> [Slave, Running]
2019-01-06 20:29:14.765 notice : (mon_log_state_change): Server changed state: opmdb02[10.0.0.12:3306]:
new_master. [Slave, Running] -> [Master, Running]
MariaDB MaxScale - Replication Failover
● The MariaDBMon monitor is configured with:
○ failcount=5 #: number of passes/checks if a server failed
○ monitor_interval=1000 #: time in ms for each of the passes
○ auto_failover=true #: if the automatic failover is enabled
○ failover_timeout=10 #: time in secs the failover ops has to complete
● The formula for the failover to happen, though, is:
#: automatric_failover = monitor_interval * failcount
2018-01-12 20:19:39 error : Monitor was unable to connect to server [192.168.50.13]:3306
: "Can't connect to MySQL server on '192.168.50.13' (115)"
2018-01-12 20:19:44 warning: [mariadbmon] Master has failed. If master status does not
change in 5 monitor passes, failover begins.
MariaDB MaxScale - Replication Rejoin
● When auto_rejoin is enabled, the monitor will rejoin any standalone database
servers or any slaves replicating from a relay master to the main cluster:
2019-01-04 19:54:25.266 notice : (mon_log_state_change): Server changed state: opmdb01[10.0.0.11:3306]:
server_up. [Down] -> [Running]
2019-01-04 19:54:25.277 notice : (do_rejoin): Directing standalone server 'opmdb01' to replicate from
'opmdb02'.
2019-01-04 19:54:25.295 notice : (create_start_slave): Slave connection from opmdb01 to [10.0.0.12]:3306
created and started.
2019-01-04 19:54:25.295 notice : (handle_auto_rejoin): 1 server(s) redirected or rejoined the cluster.
2019-01-04 19:54:25.764 notice : (mon_log_state_change): Server changed state: opmdb01[10.0.0.11:3306]:
new_slave. [Running] -> [Slave, Running]
MariaDB MaxScale - Clustering
● If multi-master clustering is used for both high availability and read scalability,
the MariaDB MaxScale can assign master/slave roles to obtain better scale;
The MariaDB MaxScale uses
the concept of master and
slave to protect the cluster
against writing to multiple
nodes at the same time;
Here, if the current master
crashes, a new master is
elected immediately;
Cluster nodes can be
configured with priorities to
have better control on new
elections;
DEMO - MaxScale
● Let's see how it works:
○ Switchover;
○ Failover;
○ Automatic Rejoin.
Making the MariaDB
MaxScale Highly
Available
High-Availability and Fault-Tolerance Configurations
MaxScale Highly Available
● Two situations to make MaxScale Highly Available:
○ MaxScale on-premisses;
○ MaxScale in the Cloud;
● Additional software needed for integrating the final solution:
○ Keepalived, when on premisses and having a private VIP;
○ XLB + Corosync/Pacemaker when in the Cloud;
■ Active redundancy, you don't need extra packages, just an LB and MaxScale instances;
■ Standby redundancy, you need to handle who is online at a given time (healthy vs unhealthy);
● MariaDB RDBA proven cases in the Cloud:
MaxScale Highly Available - AWS
In this case, there are two types of setup:
● Active Redundancy, when all three instances of
MaxScale will be receiving traffic and routing to
backends. In case one of the instances fail,
traffic flow continues and you have time to
provisioning a new one and add that under the
LB. You need to handle MaxScale passive
mode.
● Standby Redundancy, one of the instances is
taking traffic at a time and the others appears
as unhealthy under the LB. It requires additional
packages; we use Corosync/Pacemaker to
handle that;
MaxScale Highly Available
● MaxScale, when running in passive mode (MariaDBMon):
○ It does not do a failover for replication clusters;
○ It does not execute an automatic rejoin for replication clusters;
○ It does not execute scripts as response to monitor events.
● For GaleraMon:
○ No special protection against events;
○ Don't force new elections using priorities;
○ If new elections is a concern, root_node_as_master can help, but, slow the
election time and cannot be fault-tolerant.
DEMO - MaxScale Highly Available
Let's see how it works:
● Three MariaDB MaxScale instances;
● Active Redundancy;
● Standby Redundancy.
AWS Console - Target Groups Configuration
MaxScale Standby Redundancy
● Using the NLB endpoint, create a database:
● Start a sysbench job:
#: let's create a database named "openworks"
mysql -uappuser -p123 -hOPNLB-114bf4e40f0b7526.elb.us-east-1.amazonaws.com -e "create database openworksdb"
#: let's prepare a sysbench job/task using the openworks database
sysbench --test=/usr/share/sysbench/oltp_read_write.lua --table_size=10000 --mysql-db=openworksdb --tables=20 
--mysql-user=appuser --mysql-port=3306 --db-driver=mysql --threads=8 --events=0 --time=60 --rand-type=uniform 
--mysql-password=123 --mysql-host=OPNLB-114bf4e40f0b7526.elb.us-east-1.amazonaws.com --report-interval=1 prepare
#: run the sysbench
sysbench --test=/usr/share/sysbench/oltp_read_write.lua --table_size=10000 --mysql-db=openworksdb --tables=20 
--mysql-user=appuser --mysql-port=3306 --db-driver=mysql --threads=8 --events=0 --time=60 --rand-type=uniform 
--mysql-password=123 --mysql-host=OPNLB-114bf4e40f0b7526.elb.us-east-1.amazonaws.com --report-interval=1 run
MariaDB Spider
Sharding Databases
MariaDB Spider - Storage Engine Overview
● The Spider Storage Engine has two main components:
○ Spider Proxy Server: which receives the external queries/transactions;
○ Spider Hosts: known also as servers, created when configuring the shard.
● Uses cases reinforce its usage more for sharding:
○ Shards based on PARTITIONING Functions, which provides horizontal partitioning;
○ Shards data by HASH(), RANGE(), LIST();
● It can be used also to create remote of federated tables.
MariaDB Spider - Storage Engine Demo
Let's see how it works:
● Show an environment running Spider:
○ Show created servers;
○ Show created table;
○ Show table created on nodes;
○ Show key distribution.
THANK YOU!

More Related Content

PDF
MariaDB Server Performance Tuning & Optimization
PDF
Query Optimization with MySQL 8.0 and MariaDB 10.3: The Basics
PDF
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
PDF
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
PPTX
ProxySQL for MySQL
PPTX
My sql failover test using orchestrator
PDF
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
PDF
M|18 Architectural Overview: MariaDB MaxScale
MariaDB Server Performance Tuning & Optimization
Query Optimization with MySQL 8.0 and MariaDB 10.3: The Basics
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
ProxySQL for MySQL
My sql failover test using orchestrator
Wars of MySQL Cluster ( InnoDB Cluster VS Galera )
M|18 Architectural Overview: MariaDB MaxScale

What's hot (20)

PDF
MariaDB MaxScale
PDF
Using ClickHouse for Experimentation
PDF
The Full MySQL and MariaDB Parallel Replication Tutorial
PDF
MariaDB Performance Tuning and Optimization
PDF
MariaDB MaxScale monitor 매뉴얼
PDF
Maxscale_메뉴얼
PDF
MySQL Parallel Replication: inventory, use-case and limitations
PPTX
Maxscale 소개 1.1.1
PPTX
MariaDB High Availability
PDF
Parallel Replication in MySQL and MariaDB
PDF
What is new in PostgreSQL 14?
PDF
How to Manage Scale-Out Environments with MariaDB MaxScale
PDF
Maxscale switchover, failover, and auto rejoin
ODP
OpenGurukul : Database : PostgreSQL
PDF
Intro ProxySQL
PDF
MySQL/MariaDB Proxy Software Test
PDF
ProxySQL High Avalability and Configuration Management Overview
PDF
ProxySQL and the Tricks Up Its Sleeve - Percona Live 2022.pdf
PDF
MySQL Administrator 2021 - 네오클로바
PDF
MariaDB 마이그레이션 - 네오클로바
MariaDB MaxScale
Using ClickHouse for Experimentation
The Full MySQL and MariaDB Parallel Replication Tutorial
MariaDB Performance Tuning and Optimization
MariaDB MaxScale monitor 매뉴얼
Maxscale_메뉴얼
MySQL Parallel Replication: inventory, use-case and limitations
Maxscale 소개 1.1.1
MariaDB High Availability
Parallel Replication in MySQL and MariaDB
What is new in PostgreSQL 14?
How to Manage Scale-Out Environments with MariaDB MaxScale
Maxscale switchover, failover, and auto rejoin
OpenGurukul : Database : PostgreSQL
Intro ProxySQL
MySQL/MariaDB Proxy Software Test
ProxySQL High Avalability and Configuration Management Overview
ProxySQL and the Tricks Up Its Sleeve - Percona Live 2022.pdf
MySQL Administrator 2021 - 네오클로바
MariaDB 마이그레이션 - 네오클로바
Ad

Similar to Using all of the high availability options in MariaDB (20)

PDF
Best Practice for Achieving High Availability in MariaDB
PDF
MariaDB High Availability Webinar
PDF
M|18 Choosing the Right High Availability Strategy for You
PDF
Choosing the right high availability strategy
PDF
02 2017 emea_roadshow_milan_ha
PDF
mariadb-platform-high-availability-guide_whitepaper_1001.pdf
PDF
Choosing the right high availability strategy
PPTX
Hochverfügbarkeit mit MariaDB Enterprise - MariaDB Roadshow Summer 2014 Hambu...
PDF
Hochverfügbarkeitslösungen mit MariaDB
PDF
How to provide enterprise high availability with MariaDB Platform
PPTX
Running MariaDB in multiple data centers
PDF
How to Manage Scale-Out Environments with MariaDB MaxScale
PDF
Choosing the right high availability strategy
PDF
High-level architecture of a complete MariaDB deployment
PPTX
Choosing the right high availability strategy
PPTX
Maria DB Galera Cluster for High Availability
PPTX
MariaDB Galera Cluster
PDF
Webinar slides: Severalnines & MariaDB present: Automation & Management of Ma...
PDF
MariaDB: Connect Storage Engine
PDF
Keynote – When Open Source Meets the Enterprise
Best Practice for Achieving High Availability in MariaDB
MariaDB High Availability Webinar
M|18 Choosing the Right High Availability Strategy for You
Choosing the right high availability strategy
02 2017 emea_roadshow_milan_ha
mariadb-platform-high-availability-guide_whitepaper_1001.pdf
Choosing the right high availability strategy
Hochverfügbarkeit mit MariaDB Enterprise - MariaDB Roadshow Summer 2014 Hambu...
Hochverfügbarkeitslösungen mit MariaDB
How to provide enterprise high availability with MariaDB Platform
Running MariaDB in multiple data centers
How to Manage Scale-Out Environments with MariaDB MaxScale
Choosing the right high availability strategy
High-level architecture of a complete MariaDB deployment
Choosing the right high availability strategy
Maria DB Galera Cluster for High Availability
MariaDB Galera Cluster
Webinar slides: Severalnines & MariaDB present: Automation & Management of Ma...
MariaDB: Connect Storage Engine
Keynote – When Open Source Meets the Enterprise
Ad

More from MariaDB plc (20)

PDF
MariaDB Berlin Roadshow Slides - 8 April 2025
PDF
MariaDB München Roadshow - 24 September, 2024
PDF
MariaDB Paris Roadshow - 19 September 2024
PDF
MariaDB Amsterdam Roadshow: 19 September, 2024
PDF
MariaDB Paris Workshop 2023 - MaxScale 23.02.x
PDF
MariaDB Paris Workshop 2023 - Newpharma
PDF
MariaDB Paris Workshop 2023 - Cloud
PDF
MariaDB Paris Workshop 2023 - MariaDB Enterprise
PDF
MariaDB Paris Workshop 2023 - Performance Optimization
PDF
MariaDB Paris Workshop 2023 - MaxScale
PDF
MariaDB Paris Workshop 2023 - novadys presentation
PDF
MariaDB Paris Workshop 2023 - DARVA presentation
PDF
MariaDB Tech und Business Update Hamburg 2023 - MariaDB Enterprise Server
PDF
MariaDB SkySQL Autonome Skalierung, Observability, Cloud-Backup
PDF
Einführung : MariaDB Tech und Business Update Hamburg 2023
PDF
Die Neuheiten in MariaDB Enterprise Server
PDF
Global Data Replication with Galera for Ansell Guardian®
PDF
Introducing workload analysis
PDF
Under the hood: SkySQL monitoring
PDF
Introducing the R2DBC async Java connector
MariaDB Berlin Roadshow Slides - 8 April 2025
MariaDB München Roadshow - 24 September, 2024
MariaDB Paris Roadshow - 19 September 2024
MariaDB Amsterdam Roadshow: 19 September, 2024
MariaDB Paris Workshop 2023 - MaxScale 23.02.x
MariaDB Paris Workshop 2023 - Newpharma
MariaDB Paris Workshop 2023 - Cloud
MariaDB Paris Workshop 2023 - MariaDB Enterprise
MariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - MaxScale
MariaDB Paris Workshop 2023 - novadys presentation
MariaDB Paris Workshop 2023 - DARVA presentation
MariaDB Tech und Business Update Hamburg 2023 - MariaDB Enterprise Server
MariaDB SkySQL Autonome Skalierung, Observability, Cloud-Backup
Einführung : MariaDB Tech und Business Update Hamburg 2023
Die Neuheiten in MariaDB Enterprise Server
Global Data Replication with Galera for Ansell Guardian®
Introducing workload analysis
Under the hood: SkySQL monitoring
Introducing the R2DBC async Java connector

Recently uploaded (20)

PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PPT
Introduction Database Management System for Course Database
PDF
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Introduction to Artificial Intelligence
PPTX
Online Work Permit System for Fast Permit Processing
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
System and Network Administraation Chapter 3
PDF
How Creative Agencies Leverage Project Management Software.pdf
PPTX
CHAPTER 2 - PM Management and IT Context
PPTX
L1 - Introduction to python Backend.pptx
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
top salesforce developer skills in 2025.pdf
Which alternative to Crystal Reports is best for small or large businesses.pdf
Introduction Database Management System for Course Database
T3DD25 TYPO3 Content Blocks - Deep Dive by André Kraus
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Design an Analysis of Algorithms II-SECS-1021-03
How to Migrate SBCGlobal Email to Yahoo Easily
Introduction to Artificial Intelligence
Online Work Permit System for Fast Permit Processing
VVF-Customer-Presentation2025-Ver1.9.pptx
Operating system designcfffgfgggggggvggggggggg
System and Network Administraation Chapter 3
How Creative Agencies Leverage Project Management Software.pdf
CHAPTER 2 - PM Management and IT Context
L1 - Introduction to python Backend.pptx
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PTS Company Brochure 2025 (1).pdf.......
Odoo POS Development Services by CandidRoot Solutions
Design an Analysis of Algorithms I-SECS-1021-03
top salesforce developer skills in 2025.pdf

Using all of the high availability options in MariaDB

  • 1. Using all of the high availability options in MariaDB WAGNER BIANCHI MariaDB RDBA Team Lead MariaDB Corporation
  • 2. About MariaDB Corporation MariaDB frees companies from the costs, constraints and complexity of proprietary databases, enabling them to reinvest in what matters most – rapidly developing innovative, customer-facing applications. MariaDB uses pluggable, purpose-built storage engines to support workloads that previously required a variety of specialized databases. With complexity and constraints eliminated, enterprises can now depend on a single complete database for all their needs, whether on commodity hardware or their cloud of choice. Deployed in minutes for transactional or analytical use cases, MariaDB delivers unmatched operational agility without sacrificing key enterprise features including real ACID compliance and full SQL. Trusted by organizations such as Deutsche Bank, DBS Bank, Nasdaq, Red Hat, The Home Depot, ServiceNow and Verizon – MariaDB meets the same core requirements as proprietary databases at a fraction of the cost. No wonder it’s the fastest growing open source database. Real business relies on MariaDB™.
  • 3. @BIANCHI Wagner Bianchi has been working with the MySQL ecosystem for more than 12 years now. He is an Oracle ACE Director since 2014 and has worked on the most complex environments running Open Source solutions. Bianchi joint MariaDB RDBA Team in 2017 where he works as Remote DBA Team Lead @ MariaDB Remote DBA Team. He is specialized in multi-tier/HA/FT setups when multi-integrations are needed to keep systems highly available and fault-tolerant. MySQL Expert (DEV, DBA, NDB CLUSTER), AWS Certified Solutions Architect, and Splunk Architect, Bianchi has worked with the biggest environments running MariaDB products like MaxScale, MariaDB Server, AWS, Azure, providing architecture [re]design, products upgrades, and migrations. bianchi@mariadb.com @wagnerbianchijr wagnerbianchi.com mariadb.com/blog
  • 4. ABSTRACT MariaDB Corporation provides a number of high availability options, including the native MariaDB Server replication with automatic failover and multi-master clustering, the MariaDB Cluster which leverages the environment with a fault-tolerant solution, the MariaDB Spider that make it possible to shard and scale the environment, and the MariaDB MaxScale that can be mixed up with all other solutions to provide an excellent overall solution for any mission-critical application. In this session, we’ll provide a comprehensive overview the high availability features in MariaDB, highlight their impact on consistency and performance, discuss advanced failover strategies and introduce new features such as casual reads and transparent connection failover.
  • 6. AGENDA ● High-Availability ● Fault Tolerant systems ● Single Point of Failure ● MariaDB Server Replication: ○ Asynchronous; ○ Semi-synchronous; ● MariaDB Cluster ● MaxScale HA ● MariaDB in the Cloud ● MariaDB Spider
  • 7. High- Availability ● MariaDB TX provides high availability via asynchronous or semi-synchronous master/slave replication with automatic failover and synchronous multi-master clustering;
  • 8. Fault Tolerance ● MariaDB have products that when working together can provide fault tolerance and operations continuity:
  • 9. Single Point Of Failure ● Replication clusters can failover on failures using MaxScale: ○ Switchover/Failover/Automatic Rejoin capabilities; ● The MariaDB Cluster fails can trigger new master election on MaxScale; ○ MaxScale protects environments against multi-master writes; ○ The same replication servers roles are used for MariaDB Cluster: ■ Master and Slaves, one master at a time. ● MaxScale can be setup in HA: ○ Standby redundancy, when one instance out of three is active at a given time; ○ Active redundancy, when all instances are receiving and routing traffic; ■ Maxscale active and passive configurations; ■ It should be planned since the setup.
  • 11. MariaDB Server Replication - Asynchronous ● With asynchronous replication, transactions are replicated after being committed;
  • 12. MariaDB Server Replication - Semi-synchronous ● With semi-synchronous replication, a transaction is not committed until it has been replicated to a slave; The semi-sync repl plugin was merged into the server on MariaDB Server 10.3.3 - (MDEV-13073)
  • 13. MariaDB Cluster ● MariaDB TX supports multi-master clustering via MariaDB Cluster (i.e., Galera Cluster); The MariaDB MaxScale is meant to help you keep things in good shape in scenarios like this one.
  • 14. MariaDB MaxScale High-Availability and Fault-Tolerance Configurations
  • 15. MariaDB MaxScale - Replication Scale Reads ● If master/slave replication is used for both high availability and read scalability, the database proxy, MariaDB MaxScale, can route writes to the master and load balance reads across the slaves using read-write splitting; The MariaDB MaxScale CCR filter can help with avoiding reading stale data from slaves; The MariaDB MaxScale Cache Filter can help adding a cache layer with a dedicated port to read cached data, avoiding hitting the databases for recurrent read operations;
  • 16. MariaDB MaxScale - Replication Failover ● The MariaDB MaxScale has built-in automatic failover. If it is enabled, and the master fails, it will promote the most up-to-date slave (based on GTID) to master and reconfigure the remaining slaves (if any) to replicate from it:
  • 17. MariaDB MaxScale - Replication Switchover ● When having operational issues with the current master or even having the need to move the current master away, promoting one of the existing slaves as the new master, the switchover is welcome; ○ replication_user=mariadb #: replication user ○ replication_password=ACEEF153D52F8391E3218F9F2B259EAD #: replication password ○ switchover_timeout=90 #: time to complete ● There is a command to call out a monitor module so the switchover happens: $ maxctrl call command mariadbmon switchover replication-monitor opmdb02 OK #: what does the maxscale log says? 2019-01-06 20:29:14.596 notice : (redirect_slaves_ex): All redirects successful. 2019-01-06 20:29:14.607 notice : (manual_switchover): Switchover 'opmdb01' -> 'opmdb02' performed. 2019-01-06 20:29:14.765 notice : (mon_log_state_change): Server changed state: opmdb01[10.0.0.11:3306]: new_slave. [Master, Running] -> [Slave, Running] 2019-01-06 20:29:14.765 notice : (mon_log_state_change): Server changed state: opmdb02[10.0.0.12:3306]: new_master. [Slave, Running] -> [Master, Running]
  • 18. MariaDB MaxScale - Replication Failover ● The MariaDBMon monitor is configured with: ○ failcount=5 #: number of passes/checks if a server failed ○ monitor_interval=1000 #: time in ms for each of the passes ○ auto_failover=true #: if the automatic failover is enabled ○ failover_timeout=10 #: time in secs the failover ops has to complete ● The formula for the failover to happen, though, is: #: automatric_failover = monitor_interval * failcount 2018-01-12 20:19:39 error : Monitor was unable to connect to server [192.168.50.13]:3306 : "Can't connect to MySQL server on '192.168.50.13' (115)" 2018-01-12 20:19:44 warning: [mariadbmon] Master has failed. If master status does not change in 5 monitor passes, failover begins.
  • 19. MariaDB MaxScale - Replication Rejoin ● When auto_rejoin is enabled, the monitor will rejoin any standalone database servers or any slaves replicating from a relay master to the main cluster: 2019-01-04 19:54:25.266 notice : (mon_log_state_change): Server changed state: opmdb01[10.0.0.11:3306]: server_up. [Down] -> [Running] 2019-01-04 19:54:25.277 notice : (do_rejoin): Directing standalone server 'opmdb01' to replicate from 'opmdb02'. 2019-01-04 19:54:25.295 notice : (create_start_slave): Slave connection from opmdb01 to [10.0.0.12]:3306 created and started. 2019-01-04 19:54:25.295 notice : (handle_auto_rejoin): 1 server(s) redirected or rejoined the cluster. 2019-01-04 19:54:25.764 notice : (mon_log_state_change): Server changed state: opmdb01[10.0.0.11:3306]: new_slave. [Running] -> [Slave, Running]
  • 20. MariaDB MaxScale - Clustering ● If multi-master clustering is used for both high availability and read scalability, the MariaDB MaxScale can assign master/slave roles to obtain better scale; The MariaDB MaxScale uses the concept of master and slave to protect the cluster against writing to multiple nodes at the same time; Here, if the current master crashes, a new master is elected immediately; Cluster nodes can be configured with priorities to have better control on new elections;
  • 21. DEMO - MaxScale ● Let's see how it works: ○ Switchover; ○ Failover; ○ Automatic Rejoin.
  • 22. Making the MariaDB MaxScale Highly Available High-Availability and Fault-Tolerance Configurations
  • 23. MaxScale Highly Available ● Two situations to make MaxScale Highly Available: ○ MaxScale on-premisses; ○ MaxScale in the Cloud; ● Additional software needed for integrating the final solution: ○ Keepalived, when on premisses and having a private VIP; ○ XLB + Corosync/Pacemaker when in the Cloud; ■ Active redundancy, you don't need extra packages, just an LB and MaxScale instances; ■ Standby redundancy, you need to handle who is online at a given time (healthy vs unhealthy); ● MariaDB RDBA proven cases in the Cloud:
  • 24. MaxScale Highly Available - AWS In this case, there are two types of setup: ● Active Redundancy, when all three instances of MaxScale will be receiving traffic and routing to backends. In case one of the instances fail, traffic flow continues and you have time to provisioning a new one and add that under the LB. You need to handle MaxScale passive mode. ● Standby Redundancy, one of the instances is taking traffic at a time and the others appears as unhealthy under the LB. It requires additional packages; we use Corosync/Pacemaker to handle that;
  • 25. MaxScale Highly Available ● MaxScale, when running in passive mode (MariaDBMon): ○ It does not do a failover for replication clusters; ○ It does not execute an automatic rejoin for replication clusters; ○ It does not execute scripts as response to monitor events. ● For GaleraMon: ○ No special protection against events; ○ Don't force new elections using priorities; ○ If new elections is a concern, root_node_as_master can help, but, slow the election time and cannot be fault-tolerant.
  • 26. DEMO - MaxScale Highly Available Let's see how it works: ● Three MariaDB MaxScale instances; ● Active Redundancy; ● Standby Redundancy. AWS Console - Target Groups Configuration
  • 27. MaxScale Standby Redundancy ● Using the NLB endpoint, create a database: ● Start a sysbench job: #: let's create a database named "openworks" mysql -uappuser -p123 -hOPNLB-114bf4e40f0b7526.elb.us-east-1.amazonaws.com -e "create database openworksdb" #: let's prepare a sysbench job/task using the openworks database sysbench --test=/usr/share/sysbench/oltp_read_write.lua --table_size=10000 --mysql-db=openworksdb --tables=20 --mysql-user=appuser --mysql-port=3306 --db-driver=mysql --threads=8 --events=0 --time=60 --rand-type=uniform --mysql-password=123 --mysql-host=OPNLB-114bf4e40f0b7526.elb.us-east-1.amazonaws.com --report-interval=1 prepare #: run the sysbench sysbench --test=/usr/share/sysbench/oltp_read_write.lua --table_size=10000 --mysql-db=openworksdb --tables=20 --mysql-user=appuser --mysql-port=3306 --db-driver=mysql --threads=8 --events=0 --time=60 --rand-type=uniform --mysql-password=123 --mysql-host=OPNLB-114bf4e40f0b7526.elb.us-east-1.amazonaws.com --report-interval=1 run
  • 29. MariaDB Spider - Storage Engine Overview ● The Spider Storage Engine has two main components: ○ Spider Proxy Server: which receives the external queries/transactions; ○ Spider Hosts: known also as servers, created when configuring the shard. ● Uses cases reinforce its usage more for sharding: ○ Shards based on PARTITIONING Functions, which provides horizontal partitioning; ○ Shards data by HASH(), RANGE(), LIST(); ● It can be used also to create remote of federated tables.
  • 30. MariaDB Spider - Storage Engine Demo Let's see how it works: ● Show an environment running Spider: ○ Show created servers; ○ Show created table; ○ Show table created on nodes; ○ Show key distribution.