MySQL Cluster
   HOME

TheInfoList



OR:

MySQL Cluster is a technology providing
shared-nothing A shared-nothing architecture (SN) is a distributed computing architecture in which each update request is satisfied by a single node (processor/memory/storage unit) in a computer cluster. The intent is to eliminate contention among nodes. Nodes do ...
clustering and auto-sharding for the
MySQL MySQL () is an open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query Language. A relational database ...
database management system In computing, a database is an organized collection of data stored and accessed electronically. Small databases can be stored on a file system, while large databases are hosted on computer clusters or cloud storage. The design of databases ...
. It is designed to provide high availability and high throughput with low latency, while allowing for near linear scalability. MySQL Cluster is implemented through the NDB or NDBCLUSTER storage engine for MySQL ("NDB" stands for Network Database).


Architecture

MySQL Cluster is designed around a distributed, multi-master
ACID In computer science, ACID ( atomicity, consistency, isolation, durability) is a set of properties of database transactions intended to guarantee data validity despite errors, power failures, and other mishaps. In the context of databases, a se ...
compliant architecture with no
single point of failure A single point of failure (SPOF) is a part of a system that, if it fails, will stop the entire system from working. SPOFs are undesirable in any system with a goal of high availability or reliability, be it a business practice, software ap ...
. MySQL Cluster uses automatic
sharding A database shard, or simply a shard, is a horizontal partition of data in a database or search engine. Each shard is held on a separate database server instance, to spread load. Some data within a database remains present in all shards, but so ...
(partitioning) to scale out read and write operations on commodity hardware and can be accessed via SQL and Non-SQL (NoSQL) APIs


Replication

Internally MySQL Cluster uses synchronous replication through a
two-phase commit In transaction processing, databases, and computer networking, the two-phase commit protocol (2PC) is a type of atomic commitment protocol (ACP). It is a distributed algorithm that coordinates all the processes that participate in a distributed ...
mechanism in order to guarantee that data is written to multiple nodes upon committing the data. (This is in contrast to what is usually referred to as "MySQL Replication", which is .) Two copies (known as ''replicas'') of the data are required to guarantee availability. MySQL Cluster automatically creates “node groups” from the number of replicas and data nodes specified by the user. Updates are synchronously replicated between members of the node group to protect against data loss and support fast failover between nodes. It is also possible to replicate asynchronously between clusters; this is sometimes referred to as "MySQL Cluster Replication" or "geographical replication". This is typically used to replicate clusters between data centers for
disaster recovery Disaster recovery is the process of maintaining or reestablishing vital infrastructure and systems following a natural or human-induced disaster, such as a storm or battle.It employs policies, tools, and procedures. Disaster recovery focuses on ...
or to reduce the effects of network latency by locating data physically closer to a set of users. Unlike standard MySQL replication, MySQL Cluster's geographic replication uses
optimistic concurrency control Optimistic concurrency control (OCC), also known as optimistic locking, is a concurrency control method applied to transactional systems such as relational database management systems and software transactional memory. OCC assumes that multiple tr ...
and the concept of Epochs to provide a mechanism for conflict detection and resolution, enabling active/active clustering between data centers. Starting with MySQL Cluster 7.2, support for synchronous replication between data centers was supported with the Multi-Site Clustering feature.


Horizontal data partitioning (auto-sharding)

MySQL Cluster is implemented as a fully distributed multi-master database ensuring updates made by any application or SQL node are instantly available to all of the other nodes accessing the cluster, and each data node can accept write operations. Data within MySQL Cluster (NDB) tables is automatically partitioned across all of the data nodes in the system. This is done based on a hashing algorithm based on the
primary key In the relational model of databases, a primary key is a ''specific choice'' of a ''minimal'' set of attributes ( columns) that uniquely specify a tuple ( row) in a relation ( table). Informally, a primary key is "which attributes identify a recor ...
on the table, and is transparent to the end
application Application may refer to: Mathematics and computing * Application software, computer software designed to help the user to perform specific tasks ** Application layer, an abstraction layer that specifies protocols and interface methods used in a c ...
. Clients can connect to any node in the cluster and have queries automatically access the correct shards needed to satisfy a query or commit a transaction. MySQL Cluster is able to support cross-shard queries and transactions. Users can define their own partitioning schemes. This allows developers to add “distribution awareness” to applications by partitioning based on a sub-key that is common to all rows being accessed by high running transactions. This ensures that data used to complete transactions is localized on the same shard, thereby reducing network hops.


