SlideShare a Scribd company logo
MariaDB Cluster for High Availability
World Most Advanced Open Source Database Cluster
April 29, 2015
Sonali Minocha and Abdul Manaf
MariaDB Galera Cluster
Introducing OSSCube
• Global Solutions Provider
• Consulting, Development, Integration, and Support
• Develop Integrated Enterprise Business Solutions
• Open Source
• CMMI Level 3 accredited
• Continuous Delivery for fast, predictable projects
• Flexible Delivery Model
• Support Projects or Staff Augmentation
• Scale up or down as required
OSSCube Practice Areas
• PHP – The World’s Only Zend Center of Excellence
• CRM - SugarCRM
• Marketing Automation – Act-On
• Content Management System – Drupal
• Product Information Management - Pimcore
• Enterprise Mobile and Web applications
• E-Commerce – Magento
• BPM and Workflow – BonitaSoft and ProcessMaker
• Enterprise Architecture and Consulting
• BI and Data Integration – Pentaho and Talend
• Big Data – Hadoop, Cloudera, Spark
• Database – MySQL, MariaDB
• Cloud based large computing capacity - AWS
Integrated Business Solutions
Webinar Agenda
• Concept of High Availability
• MySQL native replication and problems
• Overview of Galera cluster
• Galera cluster architecture
• MariaDB Galera 3 Node Implementation
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
• High availability refers to the ability of users to access a system without loss of service
Do you need high availability ? If you are not certain, consider the following question:
• Which level of availability do I need?
– How many nines? or How much downtime can your business survive?
• Do I require no loss of data?
– Could I loose some transactions?
– Will my users notice or care?
• Do I need automatic fail over or is manual switchover OK?
– How do I test this?
Availability Calculation
Availability = Uptime / (Uptime + Downtime)
Principles and Causes of loosing HA
Principles of High Availability
• Elimination of single points of failure
• Reliable crossover. In multi threaded systems, the crossover point itself tends to become a
single point of failure. High availability engineering must provide for reliable crossover.
• Detection of failures as they occur. If the two principles above are observed, then a user may
never see a failure. But the maintenance activity must.
Scheduled and unscheduled downtime
Causes of loosing it (unscheduled downtime)
• Failures of hosts
• Failures of Databases / MySQL
• Operating system
• The hardware
• Maintenance activity that may otherwise cause downtime
• And many more ……
MySQL HA Solutions
The primary solutions supported by MySQL include:
• MySQL Native Replication
• MySQL Cluster
• MySQL with DRBD
• Oracle VM Template for MySQL
• MySQL with Solaris Cluster
• MariaDB Galera Cluster
We will be covering:
• MySQL Native Replication Issues
• MariaDB Galera Cluster
Replication Overview and Components
• One of the “killer” features of MySQL
• Introduced in version 3.23
• Master
– Binary logs
• Row Format
• Statement Format
– Bin log dump thread on master
• Slave
– Relay logs
– IO and SQL thread on slave
– master.info and relay-log.info files
• Row format was introduced in 5.1
• Lots of improvements in 5.6
Replication Topologies Summary
Limitations and Known Issues
• Human error: updating slave instead of master
• Non-deterministic SQL, bugs, and other
• Binary Logging format issue
– Row
– Statement
• Limited availability
– Replication can break
– Replication can lag behind
– Replication can be out of sync
• Manual or at best semi-automatic fail over, tricky to automate.
• Limited write capacity: single threaded ( Up to MySQL 5.5 ) causes
slave lag
• Asynchronous = You will lose data
Master/Slave Based Failover
Simplest example, plain replication
Widely used
Manual failover
Manual operation required
Master-Master Based Failover
Using MMM
Transfer IP1 and IP to the
surviving server
Other Issues
• Duplicate Error on Slave
• Query caused different error on Master and
Slave
• Temp Table doesn't exist after slave restarts
• Binary log and relay log corruption
• Slave read from wrong position after crash
• And many more...
Galera cluster
Overview of Galera Cluster
Galera Cluster Features & Benefits
• Synchronous replication
• Active-Active multi-master topology
• Read and write to any cluster node
• Automatic membership control, failed nodes drop from the cluster
• Automatic node joining
• True parallel replication, on row level
• Direct client connections, native MySQL look & feel
• Available on Linux only
• No slave lag
• No lost transactions
• Both read and write scalability
• Smaller client latencies
Galera Cluster
• Provides virtually synchronous
replication
• Works with InnoDB
• No slave lag
• Transactions are validated by
slave on Transaction commit
– Certification based
replication
• Master – Master or Master –
Slave is possible
Certification Based Replication
• Certification-based replication uses group
communication and transaction ordering techniques to
achieve synchronous replication.
What Certification Based Replication Requires
• Transactional Database
• Atomic Changes
• Global Ordering
Certification Based Replication
Internal Architecture of Galera Cluster
Galera Cluster revolves around four components:
• Database Management System (DBMS)
• wsrep API
– wsrep hooks
– dlopen()
• Galera Replication Plugin
• Group Communication Plugins
State Transfers
The process of replicating data from the cluster to the individual node,
bringing the node into sync with the cluster, is known as
provisioning.
Methods available in Galera Cluster to provision nodes
• State Snapshot Transfers (SST) Where a snapshot of the entire node
state transfers.
• Incremental State Transfers (IST) Where only the missing
transactions transfer.
State Snapshot Transfers (SST)
The cluster provisions nodes by transferring a
full data copy from one node to another.
• Logical
– mysqldump
• Physical
– rsync
– xtrabackup
Incremental State Transfers (IST)
The cluster provisions a node by identifying the missing transactions
on the joiner and sends them only, instead of the entire state.
• This provisioning method is only available under certain conditions:
– Where the joiner node state UUID is the same as that of the group.
– Where all missing write-sets are available in the donor’s write-set
cache.
• For example, say that you have a node in your cluster that falls
behind the cluster.
• This node carries a node state that reads: 5a76ef62-30ec-11e1-
0800-dba504cf2aab:197222 Meanwhile, the current node state on
the cluster reads 5a76ef62-30ec-11e1-0800-dba504cf2aab:201913
Galera Cluster is
Important Status Variables
MySQL Native Replication Galera Cluster
Implementation
MariaDB 3 Node Cluster Implementation
How To Configure a Galera Cluster with MariaDB
on Ubuntu 12.04 Servers
• Basic set up for MariaDB Galera Cluster requires minimum of 3 Nodes
• In our demo we will be using 3 Linux ubuntu 12.04 nodes
• In order to configure cluster we will be following some basic steps on every node , on Node1 execute following steps
• STEP 1 : Remove old MySQL if already installed for fresh installation
– apt-get remove --purge mysql-server mysql-client mysql-common
– apt-get autoremove
– apt-get autoclean
• STEP 2 : Add the MariaDB Repositories
– apt-get install python-software-properties
– apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
– add-apt-repository 'deb http://mirror3.layerjet.com/mariadb/repo/10.0/ubuntu precise main‘
– apt-get update
• STEP 3 : Install MariaDB with Galera Patches
– apt-get install rsync
– apt-get install galera
– apt-get install mariadb-galera-server
How To Configure a Galera Cluster with MariaDB
on Ubuntu 12.04 Servers
• STEP 4 : Configure MariaDB and Galera
– Create Galera configuration file under /etc/mysql/conf.d/
– Most basic Galera configuration
[mysqld]
#mysql settings
binlog_format=ROW
default-storage-engine=innodb
innodb_autoinc_lock_mode=2
query_cache_size=0
query_cache_type=0
bind-address=0.0.0.0
#galera settings
wsrep_provider=/usr/lib/galera/libgalera_smm.so
wsrep_cluster_name="my_wsrep_cluster"
wsrep_cluster_address="gcomm://192.168.10.184,192.168.10.185,192.168.10.186“ ## IP of nodes who will be part of cluster
wsrep_sst_method=rsync
• STEP 1 to STEP 4 will be followed on every Node
Starting the Galera Cluster
• After Step 4 MariaDB is ready to run individually on every node
Starting nodes to run as part of cluster
• Stop MySQL on all nodes
– service mysql stop
• On Node1 Start MySQL to run as cluster
– service mysql start --wsrep-new-cluster
• On All other nodes start mysql simply as
– service mysql start
– Check the variable “wsrep_cluster_size%”
Thank You!
We love to connect with you.
Twitter (@OSSCubeIndia)
Facebook (www.facebook.com/osscubeindia)
LinkedIn (www.linkedin.com/company/osscube)
Google+ (plus.google.com/u/0/+OSSCubeIndia/posts )

