MySQL cluster is a technology that applies memory database clusters in SNA (ShareNothingArchitecture) systems. This non-shared architecture can make the system use low-cost hardware to obtain high scalability. A MySQL cluster is a distributed design designed to achieve zero point of failure. Therefore, any component should have
A MySQL cluster is a technology that applies a memory database cluster in a SNA (Share Nothing Architecture) system. This non-shared architecture can make the system use low-cost hardware to obtain high scalability. A MySQL cluster is a distributed design designed to achieve zero point of failure. Therefore, any component should have
A MySQL cluster is a technology that applies a memory database cluster in a SNA (Share Nothing Architecture) system. This non-shared architecture can make the system use low-cost hardware to obtain high scalability.
A MySQL cluster is a distributed design designed to achieve zero point of failure. Therefore, any component should have its own memory and disk. Any shared storage solutions such as network sharing, network file systems and SAN devices are not recommended or supported. With this redundant design, MySQL claims that the data availability can reach 99.999%.
In fact, a MySQL cluster integrates a memory Cluster Storage engine called NDB with a standard MySQL server. It contains a group of computers, each running one or more processes, which may include a MySQL server, a data node, a Management Server, and a proprietary data access program. Shows the relationship between them:
Storage Engine
MySQL Cluster uses a dedicated memory-based storage engine. The advantage of this is that the speed is fast and there is no disk I/O bottleneck, but because it is memory-based, therefore, the size of the database is limited by the total memory of the system. If the MySQL server running NDB must have enough memory, such as 4G, 8G, or even 16G. The NDB engine is distributed and can be configured on multiple servers for data reliability and scalability, theoretically, by configuring two NDB storage nodes, we can achieve the redundancy of the entire database cluster and solve the single point of failure (spof) problem.
This storage engine has the following drawbacks:
Based on memory, the size of the database is limited by the total memory size of the cluster.
Based on memory, data may be lost after power failure, which also needs to be verified by testing.
Multiple nodes implement communication, data synchronization, query, and other operations through the network. Therefore, the overall performance is affected by the network speed,
Therefore, the speed is also slow.
Of course, it also has its advantages:
Multiple nodes can be distributed across different geographic locations. Therefore, it is also a solution for implementing distributed databases.
The scalability is good. You can expand the database cluster by adding nodes.
Redundancy is good, and multiple nodes have complete database data. Therefore, any node downtime will not cause service interruption.
The cost of achieving high availability is relatively low. Unlike traditional high availability solutions, shared storage devices and dedicated software are required for implementation, and NDB can be implemented with enough memory.
Architecture
A MySQL Cluster consists of three services with different functions. Each service is provided by a dedicated daemon. A service is also called a node. The following describes the functions of each node.
The management (MGM) node
Management Nodes are used to manage the entire cluster. Theoretically, only one cluster is started and the downtime does not affect the cluster service. This process only takes effect when the cluster is started and the nodes are added to the cluster, therefore, this node does not need to be redundant. Theoretically, a server can provide services.
Run the ndb_mgmd command and use the config. ini configuration file.
The storage or database (DB) node:
Database nodes, used to store data, can be different from management nodes (MGM), user-side nodes (APIS) can be on different machines, or on the same machine, there must be at least one DB node in the cluster. When there are more than two DB nodes, the high availability of the cluster can be ensured. When the DB nodes increase, the processing speed of the cluster slows down.
Start with the ndbd command. When creating a cluster DB node for the first time, use the-init parameter for initialization.
Example: bin/ndbd-ndb-connectstring = ndb_mgmd.mysqlcluster.net-initial
The client (API) node:
The client node can be used to access the cluster DB. This node is a common mysqld process. You need to configure the ndbcluster command in the configuration file to open the NDB Cluster storage engine, adding an API node increases the concurrent access speed and overall throughput of the entire cluster. This node can be deployed on a Web application server or a dedicated server, it is also deployed on the same server as the database.
Start with the mysqld_safe command,
These three types of nodes can be distributed on different hosts. For example, databases can be multiple dedicated servers, or each database has an API, of course, APIs can also be distributed on front-end Web servers. Generally, the more APIs, the better the cluster performance.