SlideShare a Scribd company logo
1 of 87
MySQL Cluster Tutorial



         Presented by – Sonali Minocha
Who Am I?




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Architecture and Organization
What is a Cluster?




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Single MySQL Server Architecture



                SQL Request

 MySQL Client                 MySQL Server

                 Response
MySQL Cluster Architecture
                                         NDB API Call

               SQL Request
MySQL Client
                                                                Partitioning
                 Response                                       Replication
                                                                Message

                                             Response
                                                        Data Nodes
                        SQL Node (MySQL server)
Components of MySQL Cluster




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Various Nodes

                              API Node             Data
                                                   Node




Application




                                      Management Node


              MySQL Cluster Tutorial, OSSPAC 09
                  Singapore, © OSSCube
NdbCluster              NdbCluster               NdbCluster
Engine                  Engine                   Engine




                        (Data Nodes)


             MySQL Cluster Tutorial, OSSPAC 09
                 Singapore, © OSSCube
Organization




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Partition




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Partitioning




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Fragments




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Node Groups




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Split Brain




I have full
                       Servers can           I have full
responsibility
                       not see               responsibility
of the cluster
                       each other            of the cluster




                 MySQL Cluster Tutorial, OSSPAC 09
                     Singapore, © OSSCube
Arbitration

                                               NG
                                               1




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

                   MySQL Cluster Tutorial, OSSPAC 09
                       Singapore, © OSSCube
More Data Nodes

                             NG     Network
                             1      Split/
                                    Shutdown
                         N
                         G

                         2




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Arbitrator Issues




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Arbitrator Issues




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Normal Operation




                               I a ive
                                  m
                                  Al
Al m
   Ia
     e
  iv




         e
     liv
    A m


                                       Al m
      Ia

                                          Ia
                                            e
   MySQL Cluster Tutorial, OSSPAC 09     iv
       Singapore, © OSSCube
Missed Heartbeats




                            I a ive
                               m
                               Al
                 Alive
                 I am




                                    Al m
                                       Ia
                                         e
MySQL Cluster Tutorial, OSSPAC 09     iv
    Singapore, © OSSCube
Synchronous




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Phase One: Commit-
                        Request

Commit             Commit

Message           Message




Response           Response

Message            Message



           MySQL Cluster Tutorial, OSSPAC 09
               Singapore, © OSSCube
Phase Two: Successful
                              Commit




Transaction   Transaction

Successful    Successful

                   Commit             Commit

                 Transaction         Transaction




                MySQL Cluster Tutorial, OSSPAC 09
                    Singapore, © OSSCube
Phase Two: Failure
                               (Abort Commit)



Transaction   Transaction

  Failed      Successful

                    Rollback            Rollback

                   Transaction        Transaction




                 MySQL Cluster Tutorial, OSSPAC 09
                     Singapore, © OSSCube
INSTALL MySQL CLUSTER
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= 2
               DataDir= /var/lib/MySQL-cluster
•   [NDB_MGMD]
               Hostname= ndb_mgmd.MySQL.com
               DataDir= /var/lib/MySQL-cluster
•   [NDBD]
               HostName= ndbd_2.MySQL.com
•   [NDBD]
               HostName=ndbd_3.MySQL.com
•   [MySQLD]
•   [MySQLD]
               HostName= MySQLd_5.MySQL.com
                      MySQL Cluster Tutorial, OSSPAC 09
                         Singapore, © OSSCube
Management Node




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
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
Data Node Configurations
         Options




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
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
            MySQL Cluster Tutorial, OSSPAC 09
 :1186          Singapore, © OSSCube
Config.ini Parameters
General Parameters
   – Id
   – Hostname

   File and Directory Location Parameter
   – BackupDataDir
   – DataDir
   – FileSystemPath




                   MySQL Cluster Tutorial, OSSPAC 09
                       Singapore, © OSSCube
•Transaction Handling Parameters
  •TransactionInactiveTimeout
  •TransactionDeadlockDetectionTimeou
  t


•Memory Usage Parameters
  •LockPagesInMainMemory


