MYSQL CLUSTER
Presented by:
Ayoub MKHARBACH
Hamid LEGHOUL
● Framed by:
Yassine SENHAJI
[Link]
●Rida Boussif
OBJECTIVES
Understand the concept of clustering
Know MySQL Cluster
Set up a high availability architecture
•Install, configure and administer MySQL Cluster
PLAN :
➢ Problematic
➢ Definitions
➢ Architecture
➢ Operation of MySQL Cluster
➢ Advantages of MySQL Cluster
➢ Demonstration
PROBLEMATIC
The issue of data distribution is a major problem.
of information management infrastructures. While the approach
history consists of sizing a single server so that it
absorbs all the load, we have been observing a trend for several years
inverse, inspired by RAID techniques for storage volumes, which
consists of taking a very large number of low-cost machines to
form a storage cluster.
DEFINITIONS
RAID
Redundant Array Of Independent Disks is a set of
techniques ofstorage virtualizationallowing to distribute some
dataover severalhard drivesafin d'améliorer soit les
performance, whether security or fault tolerance of
the whole of the system or systems.
CLUSTER
A 'cluster' is an architecture
made up of several computers forming nodes, where each
nodes can operate independently of each other.
A client is conversing with a cluster, as if it were a
unique machine.
MYSQL CLUSTER
MySQL Cluster is thedatabasedistributed fromMySQLShe
allows to distribute data across multiple servers without having to
single point of failure.
ARCHITECTURE
CONCEPT
Replication
Horizontal Data Partitioning
Hybrid Storage
No single point of failure
THE TYPES OF NODES
Data node (ndbd process)
Management node (process ndb_mgmd)
SQL node (mysqld process)
OPERATION OF
MYSQL CLUSTER
Operation of MySQL Cluster
When the data is stored in the NDBCluster engine, the tables
are distributed across the NDBCluster nodes.
These tables are directly accessible from all other servers.
MySQL is part of the Cluster.
If an application updates a line, all other servers will see it.
immediately.
The data stored in the table engine of MySQL Cluster can
be duplicated, and are able to handle the unavailability of a node
without any other impact than the cancellation of the transactions that used these
data.
ADVANTAGES OF
MYSQL CLUSTER
ADVANTAGES OF MYSQL CLUSTER
Auto-Sharding for the deployment of read and write operations
Continuous operation thanks to a 99.999% availability
Less than one second recovery time and self-repair capability
Online operations: allocation, redistribution, and maintenance
Global data center deployment: reaching an international clientele
SQL and NoSQL interfaces for agile development
Low total cost of ownership
Proven deployments
Provisioning of precisely tuned clusters in just a few clicks
Best operational practices for MySQL Cluster
DEMONSTRATION
FOR ALL SERVERS
SELINUX must be disabled on all servers. Modify the file
SELINUX configuration in /etc/sysconfig/selinux:
$ SELINUX=disabled
Disabled the firewall on all servers.
$ service iptables stop
$ chkconfig iptables off
$ setenforce 0
MANAGEMENT NODE
Download and install MySQL Cluster (management and tools)
$ cd /usr/local/src
$ wget [Link]
7.0/MySQL-Cluster-gpl-management-7.0.35-1.rhel5.x86_64.rpm
$ wget [Link]
7.0/MySQL-Cluster-gpl-tools-7.0.34-1.rhel5.x86_64.rpm
$ rpm -Uhv MySQL-Cluster-gpl-management-7.0.35-1.rhel5.x86_64.rpm
$ rpm -Uhv MySQL-Cluster-gpl-tools-7.0.34-1.rhel5.x86_64.rpm
MANAGEMENT NODE
Create the mysql-cluster directory and the configuration file [Link]:
$mkdir -p /var/lib/mysql-cluster
$vi /var/lib/mysql-cluster/[Link]
And add the following line:
[ndb_mgmd default]
DataDir=/var/lib/mysql-cluster
ndbd]
[ndb_mgmd] HostName=@mysql-data1
HostName=@mysql-management
[ndbd]
HostName=@mysql-data2
[ndbd default]
NoOfReplicas=2 [mysqld]
DataMemory=256M HostName=@mysql-mysqld1
IndexMemory=128M
DataDir=/var/lib/mysql-cluster
[
THE DATA NODES
Download and install the MySQL storage package from here:
$ cd /usr/local/src
$ wget [Link]
7.0/MySQL-Cluster-gpl-storage-7.0.35-1.rhel5.x86_64.rpm
$ rpm -Uhv MySQL-Cluster-gpl-storage-7.0.35-1.rhel5.x86_64.rpm
Add the following line under /etc/[Link]:
[mysqld]
ndbcluster
ndb-connectstring=@mysql-management
[mysql_cluster]
ndb-connectstring=@mysql-management
SQL NODE
The first step is to remove mysql-libs and install the package
desired
$ yum remove mysql-libs -y
$ yum install libaio -y
Download MySQL client, server, shared:
$ cd /usr/local/src
$ wget [Link]
7.2/MySQL-Cluster-X-gpl-7.2.8-
1.el6.x86_64.rpm/from/[Link]
X = client, server,shared
SQL NODE
Install all packages:
$ rpm -Uhv MySQL-Cluster-*
•Add the following lines in /etc/[Link]:
[mysqld]
ndbcluster
ndb-connectstring=@mysql-management
default_storage_engine=ndbcluster
[mysql_cluster]
ndb-connectstring=@mysql-management
START THE CLUSTER
To activate the cluster, we will need to follow this order:
Management Node > Data Node > SQL Node
In the management node, executing the command:
$ ndb_mgmd -f /var/lib/mysql-cluster/[Link]
In the data nodes, executing the commands:
$ ndbd
$service mysql start
STOP THE CLUSTER
To stop the cluster, we must follow this order:
SQL Node > Management Node / Data Node
Connect to the SQL node and run the following command:
$ service mysql stop
Connect to the management node and execute the command
next:
$ ndb_mgm -e shutdown