Hybrid storage

MySQL Cluster allows datasets larger than the capacity of a single machine to be stored and accessed across multiple machines. MySQL Cluster maintains all indexed columns in distributed memory. Non-indexed columns can also be maintained in distributed memory or can be maintained on disk with an in-memory
page cache In computing, a page cache, sometimes also called disk cache, is a transparent cache for the pages originating from a secondary storage device such as a hard disk drive (HDD) or a solid-state drive (SSD). The operating system keeps a page cache ...
. Storing non-indexed columns on disk allows MySQL Cluster to store datasets larger than the aggregate memory of the clustered machines. MySQL Cluster writes
Redo Undo is an interaction technique which is implemented in many computer programs. It erases the last change done to the document, reverting it to an older state. In some more advanced programs, such as graphic processing, undo will negate the las ...
logs to disk for all data changes as well as check pointing data to disk regularly. This allows the cluster to consistently recover from disk after a full cluster outage. As the Redo logs are written
asynchronous Asynchrony is the state of not being in synchronization. Asynchrony or asynchronous may refer to: Electronics and computing * Asynchrony (computer programming), the occurrence of events independent of the main program flow, and ways to deal wit ...
ly with respect to transaction commit, some small number of transactions can be lost if the full cluster fails, however this can be mitigated by using geographic replication or multi-site cluster discussed above. The current default asynchronous write delay is 2 seconds, and is configurable. Normal single point of failure scenarios do not result in any data loss due to the synchronous data replication within the cluster. When a MySQL Cluster table is maintained in memory, the cluster will only access disk storage to write Redo records and checkpoints. As these writes are sequential and limited random access patterns are involved, MySQL Cluster can achieve higher write throughput rates with limited disk hardware compared to a traditional disk-based caching RDBMS. This checkpointing to disk of in-memory table data can be disabled (on a per-table basis) if disk-based persistence isn't needed.


Shared nothing

MySQL Cluster is designed to have no
single point of failure A single point of failure (SPOF) is a part of a system that, if it fails, will stop the entire system from working. SPOFs are undesirable in any system with a goal of high availability or reliability, be it a business practice, software ap ...
. Provided that the cluster is set up correctly, any single node, system, or piece of hardware can fail without the entire cluster failing. Shared disk ( SAN) is not required. The interconnects between nodes can be standard
Ethernet Ethernet () is a family of wired computer networking technologies commonly used in local area networks (LAN), metropolitan area networks (MAN) and wide area networks (WAN). It was commercially introduced in 1980 and first standardized in 1 ...
,
Gigabit Ethernet In computer networking, Gigabit Ethernet (GbE or 1 GigE) is the term applied to transmitting Ethernet frames at a rate of a gigabit per second. The most popular variant, 1000BASE-T, is defined by the IEEE 802.3ab standard. It came into use ...
,
InfiniBand InfiniBand (IB) is a computer networking communications standard used in high-performance computing that features very high throughput and very low latency. It is used for data interconnect both among and within computers. InfiniBand is also use ...
, or SCI interconnects.


SQL and NoSQL APIs

As MySQL Cluster stores tables in data nodes, rather than in the MySQL Server, there are multiple interfaces available to access the database: * SQL access via the MySQL Server * NoSQL APIs where MySQL Cluster libraries can be embedded into an application to provide direct access to the data nodes without passing through a SQL layer. These include: *
Memcached
*
Node.js / JavaScript
*

*
HTTP / REST
*


MySQL Cluster Manager