•Utility Programs
  •ndb_size.pl
Monitoring the Startup Phases




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




            MySQL Cluster Tutorial, OSSPAC 09
                Singapore, © OSSCube
NDB Storage Engine




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
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
Tablespace              Tablespace

           Datafile       Datafile Datafile
Datafile




                      Log File group

                      Redo log Undo Log
Indexes




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
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 ....




                         MySQL Cluster Tutorial, OSSPAC 09
                             Singapore, © OSSCube
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
              Code_Hash   Code   Name                Continent
                   1351   CHE    Switzerland         Europe
                   1785   CHN    China               Asia
    Hidden         1943   FIN    Finland             Europe
     Field         2031   GOR    United Kingdom      Europe
                   2345   SKO    South Korea         Asia

                                                                 Ordered
                                                                  Index


     Hidden
     Table




                      MySQL Cluster Tutorial, OSSPAC 09
                          Singapore, © OSSCube
Second Node/Second Fragment
•   Same as First Node/Fragment setup
•   Contains the remaining data
            Code Hash    Code    Name                   Continent
                  1231   BRA     Brazil                 South America
                  1853   ESP     Spain                  Europe
Hidden
 Field            2145   IND     India                  Asia
                  2197   MOR     Morocco                Africa

                                                                        Ordered
                                                                         Index


Hidden
Table




                         MySQL Cluster Tutorial, OSSPAC 09
                             Singapore, © OSSCube
UniqueKey Lookup network hop
            Primary Key Lookup may
                     Unique Key Lookup
                     require another


            Function()                           Look up row
PK values                         Hash                         Data node



                                                                 Look up row



                                                                  Data node



                  MySQL Server


                         MySQL Cluster Tutorial, OSSPAC 09
                             Singapore, © OSSCube
Parallel Ordered Index
                          Scan

                                               T-
                                  Data node    Tree
                                               Index
          rows


MySQL
Server                             Data node
                                                 T-
                                                 Tree
                                                 Index



         MySQL Cluster Tutorial, OSSPAC 09
             Singapore, © OSSCube
Parallel full table scan

                                   Data node


           rows


MySQL
Server                              Data node




          MySQL Cluster Tutorial, OSSPAC 09
              Singapore, © OSSCube
Parallel full table scan ( WHERE
                            condition processed in SQL
                                         node)

                                 SQL Query
                                                        Data node
Few Rows
                                        rows Rows
                                         Many

           MySQL
                       Where
           Server
                       Conditi
                       on                               Data node




                    MySQL Cluster Tutorial, OSSPAC 09
                        Singapore, © OSSCube
SQL Query
                                                          Data node
                                            Where
Few Rows                                    Conditi
                                   Fewrows on
                                       Rows

           MySQL
           Server

                                                Where     Data node
                                                Conditi
                                                on




                    MySQL Cluster Tutorial, OSSPAC 09
                        Singapore, © OSSCube
Storage of Indexes




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Characteristics of NDB
                  storage Engine




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Durability




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
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
Local Check Point




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Memory - RAM

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

•   Sizing up the
    Memory
    – Fixed size in memory
    – Variable sized in memory
    – Fixed size on disk
                    MySQL Cluster Tutorial, OSSPAC 09
                        Singapore, © OSSCube
Memory Pages




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
HANDLING DATA IN MySQL
CLUSTER
Disk Data Objects




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
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 Group
     ALTER LOGFILE GROUP lg_1
         ADD UNDOFILE 'undo_2.dat'
         INITIAL_SIZE 12M
         ENGINE NDB;

                MySQL Cluster Tutorial, OSSPAC 09
                    Singapore, © OSSCube
Verifying UNDO Files are
                               Created
• INFORMATION_SCHEMA Tables
  SELECT 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
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 File
       ALTER TABLESPACE ts_1
           ADD DATAFILE 'data_2.dat'
           INITIAL_SIZE 48M
           ENGINE NDB;
