MySQL Cluster 101

Contents

What is MySQL Cluster

[blockquote source=”Wikipedia”]MySQL Cluster is a technology providing shared-nothing clustering and auto-sharding for the MySQL database management system. It is designed to provide high availability and high throughput with low latency, while allowing for near linear scalability.[2] MySQL Cluster is implemented through the NDB or NDBCLUSTER storage engine for MySQL (“NDB” stands for Network Database).[/blockquote]

For simplicity MySQL Cluster can be defined as   a shared-nothing distributed “database” that is designed for fault tolerance, high availability and high performance.

MySQL Cluster Architecture

MySQL Cluster is made of  three main kind of nodes:

1. Management Node(s) [ndb_mgmd]  –  Are responsible for performing mainly administrative  functions related to the cluster. Management nodes are used to check the status,start & stop nodes that are apart of the cluster. They are also responsible for distributing information about the makeup of the cluster.

2.Data/Storage Node(s)[ndbd] –  These are the nodes that store the data in the cluster. Data nodes do the low level work  of storing or retrieving  the data from either disk or ram.

3.SQL Node(s)[mysqld] – These nodes are responsible for extracting the data from the server. SQL nodes interface between the application and the cluster issuing SQL queries and returning the data.

So How Does It All Work ?(Short Version)

A application(client) talks to the MySQL Cluster by communicating  with one(1) or more SQL nodes(mysqld).  When a SQL node receives a query to update or modify some data,that query is then passed  to the data/storage nodes to process the request . A two-phase commit is carried out to ensure that the data is saved locally  on more than one  data/storage nodes for redundancy in the case of a failure (depends on the NoOfReplicas). If any one write fails the update fails and the transaction is not declared as complete. MySQL Cluster only marks/declares the transaction  as complete  to the client only when  the data/storage nodes have received the request and committed all the changes.

Architecture Diagram

 

MySQL Cluster

 

To design a cluster that is highly available. You would require at minium in my opinion three(3) data nodes, two(2) SQL nodes & two( 2) management nodes

 Installation

See  MySQL Cluster Getting Started  tutorial I wrote to complement this article.

1 Comment MySQL Cluster 101

  1. Pingback: MySQL High Availability Architectures | Skillachie

Leave a Reply

Your email address will not be published. Required fields are marked *