Part of the commercial MySQL Cluster CGE, MySQL Cluster Manager is a tool designed to simplify the creation and administration of the MySQL Cluster CGE database by automating common management tasks, including on-line scaling, upgrades, backup/restore and reconfiguration. MySQL Cluster Manager also monitors and automatically recovers MySQL Server application nodes and management nodes, as well as the MySQL Cluster data nodes.


Implementation

MySQL Cluster uses three different types of nodes (processes) : * Data node (ndbd/ndbmtd process): These nodes store the data. Tables are automatically sharded across the data nodes which also transparently handle load balancing, replication, failover and self-healing. * Management node (ndb_mgmd process): Used for configuration and monitoring of the cluster. They are required only to start or restart a cluster node. They can also be configured as arbitrators, but this is not mandatory (MySQL Servers can be configured as arbitrators instead).Jon Stephens, Mike Kruckenberg, Roland Bouman (2007)
"MySQL 5.1 Cluster DBA Certification Study Guide"
pp. 86
* Application node or SQL node (mysqld process): A MySQL server (mysqld) that connects to all of the data nodes in order to perform data storage and retrieval. This node type is optional; it is possible to query data nodes directly via the NDB API, either natively using the C++ API or one of the additional NoSQL APIs described above. Generally, it is expected that each node will run on a separate physical host, VM or cloud instance (although it is very common to co-locate Management Nodes with MySQL Servers). For best practice, it is recommended not to co-locate nodes within the same node group on a single physical host (as that would represent a single point of failure).


Versions

From the 8.0 release onwards, MySQL Cluster is based directly on the corresponding 8.0 releases of the MySQL Server. Previously, MySQL Cluster version numbers were decoupled from those of MySQL Server - for example MySQL Cluster 7.6 was based on/contained the server component from MySQL 5.7. Higher versions of MySQL Cluster include all of the features of lower versions, plus some new features. Older versions (no longer in development): * Ndb included in MySQL 5.1.X source tree * MySQL Cluster 6.2 based on MySQL 5.1.A :First 'telco' or 'carrier grade edition' release. Supports 255 nodes, online table alter, replication latency and throughput enhancements etc. * MySQL Cluster 6.3 based on MySQL 5.1.B :Includes compressed backup + LCP, circular replication support, conflict detection/resolution, table optimization etc. * MySQL Cluster 7.0 based on MySQL 5.1.C :Includes multi-threaded data nodes (ndbmtd), Transactional DDL, Windows support. * MySQL Cluster 7.1 based on MySQL 5.1.D :Includes ClusterJ and ClusterJPA connectors Currently available versions: * MySQL Cluster 7.2 based on MySQL 5.5 :Includes Adaptive Query Localization (pushes JOIN operations down to the data nodes), Memcached API, simplified Active/Active Geographic replication, multi-site clustering, data node scalability enhancements, consolidated user privileges. * MySQL Cluster 7.3 based on MySQL 5.6 :Includes support for
foreign key A foreign key is a set of attributes in a table that refers to the primary key of another table. The foreign key links these two tables. Another way to put it: In the context of relational databases, a foreign key is a set of attributes subject to ...
constraints,
Node.js Node.js is an open-source server environment. Node.js is cross-platform and runs on Windows, Linux, Unix, and macOS. Node.js is a back-end JavaScript runtime environment. Node.js runs on the V8 JavaScript Engine and executes JavaScript cod ...
/
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of websites use JavaScript on the client side for webpage behavior, of ...
API and an auto-installer. * MySQL Cluster 7.4 based on MySQL 5.6 :Includes enhanced conflict detection and resolution, improved node restart times, new Event API. * MySQL Cluster 7.5 based on MySQL 5.7 :Includes support for bigger datasets(more than 128TB per node), improved read scalability through read optimized tables, improved SQL support. * MySQL Cluster 7.6 based on MySQL 5.7 :Improved restart and recovery times, reduced disk space usage, improved join performance, new import tool, shared memory communication, improved topology awareness for cloud. * MySQL Cluster 8.0 based on MySQL 8.0 :Increase in max row size to 30kB, Support for up to 144 data nodes, Improved distributed filtering and joining, Support for parallel outer joins and semi joins, Improved schema and ACL handling, Online column rename, Simplified configuration, Multithreaded parallel backup and restore, Disk data performance improvements, Enhanced support for 3 and 4 replica configurations, Support for multi socket mesh networking, Support for restore transformations, Improved Blob write performance, Backup encryption, Support for IPv6, Threading autoconfiguration, Improved recovery performance, Improved query multithreading.