• Verifying Data Files are Created
       SELECT FILE_NAME, LOGFILE_GROUP_NAME, EXTRA
       FROM INFORMATION_SCHEMA.FILES
       WHERE TABLESPACE_NAME = 'ts_1' AND FILE_TYPE =
         'DATAFILE';

                    MySQL Cluster Tutorial, OSSPAC 09
                        Singapore, © OSSCube
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 Tables
       ALTER TABLE city TABLESPACE ts1 STORAGE DISK ENGINE=NDB;

• View Table Status
       SHOW TABLE STATUS LIKE 'city'G



                    MySQL Cluster Tutorial, OSSPAC 09
                        Singapore, © OSSCube
Monitoring Free Space




    MySQL Cluster Tutorial, OSSPAC 09
        Singapore, © OSSCube
Dropping Cluster Tables




     MySQL Cluster Tutorial, OSSPAC 09
         Singapore, © OSSCube
MySQL CLUSTER
MANAGEMENT
MySQL Cluster’s Native Backup Tool


                                                            Backup-1.2.ctl
• Backup Data       Data                             Data   Backup-1.2.log
                                                            Backup-1.0.2.Data
   – .ctl           Node                             Node
                                                            Backup-1.1.2.Data
   – .log
   – .data




• Abort Backup                                              Backup-1.3.ctl
               Data           Data                          Backup-1.3.log
   ndb_mgm> ABORT BACKUP 6
               Node           Node                          Backup-1.0.3.Data
                                                            Backup-1.1.3.Data
   Abort of backup 6 ordered
   Node 2: Backup 10 started from 1 has
    been aborted. Error: 1321
                 MySQL Cluster Tutorial, OSSPAC 09
                     Singapore, © OSSCube
MySQLdump




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Restoring Backups
• Recovering MySQL Cluster's Native Backup Files (1/3)
   – Verify Management Node is Running
       shell> 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
Restoring Backups




   MySQL Cluster Tutorial, OSSPAC 09
       Singapore, © OSSCube
Restoring Backups




   MySQL Cluster Tutorial, OSSPAC 09
       Singapore, © OSSCube
Restoring MySQLdump Files




       MySQL Cluster Tutorial, OSSPAC 09
           Singapore, © OSSCube
Optimization
EXPLAIN




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
Full Table Scan
• Without Condition Pushdown
• With Condition Pushdown




                MySQL Cluster Tutorial, OSSPAC 09
                    Singapore, © OSSCube
Parallel full table scan
                            ( WHERE condition
                          processed in SQL node)
                            SQL Query
                                                   Data node
                 Where
Few Rows         Condition
                                   rows Rows
                                    Many



           MySQL
           Server                                  Data node




               MySQL Cluster Tutorial, OSSPAC 09
                   Singapore, © OSSCube
Parallel full table scan ( WHERE
                        condition processed in data
                                     node)
                                                   Where
                            SQL Query              Condition
                                                       Data node
Few Rows
                              Few Rows
                                 rows


           MySQL                                   Where
           Server                                  Condition node
                                                         Data




               MySQL Cluster Tutorial, OSSPAC 09
                   Singapore, © OSSCube
Index Statistics




 MySQL Cluster Tutorial, OSSPAC 09
     Singapore, © OSSCube
MySQL Cluster Query Cache




       MySQL Cluster Tutorial, OSSPAC 09
           Singapore, © OSSCube
Data Size/Usage Issues




     MySQL Cluster Tutorial, OSSPAC 09
         Singapore, © OSSCube
Query Design




MySQL Cluster Tutorial, OSSPAC 09
    Singapore, © OSSCube
MySQL Cluster
Replication
MySQL Replication

                                 MySQL Server
 Application W                   Slave



MySQL Server                    Relaylog
Master              IO thread
                                       SQL thread


                                 MySQL Server
         Binlog
                                 Slave


                                Relaylog     Binlog
MySQLd                                      MySQLd
          Update




          Data node                        Update
                      Data node
           Cluster
          Data node   Data node

                                  Update
           Update
