MySQL Cluster Overview, Architecture, and Practical Deployment Guide
This article introduces MySQL Cluster’s share‑nothing architecture, explains the NDB storage engine’s advantages and drawbacks, describes the management, data, and API node roles, and provides a step‑by‑step configuration and deployment tutorial with command‑line examples.
MySQL Cluster is a distributed, share‑nothing (SNA) system that integrates the NDB in‑memory storage engine with standard MySQL servers, offering high scalability and 99.999% availability without shared storage.
The NDB engine delivers fast, memory‑based access but limits database size to total RAM, may lose data on power loss, and its performance depends on network latency; however, it provides excellent redundancy, geographic distribution, and low‑cost high availability.
Cluster architecture consists of three node types:
Management (MGM) node : runs ndb_mgmd, holds the configuration (config.ini), and coordinates node membership; typically a single instance.
Database (DB) node : runs ndbd, stores data in memory and on disk; at least two nodes are required for redundancy.
API (SQL) node : a regular mysqld process with the NDB engine enabled; multiple API nodes increase concurrency and can be placed on web servers.
The practical deployment steps are:
Prepare three machines (e.g., 192.168.207.153, 192.168.208.3, 192.168.208.9) and install MySQL Cluster source with --with-plugins=innobase,ndbcluster.
Create a config.ini file under a mysql-cluster directory, defining replicas, memory limits, and node definitions (MGM, NDBD, MySQLD).
Start the management node: ~/mysql/bin/ndb_mgmd -f ~/mysql/mysql-cluster/config.ini Start each data node on its host (first time with --initial): ~/mysql/bin/ndbd Configure each SQL node’s my.cnf to enable NDB:
[MYSQL_CLUSTER]
ndb-connectstring=192.168.207.153
[MYSQLD]
ndbcluster
ndb-connectstring=192.168.207.153Start the MySQL service on each API node, e.g.:
/home/taozi/mysql/bin/mysqld_safe --ledir=/home/taozi/mysql/bin --log-error=/home/taozi/mysql/data/t.err --datadir=/home/taozi/mysql/data --socket=/home/taozi/mysql/tmp/mysql.sock --pid-file=/home/taozi/mysql/data/mysqld.pid &Verify the cluster status from the management node: ~/mysql/bin/ndb_mgm -e show Create tables on the SQL nodes using the NDB engine, e.g.:
CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY (id)) ENGINE=ndbcluster DEFAULT CHARSET=gbk;Shutdown the cluster by stopping API nodes, then the management node with ndb_mgm -e shutdown and optionally removing the generated config binary.
Additional notes cover replica configuration, the effect of --initial, handling empty node slots for dynamic IPs, and the need to create databases on each SQL node because automatic discovery is not supported in this version.
Disclaimer: The content is sourced from public internet channels and is provided for reference only; original copyrights belong to the authors.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Art of Distributed System Architecture Design
Introductions to large-scale distributed system architectures; insights and knowledge sharing on large-scale internet system architecture; front-end web architecture overviews; practical tips and experiences with PHP, JavaScript, Erlang, C/C++ and other languages in large-scale internet system development.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