Requirements

For evaluation purposes, it is possible to run MySQL Cluster on a single physical server. For production deployments, the minimum system requirements are for 3 x instances / hosts: * 2 × Data Nodes * 1 × Application / Management Node or * 2 × Data Node + Application * 1 × Management Node Configurations as follows: * OS:
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
, Solaris,
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for se ...
.
macOS macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
(for development only) * CPU: Intel/AMD x86/x86-64, UltraSPARC * Memory: 1GB * HDD: 3GB * Network: 1+ nodes (Standard Ethernet - TCP/IP) Tips and recommendations on deploying highly performant, production grade clusters can be found in th
MySQL Cluster Evaluation Guide
and th
Guide to Optimizing Performance of the MySQL Cluster Database


History

MySQL AB MySQL AB was a Swedish software company founded in 1995. It was acquired by Sun Microsystems in 2008, Sun was in turn acquired by Oracle Corporation in 2010. MySQL AB is the creator of MySQL, a relational database management system, as well as ...
acquired the technology behind MySQL Cluster from Alzato, a small
venture company Venture capital (often abbreviated as VC) is a form of private equity financing that is provided by venture capital firms or funds to start-up company, startups, early-stage, and emerging companies that have been deemed to have high growth poten ...
started by
Ericsson (lit. "Telephone Stock Company of LM Ericsson"), commonly known as Ericsson, is a Swedish multinational networking and telecommunications company headquartered in Stockholm. The company sells infrastructure, software, and services in inform ...
. NDB was originally designed for the
telecom market Telecom may refer to: * Telecommunications ** A telephone company (or ''telecommunications service provider'') ** The telecommunications industry * Telecom Animation Film, a Japanese studio See also * Telcom (disambiguation) * Telekom (disamb ...
, with its
high availability High availability (HA) is a characteristic of a system which aims to ensure an agreed level of operational performance, usually uptime, for a higher than normal period. Modernization has resulted in an increased reliance on these systems. F ...
and high performance requirements. MySQL Cluster based on the NDB storage engine has since been integrated into the
MySQL MySQL () is an open-source relational database management system (RDBMS). Its name is a combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the acronym for Structured Query Language. A relational database ...
product, with its first release being in MySQL 4.1.


Books

MySQL Cluster 7.5 inside and out. Book written by Mikael Ronström, the founder of the NDB technology. Pro MySQL NDB Cluster. Book written by Jesper Wisborg Krogh and Mikiya Okuno, support engineers of MySQL.


Support

MySQL Cluster is licensed under the GPLv2 license. Commercial support is available as part of MySQL Cluster CGE, which also includes non-open source addons such as MySQL Cluster Manager, MySQL Enterprise Monitor, in addition to MySQL Enterprise Security and MySQL Enterprise Audit.


See also

* Galera Cluster, a generic synchronous multi-master replication library for transactional databases, for MySQL and MariaDB

*
Percona Percona is an American company based in Durham, North Carolina and the developer of a number of open source software projects for MySQL, MariaDB, PostgreSQL, MongoDB and RocksDB users. The company’s revenue of around $25 million a year is der ...
XtraDB Cluster, also is a combination of Galera replication library and MySQL supporting multi master. * RonDB A fork of MySQL Cluster maintained by Hopsworks.


References


External links


MySQL


Official MySQL Cluster DocumentationMySQL Cluster DemonstrationMySQL Cluster DatasheetMySQL Cluster Auto-Installer TutorialMySQL Cluster Whitepapers and GuidesMySQL Cluster Community Forum


Other


Design and Modelling of a Parallel Data Server for Telecom Applications (1997)
Original MySQL Cluster design motivation. {{MySQL MySQL Cluster computing