Mysql Cluster Overview
The most significant advantage of MySql Cluster is high availability, high real-time performance, high redundancy, and high scalability.
It allows you to deploy the Cluster of the "in memory" database in a non-shared system. without a shared architecture, the system can use cheap hardware. in addition, since each component has its own memory and disk, there is no single point of failure.
It consists of a group of computers with various processes running on each computer, including mysql servers, NDB cluster data nodes, management service initiation, and specialized data access programs.
All these nodes constitute a complete mysql cluster system. the data is stored in the storage engine of "NDB storage server", and the table (structure) is saved in "mysql Server. the application accesses these data tables through the "mysql Server", and the cluster management server manages the "NDB storage server" through the management tool (ndb_mgmd ".
MySQL Cluster details: click here
MySQL Cluster: click here
Recommended reading:
MySQL Cluster backup and recovery
MySQL Cluster installation Configuration
Create a Cluster environment using three MySQL clusters. DOC
MySQL Cluster7.2 online addition of data nodes has major drawbacks
Basic Concepts
"NDB" is a "in-memory" storage engine with high availability and good data consistency. the following describes the process of a mysql cluster node. A single computer can have any number of nodes.
Management Nodes (MGM): these nodes manage other nodes in the mysql cluster, such as configuration files and cluster logs, start and stop nodes, and run backups. each node in the cluster retrieves configuration data from the Management Server and requests the location of the management server. when a new event occurs in the data node, the node transmits the information about the event to the management server, and then writes the information to the cluster log. Because these nodes are responsible for managing the configurations of other nodes, you should first start these nodes before starting other nodes. The MGM node is started with the command "ndb_mgmd ".
Data nodes (NDB): these nodes are used to save cluster data. the number of data nodes is related to the number of copies, which is a multiple of fragments. suppose there are two copies, each of which has two fragments, then there are four data nodes. however, there is no need to set multiple copies. the data node is started with the "ndbd" command.
SQL node: This is the node used to access cluster data. for MYSQL cluster, the client node is a traditional Mysql server that uses the NDB cluster Storage engine. generally, SQL nodes Add "ndbcluster" to "my. use "mysqld" to start cnf
In addition, there can be any number of cluster client processes or programs. They are divided into two types: Standard mysql client and management client.
Standard mysql client: Access mysql cluster from existing mysql applications written in php, perl, c, c ++, java, python, ruby, etc.
Management clients: these clients are connected to management servers and provide commands such as starting and stopping nodes, starting and stopping message tracing, displaying node versions and statuses, and starting and stopping backups.
The following is the MySQL Cluster architecture:
Because Mysql Cluster uses TCP/IP connection and data transmission between nodes is not encrypted, it uses a separate subnet.
Next we will deploy
For convenience, I put the management nodes, data nodes, and SQL nodes on one machine.
Management Node 1 10.1.6.205
Data Node 1 10.1.6.203
Data Node 2 10.1.6.205
SQL Node 1 10.1.6.203
SQL Node 2 10.1.6.205
1. Install (7.2.6 is installed here)
Download the mysql-cluster-gpl-7.2.6-linux2.6-x86_64.tar.gz Binary Package (including ndb and mysql)
Root@10.1.6.205 :~ # Tar-C/usr/local-xzvf mysql-cluster-gpl-7.2.6-linux2.6-x86_64.tar.gz
Root@10.1.6.205:/usr/local # ln-s/usr/local/mysql-cluster-gpl-7.2.8-linux2.6-i686/usr/local/mysql
Root@10.1.6.205:/usr/local # cd mysql
Root@10.1.6.205:/usr/local/mysql # scripts/mysql_install_db -- user = mysql
Root@10.1.6.205:/usr/local/mysql # chown-R mysql: mysql/usr/local/mysql
Similarly, 10.1.6.203
2. Configure SQL nodes and NDB nodes
Root@10.1.6.205:/usr/local/mysql # vim/etc/my. cnf
[Mysqld]
Basedir =/usr/local/mysql/
Datadir =/usr/local/mysql/data/
User = mysql
Port = 3306
Socket =/tmp/mysql. sock
Ndbcluster
Max_connect_errorrs = 10000
Ndb-connectstring = 10.1.6.205
Connect_timeout = 300
[Mysql_cluster]
Ndb-connectstring = 10.1.6.205
Similarly, 10.1.6.203
3. Configuration Management Node
Root@10.1.6.205:/usr/local/mysql # vim/opt/cluster/config. ini
[Ndbd default]
NoOfReplicas = 2
DataMemory = 80 M # allocate the memory used by data storage. Each ndb occupies
IndexMemory = 18 M # allocate the memory used by index storage for each ndb
[Tcp default]
Portnumber = 2205 # ndb listening port
# Set Management Nodes
[Ndb_mgmd]
NodeId = 1
Hostname = 10.1.6.205
Datadir =/opt/cluster # directory for storing logs on MGM
# Set the storage node NDB1
[Ndbd]
NodeId = 2
Hostname = 10.1.6.203
Datadir =/usr/local/mysql/data
# Set the storage node NDB2
[Ndbd]
NodeId = 3
Hostname = 10.1.6.205
Datadir =/usr/local/mysql/data
# Set SQL Node 1
[Mysqld]
NodeId = 4
Hostname = 10.1.6.203
# Set SQL Node 2
[Mysqld]
NodeId = 5
Hostname = 10.1.6.205
[Mysqld] # Run any ip connection
[Mysqld]
To continue reading the highlights of this article, please refer to page 2nd: