osscube mysql cluster tutorial by sonali at osspac 09

87
MySQL Cluster Tutorial Presented by – Sonali Minocha

Category:

Technology


0 download

DESCRIPTION

Sonali from OSSCube presents on MySQL Cluster Tutorial at OSSPAC 2009 OSSCube-Leading OpenSource Evangelist Company. To know how we can help your business grow, contact: India: +91 995 809 0987 USA: +1 919 791 5472 WEB: www.osscube.com Mail: [email protected]

TRANSCRIPT

Page 1: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

MySQL Cluster Tutorial

Presented by – Sonali Minocha

Page 2: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Who Am I?

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 3: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Architecture and OrganizationArchitecture and Organization

Page 4: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

What is a Cluster?

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 5: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Single MySQL Server Architecture

MySQL ClientMySQL Client MySQL Server

SQL Request

Response

Page 6: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

MySQL Cluster Architecture

MySQL ClientMySQL ClientSQL Request

Response

SQL Node (MySQL server)Data Nodes

Response

NDB API Call

PartitioningReplicationMessage

Page 7: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Components of MySQL Cluster

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 8: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Various Nodes

Application

API Node Data Node

Management Node

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 9: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

(Data Nodes)

NdbClusterEngine

NdbClusterEngine

NdbClusterEngine

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 10: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Organization

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 11: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Partition

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 12: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Partitioning

HorizontalPartitioning

VerticalPartitioning

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 13: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Fragments

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 14: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Node Groups

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 15: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Split Brain

Servers can not see each other

I have full responsibility of the cluster

I have full responsibility of the cluster

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 16: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Arbitration

First Node to ask will continue while the other will be shut down

Network Split

NG 1

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 17: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

More Data Nodes

NG 1

NG 2

Network Split/ Shutdown

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 18: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Arbitrator Issues

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 19: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Arbitrator Issues

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 20: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Normal Operation

I am

Aliv

e

I am

Aliv

eI am

Alive

I am Aliv

e

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 21: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Missed Heartbeats

I am

Aliv

e

I am

Alive

I am

A

live

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 22: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Synchronous

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 23: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Phase One: Commit-Request

Commit

Message

Commit

Message

Response

Message

Response

Message

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 24: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Phase Two: Successful Commit

Transaction

Successful

Transaction

Successful

Commit

Transaction

Commit

Transaction

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 25: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Phase Two: Failure (Abort Commit)

Transaction

Successful

Transaction

Failed

Rollback

Transaction

Rollback

Transaction

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 26: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

INSTALL MySQL CLUSTERINSTALL MySQL CLUSTER

Page 27: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Initiate MySQL Cluster

• # file "config.ini" - 2 data nodes and 2 SQL nodes# This file is placed in the startup directory of ndb_mgmd (the# management server)

• # The first MySQL Server can be started from any host. The second# can be started only on the host MySQLd_5.MySQL.com

• [NDBD DEFAULT]NoOfReplicas= 2DataDir= /var/lib/MySQL-cluster

• [NDB_MGMD]Hostname= ndb_mgmd.MySQL.comDataDir= /var/lib/MySQL-cluster

• [NDBD]HostName= ndbd_2.MySQL.com

• [NDBD]HostName=ndbd_3.MySQL.com

• [MySQLD]• [MySQLD]

HostName= MySQLd_5.MySQL.comMySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 28: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Management Node

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 29: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Data Nodes

• my.cnf# example additions to my.cnf for MySQL Cluster

• [ndbd]

connect-string=ndb_mgmd.MySQL.com

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 30: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Data Node Configurations Options

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 31: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

SQL Nodes• my.cnf• # example additions to my.cnf for MySQL Cluster# (will work on all versions)

• # enable ndbcluster storage engine, and provide connectstring for management

• # server host to the default port 1186• [MySQLd]Ndbcluster

ndbconnectstring=ndb_mgmd.MySQL.com:1186

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 32: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Config.ini ParametersGeneral Parameters

– Id– Hostname

File and Directory Location Parameter– BackupDataDir– DataDir– FileSystemPath

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 33: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09
Page 34: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

•Transaction Handling Parameters•TransactionInactiveTimeout•TransactionDeadlockDetectionTimeout

•Memory Usage Parameters•LockPagesInMainMemory

•Utility Programs•ndb_size.pl

Page 35: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Monitoring the Startup Phases

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube. http://osscube.com/technology/mysql

Page 36: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

MySQL Cluster Storage Engine --NDBMySQL Cluster Storage Engine --NDB

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 37: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

NDB Storage Engine

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 38: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

NDB’s Storage Method

• In-Memory Storage

• Disk-Based Storage– New in MySQL 5.1– Undo Logging– Fixed-Width Columns

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 39: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Tablespace Tablespace

Log File group

DatafileDatafile Datafile Datafile

