hochverfügbarkeit mit mariadb enterprise - mariadb roadshow summer 2014 hamburg berlin frankfurt
DESCRIPTION
Hochverfügbarkeit mit MariaDB Enterprise Presented by Ralf Gebhardt at the MariaDB Roadshow Germany: 4.7.2014 in Hamburg, 8.7.2014 in Berlin and 11.7.2014 in Frankfurt.TRANSCRIPT
Hochverfügbarkeit mit MariaDB Enterprise
MariaDB Roadshow 2014 Hamburg -‐ Berlin -‐ Frankfurt
Ralf Gebhardt, Sales Engineer [email protected]
© SkySQL – The MariaDB Company
Agenda
• IntroducSon to High Availability • Different services that need HA • Different components of High Availability • Different MariaDB HA SoluSons
• HA using MariaDB ReplicaSon • HA using MariaDB Galera Cluster
© SkySQL – The MariaDB Company
IntroducSon to High Availability
High availability is a system design protocol and associated
implementation that ensures a certain degree of operational continuity during
a given measurement period
© SkySQL – The MariaDB Company
IntroducSon to High Availability
• High Availability isn’t always the same as Long Up(me
• A system that is “up” might sSll not be accessible • A system that is “down” just once, but for a long Sme, isn’t highly available
• High Availability rather means • Long Mean Time Between Failures (MTBF) • Short Mean Time To Recover (MTTR)
© SkySQL – The MariaDB Company
IntroducSon to High Availability
• The level of availability is measured as the raSo of Sme the system is available over a year, expressed as a percentage
• 99.9% availability means that the system is available at least 8.751 of 8.760 hours in a year, or that it is unavailable at the most 9 hours per year • 99.999% availability means that the system is available at least 525.595 or 525.600 minutes in a year, or that it is unavailable at the most 5 minutes per year
© SkySQL – The MariaDB Company
Maintaining High Availability
• There are two common situaSons that we try to protect ourselves from using an HA soluSon
• Datacenter failure – A whole datacenter becomes unavailable for some reason, like power failure, network failure, a virus or similar situaSons • Server failure – An individual server fails because of a hardware failure or something similar
© SkySQL – The MariaDB Company
Services in an HA SoluSon
• All services that make up the applicaSon stack needs HA for the system to achieve HA
• Web servers • ApplicaSon servers • ApplicaSons • Database servers • Storage • Network
TCO for Unbreakable
Hardware
© SkySQL – The MariaDB Company
Services in an HA SoluSon
• Of the different types of services, there are two types
• Stateless services These servers has no state beyond the current operaSon. If such a server fails, another server of the same type can replace it without having to transfer any set of data. Webservers and applicaSon servers are typical stateless services
• Stateful services These services maintains a state, and that state needs to be preserved if a server fails, and has to be made available to any other server that takes it place. A database service such as a MariaDB server is a typical stateful service
© SkySQL – The MariaDB Company
Components of High Availability
• Monitoring and Management • Availability of the services needs to be monitored, to be able to take acSon when there is a failure. A failover can be manual or automaSc, but it has to be managed
• Failover / Load Balancing mechanism • Some mechanism to redirect traffic from the failed server or Datacenter and to a working one
• Data redundancy • For stateful services, we need to make sure that data is somehow made redundant
© SkySQL – The MariaDB Company
Monitoring and Management
• There are many different soluSons here, some focused on specific services (in parScular database), some as part of a Load Balancing sogware soluSon of an Appliance or a pure sogware based soluSon such as LinuxHA, HAProxy, MaxScale, MHA
© SkySQL – The MariaDB Company
Failover mechanism
• There is a wide range of opSons here too, in parScular when it comes to Datacenter failover, which can be more complicated
• Common mechanisms range from applicaSon based failover and DNS failover to Load Balancing and Network Failover
© SkySQL – The MariaDB Company
Data Redundancy
• Providing Data Redundancy is complex, error prone and takes a toll on performance
• It also has to be menSoned that a SAN does not provide redundancy just because a disk set can be failed over from one server to another. A SAN might be a SPOF, but in some cases that is a risk that some customers is willing to take
© SkySQL – The MariaDB Company
Data Redundancy with MariaDB
• MariaDB Internal ReplicaSon • Asynchronous • Semi-‐Synchronous
• Storage based redundancy (AcSve/Passive) • DRBD (Distributed Replicated Block Device) • SAN (Storage Area Network) • VMWare replicaSon
• MariaDB Galera Cluster
© SkySQL – The MariaDB Company
HA using MariaDB ReplicaSon
• This is in many cases a good enough soluSon, but it has some issues
• The cluster is very loosely coupled, not all nodes are aware of all the other nodes for example • ReplicaSon is asynchronous, so failing over is more difficult than usually (but MHA solves this) • Adding a slave is difficult
• But there are also many advantages • Low performance penalty • Well known and easy to use technology
© SkySQL – The MariaDB Company
HA using MariaDB Galera Cluster
• This a sogware-‐only soluSon with many advantages
• Scales writes and well as reads • “Proper” Cluster with built-‐in failover, locking and split-‐brain protecSon • Synchronous replica(on with low overhead due to opSmisSc locking
• There are some disadvantages • More overhead than using Asynchronous ReplicaSon • Only works with InnoDB • For distributed writes, some restricSons apply
© SkySQL – The MariaDB Company
MariaDB Galera Cluster setup
MariaDB Server MariaDB Server MariaDB Server
Galera wsrep Library Galera wsrep Library Galera wsrep Library
Synchronous Replication
Load Balancer / Failover
Application / Application server
© SkySQL – The MariaDB Company
Sejng up MariaDB Galera Cluster
• MariaDB Galera Cluster consists of the MariaDB binary that in turns talks to the Galera wsrep library
• Once set up, Galera is configured using the usual my.cnf file, and is monitored using the SHOW GLOBAL STATUS command
© SkySQL – The MariaDB Company
MariaDB Galera Cluster failover
• MariaDB Galera Cluster handles failed servers internally
• MariaDB Galera Cluster also handles split-‐brain protec(on and this requires at least 3 servers
• MariaDB Galera Cluster can also be configured without split-‐brain protecSon, for example when failover is manual or is handled in some other way
© SkySQL – The MariaDB Company
MariaDB Galera Cluster setup
• If necessary to allow for protecSon against split-‐brain scenarios, but only using 2 database servers, a third server can be set up with a Galera specific arbitra(on agent
• Galera also can be used with it’s own simple Load Balancer, although it is much more common that other technologies are used, such as HA aware Connectors or a Load Balancer
Fragen?
www.mariadb.com www.facebook.com/mariadb.dbms
www.twiner.com/mariadb
Vielen Dank!
Hochverfügbarkeit mit MariaDB Enterprise
© Copyright 2014 SkySQL Corporation Ab. SkySQL and MariaDB are trademarks or registered trademarks of SkySQL Corporation Ab in the European Union and United States of America and/or other
countries. MySQL is a trademark of Oracle Corporation Inc. Other names may be trademarks of their respective owners.