More Related Content

PDF
Introduction to Galera Cluster
PDF
MariaDB MaxScale
PDF
Galera cluster for high availability
PDF
MariaDB Galera Cluster presentation
PDF
MariaDB Performance Tuning and Optimization
PDF
The InnoDB Storage Engine for MySQL
PDF
HBase replication
PDF
MariaDB: in-depth (hands on training in Seoul)
Introduction to Galera Cluster
MariaDB MaxScale
Galera cluster for high availability
MariaDB Galera Cluster presentation
MariaDB Performance Tuning and Optimization
The InnoDB Storage Engine for MySQL
HBase replication
MariaDB: in-depth (hands on training in Seoul)

What's hot (20)

PPT
Galera Cluster Best Practices for DBA's and DevOps Part 1
PDF
M|18 Architectural Overview: MariaDB MaxScale
PDF
ProxySQL High Avalability and Configuration Management Overview
PDF
How to Manage Scale-Out Environments with MariaDB MaxScale
PDF
The Complete MariaDB Server tutorial
PPTX
Maria DB Galera Cluster for High Availability
PPTX
Apache HBase Performance Tuning
PPTX
MySQL_MariaDB-성능개선-202201.pptx
PPTX
PDF
Introduction into Ceph storage for OpenStack
PDF
A crash course in CRUSH
PPTX
Maxscale 소개 1.1.1
PDF
HBase Advanced - Lars George
PDF
Optimizing MariaDB for maximum performance
PDF
Performance tuning in BlueStore & RocksDB - Li Xiaoyan
PDF
The Full MySQL and MariaDB Parallel Replication Tutorial
PDF
MariaDB 10.11 key features overview for DBAs
PDF
Maxscale switchover, failover, and auto rejoin
PPT
Introduction to redis
PDF
MySQL High Availability Solutions
Galera Cluster Best Practices for DBA's and DevOps Part 1
M|18 Architectural Overview: MariaDB MaxScale
ProxySQL High Avalability and Configuration Management Overview
How to Manage Scale-Out Environments with MariaDB MaxScale
The Complete MariaDB Server tutorial
Maria DB Galera Cluster for High Availability
Apache HBase Performance Tuning
MySQL_MariaDB-성능개선-202201.pptx
Introduction into Ceph storage for OpenStack
A crash course in CRUSH
Maxscale 소개 1.1.1
HBase Advanced - Lars George
Optimizing MariaDB for maximum performance
Performance tuning in BlueStore & RocksDB - Li Xiaoyan
The Full MySQL and MariaDB Parallel Replication Tutorial
MariaDB 10.11 key features overview for DBAs
Maxscale switchover, failover, and auto rejoin
Introduction to redis
MySQL High Availability Solutions
Ad