Redo log Undo Log

Page 40: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Indexes

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 41: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Creating Indexes• Each table in the cluster always has a hash index for a Primary Key

• Ordered indexes can be created with ALTER TABLE ADD INDEX ....

Code Name ContinentBRA Brazil South AmericaCHE Switzerland EuropeCHN China AsiaESP Spain EuropeFIN Finland EuropeGOR United KingdomEuropeIND India AsiaMOR Morocco AfricaSKO South Korea Asia

Data Node Data Node

Country Table: Unique Constraint on Name and Ordered Index on Continent

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 42: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

First Node/First Fragment• Hidden field/table created that will handle the management of the

Unique Index on Name• Ordered Index (T-Tree) created for Continent field

HiddenField

Name_Hash Name Code17832 Morocco MOR24556 Brazil BRA27432 Spain ESP28900 United Kingdom GOR31234 China CHN

HiddenTable

Code_Hash Code Name Continent1351 CHE Switzerland Europe1785 CHN China Asia1943 FIN Finland Europe2031 GOR United Kingdom Europe2345 SKO South Korea Asia

Code_Hash Code Name Continent1351 CHE Switzerland Europe1785 CHN China Asia1943 FIN Finland Europe2031 GOR United Kingdom Europe2345 SKO South Korea Asia

OrderedIndex

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 43: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Second Node/Second Fragment• Same as First Node/Fragment setup• Contains the remaining data

Code Hash Code Name Continent1231 BRA Brazil South America1853 ESP Spain Europe2145 IND India Asia2197 MOR Morocco Africa

Code Hash Code Name Continent1231 BRA Brazil South America1853 ESP Spain Europe2145 IND India Asia2197 MOR Morocco Africa

HiddenField

Name_Hash Name Code17832 Finland FIN24556 South Korea SKO27432 Switzerland CHE28974 India IND

HiddenTable

OrderedIndex

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 44: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Primary Key Lookup

PK values Function()Hash Data nodeData node

Look up row

Data nodeData node

MySQL Server

Unique Key Lookup

Look up row

Unique Key Lookup may require another network hop

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 45: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Parallel Ordered Index Scan

Data nodeData node

Data nodeData nodeMySQL Server

rows

T- Tree Index

T- Tree Index

T- Tree Index

T- Tree Index

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 46: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Parallel full table scan

Data nodeData node

Data nodeData nodeMySQL Server

rows

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 47: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Parallel full table scan ( WHERE condition processed in SQL

node)

Data nodeData node

Data nodeData node

MySQL Server

rows

SQL Query

Many RowsMany RowsFew RowsFew Rows

Where Condition

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 48: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Parallel full table scan ( WHERE condition

processed in data node)

Data nodeData node

Data nodeData node

MySQL Server

rows

SQL Query

Few RowsFew RowsFew RowsFew Rows

Where Condition

Where Condition

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 49: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Storage of Indexes

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 50: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Characteristics of NDB storage Engine

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 51: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Durability

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 52: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Global Check Point

• A GCP occurs every few seconds, when transactions for all nodes are synchronized and the REDO log is flushed to disk

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 53: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Local Check Point

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 54: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Memory - RAM

• Memory AllocationTotal Memory = N(data nodes)* Local Memory / NoOfReplicas -- or --Local Memory = Total Memory * NoOfReplicas / N(data

nodes)

• Sizing up theMemory– Fixed size in memory – Variable sized in memory– Fixed size on disk

Binary(15)1 Byte

Padded

Binary(14)2 BytesPadded

Binary(14)2 BytesPadded

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 55: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Memory Pages

Table BTable BTable A

DataMemoryMemory Page

Table A(up to 32Kb)

IndexMemoryMemory PageTable A

(up to 8Kb)

IndexMemoryMemory Page

Table B(up to 8Kb)

DataMemoryMemory Page

Table B(up to 32Kb)MySQL Cluster Tutorial, OSSPAC 09

Singapore, © OSSCube

Page 56: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 57: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

HANDLING DATA IN MySQL HANDLING DATA IN MySQL

CLUSTERCLUSTER

Page 58: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Disk Data Objects

Log File Group

(Only One per Server)

Table Space

UndoFile

UndoFile

DataFile

DataFile

DataFile

Table Space

DataFile

DataFile

Disk Data Table

Disk Data Table

Disk Data Table

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 59: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Creating the Log File Group• Create Log File Group

CREATE LOGFILE GROUP lg_1 ADD UNDOFILE 'undo_1.dat' INITIAL_SIZE 16M UNDO_BUFFER_SIZE 2M ENGINE NDB;

• Adding Undo Files to Log File GroupALTER LOGFILE GROUP lg_1 ADD UNDOFILE 'undo_2.dat' INITIAL_SIZE 12M ENGINE NDB;

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 60: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Verifying UNDO Files are Created

• INFORMATION_SCHEMA TablesSELECT LOGFILE_GROUP_NAME, LOGFILE_GROUP_NUMBER,

EXTRA

FROM INFORMATION_SCHEMA.FILES

WHERE FILE_NAME = 'undo_1.dat';

SELECT LOGFILE_GROUP_NAME, LOGFILE_GROUP_NUMBER, EXTRA

FROM INFORMATION_SCHEMA.FILES

WHERE FILE_NAME = 'undo_2.dat';

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 61: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Creating the Tablespace• Create a Tablespace

CREATE TABLESPACE ts_1 ADD DATAFILE 'data_1.dat' USE LOGFILE GROUP lg_1 INITIAL_SIZE 32M ENGINE NDB;

• Add an Additional Data FileALTER TABLESPACE ts_1 ADD DATAFILE 'data_2.dat' INITIAL_SIZE 48M ENGINE NDB;

• Verifying Data Files are CreatedSELECT FILE_NAME, LOGFILE_GROUP_NAME, EXTRAFROM INFORMATION_SCHEMA.FILESWHERE TABLESPACE_NAME = 'ts_1' AND FILE_TYPE = 'DATAFILE';

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 62: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Create a Disk Data Table• Non-Indexed Columns Stored on Disk in Tablespace CREATE TABLE dt_1 (

memberId INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,

lName VARCHAR(50) NOT NULL, fName VARCHAR(50) NOT NULL,

dob DATE NOT NULL, joined DATE NOT NULL,

INDEX(lName, fName)

) TABLESPACE ts_1 STORAGE DISK ENGINE NDB;

• Alter Existing Non-Cluster TablesALTER TABLE city TABLESPACE ts1 STORAGE DISK ENGINE=NDB;

• View Table StatusSHOW TABLE STATUS LIKE 'city'\G

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 63: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Monitoring Free Space

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 64: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Dropping Cluster Tables

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 65: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

MySQL CLUSTER MySQL CLUSTER

MANAGEMENTMANAGEMENT

Page 66: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

MySQL Cluster’s Native Backup Tool

• Backup Data– .ctl– .log– .data

• Abort Backupndb_mgm> ABORT BACKUP 6Abort of backup 6 orderedNode 2: Backup 10 started from 1 has been aborted. Error: 1321

Data Node

Data Node

Data Node

Data Node

Backup-1.2.ctlBackup-1.2.logBackup-1.0.2.DataBackup-1.1.2.Data

Backup-1.3.ctlBackup-1.3.logBackup-1.0.3.DataBackup-1.1.3.Data

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 67: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

MySQLdump

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 68: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Restoring Backups• Recovering MySQL Cluster's Native Backup Files (1/3)

– Verify Management Node is Runningshell> ndb_mgm -e "SHOW"

– Start and Empty the Data Nodes• Start each data node with the --initial option.

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 69: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Restoring Backups

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 70: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Restoring Backups

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 71: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Restoring MySQLdump Files

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 72: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

OptimizationOptimization

Page 73: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

EXPLAIN

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 74: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Full Table Scan

• Without Condition Pushdown• With Condition Pushdown

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 75: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Parallel full table scan ( WHERE condition

processed in SQL node)

Data node

Data nodeMySQL Server

rows

SQL Query

Many RowsFew Rows

Where Condition

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 76: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Parallel full table scan ( WHERE condition processed in data

node)

Data node

Data nodeMySQL Server

rows

SQL Query

Few Rows

Where Condition

Where Condition

Few Rows

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 77: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Index Statistics

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 78: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

MySQL Cluster Query Cache

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 79: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Data Size/Usage Issues

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 80: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Query Design

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

Page 81: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

MySQL Cluster ReplicationMySQL Cluster Replication

Page 82: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

MySQL ServerMaster

MySQL ServerSlave

MySQL ServerSlave

IO threadSQL thread

Binlog

Relaylog

Relaylog Binlog

Application W

MySQL Replication

Page 83: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Cluster

Data node Data node

Data node Data node

MySQLd MySQLd

Update

Update

Ndb API Ndb API

Update

Update

Page 84: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

NDB Injector Thread

•A thread inside MySQL server•Responsible for injecting rows in binlog and produces “Single connical binlog for cluster”

• not just one MySQL Server•It contains everything written on all ndbApi program including MySQLd connected to cluster

Page 85: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

NdbClsuter Handler IO thread

Binlog

Relaylog

Binlog

MySQLd(Master)

MySQL Cluster Replication

Cluster

Data node Data node

Data node Data node

Replication

MySQLd(slave)

NdbClsuter Handler

Apply thread

Cluster

Data node Data node

Data node Data node

Page 86: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Thank you for your time and attention

MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube

For more information, please feel free to drop in a line to [email protected] or visit http://www.osscube.com

www.osscube.com

Page 87: OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

Q n A