Ndb API                           Ndb API
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
MySQL Cluster Replication

                                        MySQLd(slave)          Binlog

  MySQLd(Master)       Replication
                                                   NdbClsuter Handler

NdbClsuter Handler                      Relaylog
                            IO thread


                   Binlog       Apply thread

                                          Data node        Data node
Data node     Data node
                                           Cluster
 Cluster                                  Data node         Data node
Data node      Data node
Thank you for your time and attention

           www.osscube.com



For more information, please feel free to drop in a line to
 sonali@osscube.com or visit http://www.osscube.com



                  MySQL Cluster Tutorial, OSSPAC 09
                      Singapore, © OSSCube
QnA

More Related Content

What's hot

What's New in MySQL 5.6
What's New in MySQL 5.6What's New in MySQL 5.6
What's New in MySQL 5.6
Santo Leto
 
MySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summaryMySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summary
Louis liu
 

What's hot (20)

Advanced MySQL Replication Architectures - Luis Soares
Advanced MySQL Replication Architectures - Luis SoaresAdvanced MySQL Replication Architectures - Luis Soares
Advanced MySQL Replication Architectures - Luis Soares
 
Introduction to MySQL Cluster
Introduction to MySQL ClusterIntroduction to MySQL Cluster
Introduction to MySQL Cluster
 
MySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion QueriesMySQL Cluster Scaling to a Billion Queries
MySQL Cluster Scaling to a Billion Queries
 
State of the art of MySQL replication and clustering
State of the art of MySQL replication and clusteringState of the art of MySQL replication and clustering
State of the art of MySQL replication and clustering
 
Elastic Scalability in MySQL Fabric Using OpenStack
Elastic Scalability in MySQL Fabric Using OpenStackElastic Scalability in MySQL Fabric Using OpenStack
Elastic Scalability in MySQL Fabric Using OpenStack
 
High-Availability using MySQL Fabric
High-Availability using MySQL FabricHigh-Availability using MySQL Fabric
High-Availability using MySQL Fabric
 
What's New in MySQL 5.6
What's New in MySQL 5.6What's New in MySQL 5.6
What's New in MySQL 5.6
 
Python Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL DatabasesPython Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL Databases
 
PayPal Big Data and MySQL Cluster
PayPal Big Data and MySQL ClusterPayPal Big Data and MySQL Cluster
PayPal Big Data and MySQL Cluster
 
MySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summaryMySQL 5.5&5.6 new features summary
MySQL 5.5&5.6 new features summary
 
Conference tutorial: MySQL Cluster as NoSQL
Conference tutorial: MySQL Cluster as NoSQLConference tutorial: MySQL Cluster as NoSQL
Conference tutorial: MySQL Cluster as NoSQL
 
MySQL cluster 7.4
MySQL cluster 7.4 MySQL cluster 7.4
MySQL cluster 7.4
 
Breakthrough performance with MySQL Cluster (2012)
Breakthrough performance with MySQL Cluster (2012)Breakthrough performance with MySQL Cluster (2012)
Breakthrough performance with MySQL Cluster (2012)
 
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
Galera Cluster for MySQL vs MySQL (NDB) Cluster: A High Level Comparison
 
My sql 5.6&MySQL Cluster 7.3
My sql 5.6&MySQL Cluster 7.3My sql 5.6&MySQL Cluster 7.3
My sql 5.6&MySQL Cluster 7.3
 
Perf Tuning Short
Perf Tuning ShortPerf Tuning Short
Perf Tuning Short
 
MySQL Group Replication - an Overview
MySQL Group Replication - an OverviewMySQL Group Replication - an Overview
MySQL Group Replication - an Overview
 
MySQL Performance Best Practices
MySQL Performance Best PracticesMySQL Performance Best Practices
MySQL Performance Best Practices
 
MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014) MySQL Cluster Asynchronous replication (2014)
MySQL Cluster Asynchronous replication (2014)
 
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQLMySQL InnoDB Cluster - A complete High Availability solution for MySQL
MySQL InnoDB Cluster - A complete High Availability solution for MySQL
 

Similar to OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

