Day 21 NDB Storage Engine (Cluster)

MySQL also support High Availability, NDB Storage engine provides high availability- shared-nothing system, NDB Cluster integrates the standard MySQL server with an in-memory clustered storage engine called NDB (which stands for “Network DataBase”

NDB Cluster required 3 Nodes required complete the setup:

  • Management node(mgmd):

This node is used to manage the cluster, using this node we can configured, start and stop the cluster, using this node only we can run the backup- ndb_mgmd.

As the name suggest, this node contains the actual data. There should be more than 1 data node required for data redundancy (replica). Default set to 2- these replca’s will contain the same information and if any one node goes down data will be available on other node.

Eg. If we have 4 data node with replica of 2, then their will be 2 set of 2 replica’s and each contains part of data(set). ndbd (data node daemon), ndbmtd (multi-threaded)

NDB Cluster tables are normally stored completely in memory rather than on disk (this is why we refer to NDB Cluster as an in-memory database). The data will be flushed from memory to data nodes periodically using LCP and GCP.

Local Checkpoint (LCP):

This is checkpoint to data node, it save the data from memory to disk occurs every few minutes. It depends upon the amount of data stored by the node, the level of cluster activity, and other factors.

Global Checkpoint (GCP):

GCP occurs every few seconds, when transactions for all nodes are synchronized and the redo-log is flushed to disk.

This node contains MySQLD mysql services, using this node Cluster data will be accessed. This is also called as API node.

Each data node or SQL node requires a my.cnf file as follows:

[mysqld]

ndbcluster

ndb-connectstring=ndb_mgmd.mysql.com

[ndbd]

connect-string=ndb_mgmd.mysql.com

[ndb_mgm]

connect-string=ndb_mgmd.mysql.com

ndb_mgmd]

config-file=/etc/config.ini

The management node needs a config.ini file, this is important and contains all the information about NDB Cluster (SQL Node, Data Node and management node) For our representative setup, the config.ini file should read as follows:

[ndbd default]

NoOfReplicas=2   # replicas

DataMemory=80M   # memory allocate – data storage

IndexMemory=18M   # memory allocate – index storage

              

ndb_mgmd]

HostName=HostNm # MGM node

DataDir=/var/lib/mysql-cluster                               #MGM node log files location

 

[ndbd]

HostName=DataNode1           

NodeId=2                      

DataDir=/usr/local/mysql/data  

 

[ndbd]

HostName=DataNode2

NodeId=3                      

DataDir=/usr/local/mysql/data  

 

[mysqld]

HostName=SQLHostNm

 

The management node should be started first, followed by the data nodes, and then finally by any SQL nodes:

It support sonly READ COMMITTED transaction isolation level

 

Reference:

https://www.ppgia.pucpr.br/pt/arquivos/techdocs/mysql/mysql-cluster.html

Advertisements
This entry was posted in Disaster Recovery, High Avaliability, Isolation Level, MySQL, Others and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.