Similar to MariaDB Galera Cluster (20)

PDF
SQL Server Clustering for Dummies
PDF
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
PDF
Dr and ha solutions with sql server azure
PPT
MySQL Performance Tuning at COSCUP 2014
PPT
2010 12 mysql_clusteroverview
PPTX
Disaster Recovery Site Implementation with MySQL
PPTX
Db spof(mssql, my sql)
PDF
Mtc learnings from isv & enterprise interaction
PPTX
Mtc learnings from isv & enterprise (dated - Dec -2014)
PPTX
MySQL Options in OpenStack
PDF
OpenStack Days East -- MySQL Options in OpenStack
PDF
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
PPTX
MySQL London Tech Tour March 2015 - MySQL Fabric
PPTX
Ame 2269 ibm mq high availability
PDF
Netherlands Tech Tour 02 - MySQL Fabric
PPTX
Membase Meetup - Silicon Valley
PDF
Training Slides: Basics 102: Introduction to Tungsten Clustering
PDF
Membase East Coast Meetups
PDF
Membase Intro from Membase Meetup San Francisco
PPTX
SQL Server Clustering Part1
SQL Server Clustering for Dummies
Transitioning From SQL Server to MySQL - Presentation from Percona Live 2016
Dr and ha solutions with sql server azure
MySQL Performance Tuning at COSCUP 2014
2010 12 mysql_clusteroverview
Disaster Recovery Site Implementation with MySQL
Db spof(mssql, my sql)
Mtc learnings from isv & enterprise interaction
Mtc learnings from isv & enterprise (dated - Dec -2014)
MySQL Options in OpenStack
OpenStack Days East -- MySQL Options in OpenStack
Webinar Slides: MySQL HA/DR/Geo-Scale - High Noon #5: Oracle’s InnoDB Cluster
MySQL London Tech Tour March 2015 - MySQL Fabric
Ame 2269 ibm mq high availability
Netherlands Tech Tour 02 - MySQL Fabric
Membase Meetup - Silicon Valley
Training Slides: Basics 102: Introduction to Tungsten Clustering
Membase East Coast Meetups
Membase Intro from Membase Meetup San Francisco
SQL Server Clustering Part1
Ad

More from Abdul Manaf (6)

PPTX
MySQL HA Sharding-Fabric
PPTX
What's New In MySQL 5.6
PPTX
Talend AS A Product
PPTX
NoSQL Evolution
PPT
MySQL Replication Basics
PPTX
MySQL Architecture and Engine
MySQL HA Sharding-Fabric
What's New In MySQL 5.6
Talend AS A Product
NoSQL Evolution
MySQL Replication Basics
MySQL Architecture and Engine

MariaDB Galera Cluster

  • 1. MariaDB Cluster for High Availability World Most Advanced Open Source Database Cluster April 29, 2015 Sonali Minocha and Abdul Manaf
  • 3. Introducing OSSCube • Global Solutions Provider • Consulting, Development, Integration, and Support • Develop Integrated Enterprise Business Solutions • Open Source • CMMI Level 3 accredited • Continuous Delivery for fast, predictable projects • Flexible Delivery Model • Support Projects or Staff Augmentation • Scale up or down as required
  • 4. OSSCube Practice Areas • PHP – The World’s Only Zend Center of Excellence • CRM - SugarCRM • Marketing Automation – Act-On • Content Management System – Drupal • Product Information Management - Pimcore • Enterprise Mobile and Web applications • E-Commerce – Magento • BPM and Workflow – BonitaSoft and ProcessMaker • Enterprise Architecture and Consulting • BI and Data Integration – Pentaho and Talend • Big Data – Hadoop, Cloudera, Spark • Database – MySQL, MariaDB • Cloud based large computing capacity - AWS
  • 6. Webinar Agenda • Concept of High Availability • MySQL native replication and problems • Overview of Galera cluster • Galera cluster architecture • MariaDB Galera 3 Node Implementation
  • 7. 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 • High availability refers to the ability of users to access a system without loss of service Do you need high availability ? If you are not certain, consider the following question: • Which level of availability do I need? – How many nines? or How much downtime can your business survive? • Do I require no loss of data? – Could I loose some transactions? – Will my users notice or care? • Do I need automatic fail over or is manual switchover OK? – How do I test this?
  • 8. Availability Calculation Availability = Uptime / (Uptime + Downtime)
  • 9. Principles and Causes of loosing HA Principles of High Availability • Elimination of single points of failure • Reliable crossover. In multi threaded systems, the crossover point itself tends to become a single point of failure. High availability engineering must provide for reliable crossover. • Detection of failures as they occur. If the two principles above are observed, then a user may never see a failure. But the maintenance activity must. Scheduled and unscheduled downtime Causes of loosing it (unscheduled downtime) • Failures of hosts • Failures of Databases / MySQL • Operating system • The hardware • Maintenance activity that may otherwise cause downtime • And many more ……
  • 10. MySQL HA Solutions The primary solutions supported by MySQL include: • MySQL Native Replication • MySQL Cluster • MySQL with DRBD • Oracle VM Template for MySQL • MySQL with Solaris Cluster • MariaDB Galera Cluster We will be covering: • MySQL Native Replication Issues • MariaDB Galera Cluster
  • 11. Replication Overview and Components • One of the “killer” features of MySQL • Introduced in version 3.23 • Master – Binary logs • Row Format • Statement Format – Bin log dump thread on master • Slave – Relay logs – IO and SQL thread on slave – master.info and relay-log.info files • Row format was introduced in 5.1 • Lots of improvements in 5.6
  • 13. Limitations and Known Issues • Human error: updating slave instead of master • Non-deterministic SQL, bugs, and other • Binary Logging format issue – Row – Statement • Limited availability – Replication can break – Replication can lag behind – Replication can be out of sync • Manual or at best semi-automatic fail over, tricky to automate. • Limited write capacity: single threaded ( Up to MySQL 5.5 ) causes slave lag • Asynchronous = You will lose data
  • 14. Master/Slave Based Failover Simplest example, plain replication Widely used Manual failover Manual operation required
  • 15. Master-Master Based Failover Using MMM Transfer IP1 and IP to the surviving server
  • 16. Other Issues • Duplicate Error on Slave • Query caused different error on Master and Slave • Temp Table doesn't exist after slave restarts • Binary log and relay log corruption • Slave read from wrong position after crash • And many more...
  • 17. Galera cluster Overview of Galera Cluster
  • 18. Galera Cluster Features & Benefits • Synchronous replication • Active-Active multi-master topology • Read and write to any cluster node • Automatic membership control, failed nodes drop from the cluster • Automatic node joining • True parallel replication, on row level • Direct client connections, native MySQL look & feel • Available on Linux only • No slave lag • No lost transactions • Both read and write scalability • Smaller client latencies
  • 19. Galera Cluster • Provides virtually synchronous replication • Works with InnoDB • No slave lag • Transactions are validated by slave on Transaction commit – Certification based replication • Master – Master or Master – Slave is possible
  • 20. Certification Based Replication • Certification-based replication uses group communication and transaction ordering techniques to achieve synchronous replication. What Certification Based Replication Requires • Transactional Database • Atomic Changes • Global Ordering
  • 22. Internal Architecture of Galera Cluster Galera Cluster revolves around four components: • Database Management System (DBMS) • wsrep API – wsrep hooks – dlopen() • Galera Replication Plugin • Group Communication Plugins
  • 23. State Transfers The process of replicating data from the cluster to the individual node, bringing the node into sync with the cluster, is known as provisioning. Methods available in Galera Cluster to provision nodes • State Snapshot Transfers (SST) Where a snapshot of the entire node state transfers. • Incremental State Transfers (IST) Where only the missing transactions transfer.
  • 24. State Snapshot Transfers (SST) The cluster provisions nodes by transferring a full data copy from one node to another. • Logical – mysqldump • Physical – rsync – xtrabackup
  • 25. Incremental State Transfers (IST) The cluster provisions a node by identifying the missing transactions on the joiner and sends them only, instead of the entire state. • This provisioning method is only available under certain conditions: – Where the joiner node state UUID is the same as that of the group. – Where all missing write-sets are available in the donor’s write-set cache. • For example, say that you have a node in your cluster that falls behind the cluster. • This node carries a node state that reads: 5a76ef62-30ec-11e1- 0800-dba504cf2aab:197222 Meanwhile, the current node state on the cluster reads 5a76ef62-30ec-11e1-0800-dba504cf2aab:201913
  • 27. Important Status Variables MySQL Native Replication Galera Cluster
  • 28. Implementation MariaDB 3 Node Cluster Implementation
  • 29. How To Configure a Galera Cluster with MariaDB on Ubuntu 12.04 Servers • Basic set up for MariaDB Galera Cluster requires minimum of 3 Nodes • In our demo we will be using 3 Linux ubuntu 12.04 nodes • In order to configure cluster we will be following some basic steps on every node , on Node1 execute following steps • STEP 1 : Remove old MySQL if already installed for fresh installation – apt-get remove --purge mysql-server mysql-client mysql-common – apt-get autoremove – apt-get autoclean • STEP 2 : Add the MariaDB Repositories – apt-get install python-software-properties – apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db – add-apt-repository 'deb http://mirror3.layerjet.com/mariadb/repo/10.0/ubuntu precise main‘ – apt-get update • STEP 3 : Install MariaDB with Galera Patches – apt-get install rsync – apt-get install galera – apt-get install mariadb-galera-server
  • 30. How To Configure a Galera Cluster with MariaDB on Ubuntu 12.04 Servers • STEP 4 : Configure MariaDB and Galera – Create Galera configuration file under /etc/mysql/conf.d/ – Most basic Galera configuration [mysqld] #mysql settings binlog_format=ROW default-storage-engine=innodb innodb_autoinc_lock_mode=2 query_cache_size=0 query_cache_type=0 bind-address=0.0.0.0 #galera settings wsrep_provider=/usr/lib/galera/libgalera_smm.so wsrep_cluster_name="my_wsrep_cluster" wsrep_cluster_address="gcomm://192.168.10.184,192.168.10.185,192.168.10.186“ ## IP of nodes who will be part of cluster wsrep_sst_method=rsync • STEP 1 to STEP 4 will be followed on every Node
  • 31. Starting the Galera Cluster • After Step 4 MariaDB is ready to run individually on every node Starting nodes to run as part of cluster • Stop MySQL on all nodes – service mysql stop • On Node1 Start MySQL to run as cluster – service mysql start --wsrep-new-cluster • On All other nodes start mysql simply as – service mysql start – Check the variable “wsrep_cluster_size%”
  • 32. Thank You! We love to connect with you. Twitter (@OSSCubeIndia) Facebook (www.facebook.com/osscubeindia) LinkedIn (www.linkedin.com/company/osscube) Google+ (plus.google.com/u/0/+OSSCubeIndia/posts )