MySQL replication & cluster
MySQL replication & clusterMySQL replication & cluster
MySQL replication & cluster
elliando dias
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New Features
Tarique Saleem
 
Oreilly Webcast Jun17
Oreilly Webcast Jun17Oreilly Webcast Jun17
Oreilly Webcast Jun17
Sean Hull
 

Similar to OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09 (20)

The OSSCube MySQL High Availability Tutorial
The OSSCube MySQL High Availability TutorialThe OSSCube MySQL High Availability Tutorial
The OSSCube MySQL High Availability Tutorial
 
20190817 coscup-oracle my sql innodb cluster sharing
20190817 coscup-oracle my sql innodb cluster sharing20190817 coscup-oracle my sql innodb cluster sharing
20190817 coscup-oracle my sql innodb cluster sharing
 
Oracle OpenWorld - Getting started with MySQL Cluster
Oracle OpenWorld - Getting started with MySQL ClusterOracle OpenWorld - Getting started with MySQL Cluster
Oracle OpenWorld - Getting started with MySQL Cluster
 
Scaling MySQL -- Swanseacon.co.uk
Scaling MySQL -- Swanseacon.co.uk Scaling MySQL -- Swanseacon.co.uk
Scaling MySQL -- Swanseacon.co.uk
 
200 million qps on commodity hardware : Getting started with MySQL Cluster 7.4
200 million qps on commodity hardware : Getting started with MySQL Cluster 7.4200 million qps on commodity hardware : Getting started with MySQL Cluster 7.4
200 million qps on commodity hardware : Getting started with MySQL Cluster 7.4
 
Posscon my sql56
Posscon my sql56Posscon my sql56
Posscon my sql56
 
20191001 bkk-secret-of inno-db_clusterv1
20191001 bkk-secret-of inno-db_clusterv120191001 bkk-secret-of inno-db_clusterv1
20191001 bkk-secret-of inno-db_clusterv1
 
MySQL no Paypal Tesla e Uber
MySQL no Paypal Tesla e UberMySQL no Paypal Tesla e Uber
MySQL no Paypal Tesla e Uber
 
Introduction to Galera
Introduction to GaleraIntroduction to Galera
Introduction to Galera
 
MySQL replication & cluster
MySQL replication & clusterMySQL replication & cluster
MySQL replication & cluster
 
Mysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New FeaturesMysql User Camp : 20th June - Mysql New Features
Mysql User Camp : 20th June - Mysql New Features
 
Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support
 Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support
Mysql User Camp : 20-June-14 : Mysql New features and NoSQL Support
 
20141011 my sql clusterv01pptx
20141011 my sql clusterv01pptx20141011 my sql clusterv01pptx
20141011 my sql clusterv01pptx
 
MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017
MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017
MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017
 
MySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore
MySQL InnoDB Cluster and Group Replication - OSI 2017 BangaloreMySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore
MySQL InnoDB Cluster and Group Replication - OSI 2017 Bangalore
 
MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)
MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)
MySQL Cluster - Latest Developments (up to and including MySQL Cluster 7.4)
 
1 my sql20151219-kaji_ivan
1 my sql20151219-kaji_ivan1 my sql20151219-kaji_ivan
1 my sql20151219-kaji_ivan
 
Oreilly Webcast Jun17
Oreilly Webcast Jun17Oreilly Webcast Jun17
Oreilly Webcast Jun17
 
Home For Gypsies – Storage for NoSQL Databases​
Home For Gypsies – Storage for NoSQL Databases​Home For Gypsies – Storage for NoSQL Databases​
Home For Gypsies – Storage for NoSQL Databases​
 
MySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP Paris
MySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP ParisMySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP Paris
MySQL InnoDB Cluster - Meetup Oracle MySQL / AFUP Paris
 

More from OSSCube

Performance Testing Session - OSSCamp 2014
Performance Testing Session -  OSSCamp 2014Performance Testing Session -  OSSCamp 2014
Performance Testing Session - OSSCamp 2014
OSSCube
 

More from OSSCube (20)

High Availability Using MySQL Group Replication
High Availability Using MySQL Group ReplicationHigh Availability Using MySQL Group Replication
High Availability Using MySQL Group Replication
 
Accelerate Your Digital Transformation Journey with Pimcore
Accelerate Your Digital Transformation Journey with PimcoreAccelerate Your Digital Transformation Journey with Pimcore
Accelerate Your Digital Transformation Journey with Pimcore
 
Migrating Legacy Applications to AWS Cloud: Strategies and Challenges
Migrating Legacy Applications to AWS Cloud: Strategies and ChallengesMigrating Legacy Applications to AWS Cloud: Strategies and Challenges
Migrating Legacy Applications to AWS Cloud: Strategies and Challenges
 
Why Does Omnichannel Experience Matter to Your Customers
Why Does Omnichannel Experience Matter to Your CustomersWhy Does Omnichannel Experience Matter to Your Customers
Why Does Omnichannel Experience Matter to Your Customers
 
Using MySQL Fabric for High Availability and Scaling Out
Using MySQL Fabric for High Availability and Scaling OutUsing MySQL Fabric for High Availability and Scaling Out
Using MySQL Fabric for High Availability and Scaling Out
 
Webinar: Five Ways a Technology Refresh Strategy Can Help Make Your Digital T...
Webinar: Five Ways a Technology Refresh Strategy Can Help Make Your Digital T...Webinar: Five Ways a Technology Refresh Strategy Can Help Make Your Digital T...
Webinar: Five Ways a Technology Refresh Strategy Can Help Make Your Digital T...
 
Cutting Through the Disruption
Cutting Through the DisruptionCutting Through the Disruption
Cutting Through the Disruption
 
Legacy to industry leader: a modernization case study
Legacy to industry leader: a modernization case studyLegacy to industry leader: a modernization case study
Legacy to industry leader: a modernization case study
 
Marketing and Sales together at last
Marketing and Sales together at lastMarketing and Sales together at last
Marketing and Sales together at last
 
Using pim to maximize revenue and improve customer satisfaction
Using pim to maximize revenue and improve customer satisfactionUsing pim to maximize revenue and improve customer satisfaction
Using pim to maximize revenue and improve customer satisfaction
 
Talend for the Enterprise
Talend for the EnterpriseTalend for the Enterprise
Talend for the Enterprise
 
Ahead of the Curve
Ahead of the CurveAhead of the Curve
Ahead of the Curve
 
Non functional requirements. do we really care…?
Non functional requirements. do we really care…?Non functional requirements. do we really care…?
Non functional requirements. do we really care…?
 
Learning from experience: Collaborative Journey towards CMMI
Learning from experience: Collaborative Journey towards CMMILearning from experience: Collaborative Journey towards CMMI
Learning from experience: Collaborative Journey towards CMMI
 
Exploiting JXL using Selenium
Exploiting JXL using SeleniumExploiting JXL using Selenium
Exploiting JXL using Selenium
 
Introduction to AWS
Introduction to AWSIntroduction to AWS
Introduction to AWS
 
Maria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High AvailabilityMaria DB Galera Cluster for High Availability
Maria DB Galera Cluster for High Availability
 
Talend Open Studio Introduction - OSSCamp 2014
Talend Open Studio Introduction - OSSCamp 2014Talend Open Studio Introduction - OSSCamp 2014
Talend Open Studio Introduction - OSSCamp 2014
 
Performance Testing Session - OSSCamp 2014
Performance Testing Session -  OSSCamp 2014Performance Testing Session -  OSSCamp 2014
Performance Testing Session - OSSCamp 2014
 
Job Queue Presentation - OSSCamp 2014
Job Queue Presentation - OSSCamp 2014Job Queue Presentation - OSSCamp 2014
Job Queue Presentation - OSSCamp 2014
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 

OSSCube MySQL Cluster Tutorial By Sonali At Osspac 09

  • 1. MySQL Cluster Tutorial Presented by – Sonali Minocha
  • 2. Who Am I? MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 4. What is a Cluster? MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 5. Single MySQL Server Architecture SQL Request MySQL Client MySQL Server Response
  • 6. MySQL Cluster Architecture NDB API Call SQL Request MySQL Client Partitioning Response Replication Message Response Data Nodes SQL Node (MySQL server)
  • 7. Components of MySQL Cluster MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 8. Various Nodes API Node Data Node Application Management Node MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 9. NdbCluster NdbCluster NdbCluster Engine Engine Engine (Data Nodes) MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 10. Organization MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 11. Partition MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 12. Partitioning MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 13. Fragments MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 14. Node Groups MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 15. Split Brain I have full Servers can I have full responsibility not see responsibility of the cluster each other of the cluster MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 16. Arbitration NG 1 Network Split First Node to ask will continue while the other will be shut down MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 17. More Data Nodes NG Network 1 Split/ Shutdown N G 2 MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 18. Arbitrator Issues MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 19. Arbitrator Issues MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 20. Normal Operation I a ive m Al Al m Ia e iv e liv A m Al m Ia Ia e MySQL Cluster Tutorial, OSSPAC 09 iv Singapore, © OSSCube
  • 21. Missed Heartbeats I a ive m Al Alive I am Al m Ia e MySQL Cluster Tutorial, OSSPAC 09 iv Singapore, © OSSCube
  • 22. Synchronous MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 23. Phase One: Commit- Request Commit Commit Message Message Response Response Message Message MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 24. Phase Two: Successful Commit Transaction Transaction Successful Successful Commit Commit Transaction Transaction MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 25. Phase Two: Failure (Abort Commit) Transaction Transaction Failed Successful Rollback Rollback Transaction Transaction MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 27. 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= 2 DataDir= /var/lib/MySQL-cluster • [NDB_MGMD] Hostname= ndb_mgmd.MySQL.com DataDir= /var/lib/MySQL-cluster • [NDBD] HostName= ndbd_2.MySQL.com • [NDBD] HostName=ndbd_3.MySQL.com • [MySQLD] • [MySQLD] HostName= MySQLd_5.MySQL.com MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 28. Management Node MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 29. 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
  • 30. Data Node Configurations Options MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 31. 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 MySQL Cluster Tutorial, OSSPAC 09 :1186 Singapore, © OSSCube
  • 32. Config.ini Parameters General Parameters – Id – Hostname File and Directory Location Parameter – BackupDataDir – DataDir – FileSystemPath MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 33.
  • 34. •Transaction Handling Parameters •TransactionInactiveTimeout •TransactionDeadlockDetectionTimeou t •Memory Usage Parameters •LockPagesInMainMemory •Utility Programs •ndb_size.pl
  • 35. Monitoring the Startup Phases MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube. http://osscube.com/technology/mysql
  • 36. MySQL Cluster Storage Engine --NDB MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 37. NDB Storage Engine MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 38. 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
  • 39. Tablespace Tablespace Datafile Datafile Datafile Datafile Log File group Redo log Undo Log
  • 40. Indexes MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 41. 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 .... MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 42. 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 Code_Hash Code Name Continent 1351 CHE Switzerland Europe 1785 CHN China Asia Hidden 1943 FIN Finland Europe Field 2031 GOR United Kingdom Europe 2345 SKO South Korea Asia Ordered Index Hidden Table MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 43. Second Node/Second Fragment • Same as First Node/Fragment setup • Contains the remaining data Code Hash Code Name Continent 1231 BRA Brazil South America 1853 ESP Spain Europe Hidden Field 2145 IND India Asia 2197 MOR Morocco Africa Ordered Index Hidden Table MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 44. UniqueKey Lookup network hop Primary Key Lookup may Unique Key Lookup require another Function() Look up row PK values Hash Data node Look up row Data node MySQL Server MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 45. Parallel Ordered Index Scan T- Data node Tree Index rows MySQL Server Data node T- Tree Index MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 46. Parallel full table scan Data node rows MySQL Server Data node MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 47. Parallel full table scan ( WHERE condition processed in SQL node) SQL Query Data node Few Rows rows Rows Many MySQL Where Server Conditi on Data node MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 48. SQL Query Data node Where Few Rows Conditi Fewrows on Rows MySQL Server Where Data node Conditi on MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 49. Storage of Indexes MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 50. Characteristics of NDB storage Engine MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 51. Durability MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 52. 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
  • 53. Local Check Point MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 54. Memory - RAM • Memory Allocation Total Memory = N(data nodes)* Local Memory / NoOfReplicas -- or -- Local Memory = Total Memory * NoOfReplicas / N(data nodes) • Sizing up the Memory – Fixed size in memory – Variable sized in memory – Fixed size on disk MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 55. Memory Pages MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 56. MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 57. HANDLING DATA IN MySQL CLUSTER
  • 58. Disk Data Objects MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 59. 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 Group ALTER LOGFILE GROUP lg_1 ADD UNDOFILE 'undo_2.dat' INITIAL_SIZE 12M ENGINE NDB; MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 60. Verifying UNDO Files are Created • INFORMATION_SCHEMA Tables SELECT 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
  • 61. 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 File ALTER TABLESPACE ts_1 ADD DATAFILE 'data_2.dat' INITIAL_SIZE 48M ENGINE NDB; • Verifying Data Files are Created SELECT FILE_NAME, LOGFILE_GROUP_NAME, EXTRA FROM INFORMATION_SCHEMA.FILES WHERE TABLESPACE_NAME = 'ts_1' AND FILE_TYPE = 'DATAFILE'; MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 62. 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 Tables ALTER TABLE city TABLESPACE ts1 STORAGE DISK ENGINE=NDB; • View Table Status SHOW TABLE STATUS LIKE 'city'G MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 63. Monitoring Free Space MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 64. Dropping Cluster Tables MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 66. MySQL Cluster’s Native Backup Tool Backup-1.2.ctl • Backup Data Data Data Backup-1.2.log Backup-1.0.2.Data – .ctl Node Node Backup-1.1.2.Data – .log – .data • Abort Backup Backup-1.3.ctl Data Data Backup-1.3.log ndb_mgm> ABORT BACKUP 6 Node Node Backup-1.0.3.Data Backup-1.1.3.Data Abort of backup 6 ordered Node 2: Backup 10 started from 1 has been aborted. Error: 1321 MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 67. MySQLdump MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 68. Restoring Backups • Recovering MySQL Cluster's Native Backup Files (1/3) – Verify Management Node is Running shell> 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
  • 69. Restoring Backups MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 70. Restoring Backups MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 71. Restoring MySQLdump Files MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 73. EXPLAIN MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 74. Full Table Scan • Without Condition Pushdown • With Condition Pushdown MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 75. Parallel full table scan ( WHERE condition processed in SQL node) SQL Query Data node Where Few Rows Condition rows Rows Many MySQL Server Data node MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 76. Parallel full table scan ( WHERE condition processed in data node) Where SQL Query Condition Data node Few Rows Few Rows rows MySQL Where Server Condition node Data MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 77. Index Statistics MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 78. MySQL Cluster Query Cache MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 79. Data Size/Usage Issues MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 80. Query Design MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 82. MySQL Replication MySQL Server Application W Slave MySQL Server Relaylog Master IO thread SQL thread MySQL Server Binlog Slave Relaylog Binlog
  • 83. MySQLd MySQLd Update Data node Update Data node Cluster Data node Data node Update Update Ndb API Ndb API
  • 84. 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
  • 85. MySQL Cluster Replication MySQLd(slave) Binlog MySQLd(Master) Replication NdbClsuter Handler NdbClsuter Handler Relaylog IO thread Binlog Apply thread Data node Data node Data node Data node Cluster Cluster Data node Data node Data node Data node
  • 86. Thank you for your time and attention www.osscube.com For more information, please feel free to drop in a line to sonali@osscube.com or visit http://www.osscube.com MySQL Cluster Tutorial, OSSPAC 09 Singapore, © OSSCube
  • 87. QnA