SlideShare ist ein Scribd-Unternehmen logo
1 von 43
MySQL Cluster Training
                                 presented by severalnines.com




                                                                      Address:
 Contact:                                                      SeveralninesAB
 Jean-Jérôme Schmidt                                        c/o SICS, Box 1263
 Email: services@severalnines.com                             Isafjordsgatan22
                                                               SE-164-29 Kista


Copyright 2011 Severalnines AB                              Control your database infrastructure   1
Introduction

       • At Severalnines, we believe in sharing information
         and knowledge; we all come from an open source
         background
       • We know a lot of things about MySQL Cluster and
         think that MySQL Cluster is a great technology
       • These free MySQL Cluster Training slides are a
         contribution of ours to the knowledge and information
         sharing that‟s common practice in the open source
         community
       • If you have any questions on these slides or would
         like to book an actual training class, please contact
         us at: services@severalnines.com

Copyright 2011 Severalnines AB                   Control your database infrastructure   2
Training Slides - Concept

       • Over the coming weeks we will be chronologically
         releasing slides for the different sections of our
         MySQL Cluster Training program on our website.
       • The full agenda of the training with all of its modules
         is outlined in the next slides so that you can see what
         topics will be covered over the coming weeks.
       • Particularly specialised topics such as Cluster/J or
         NDB API are not fully covered in the slides. We
         recommend our instructor-led training classes for
         such topics.
       • Please contact us for more details:
         services@severalnines.com

Copyright 2011 Severalnines AB                    Control your database infrastructure   3
Full Training Agenda (1/4)

       •    MySQL Cluster Introduction
              –   MySQL eco system
              –   Scale up, scale out, and sharding
              –   MySQL Cluster Architecture
              –   Use cases
              –   Features
              –   Node types and Roles
       •    Detailed Concepts
              –   Data Distribution
              –   Verifying data distribution
              –   Access Methods
              –   Partitioning
              –   Node failures and failure detection
              –   Network Partitioning
              –   Transactions and Locking
              –   Consistency Model
              –   Redo logging and Checkpointing



Copyright 2011 Severalnines AB                          Control your database infrastructure   4
Agenda (2/4)

       •    Installing MySQL Cluster
              –   Setting up MySQL Cluster
              –   Starting/stopping nodes
              –   Recovery and restarts
              –   Upgrading configuration
              –   Upgrading Cluster
       •    Performance Tuning (instructor-led only; contact us at services@severalnines.com)
              –   Differences compared to Innodb/MyISAM
              –   Designing efficient and fast applications
              –   Identifying bottlenecks
              –   Tweaking configuration (OS and MySQL Cluster)
              –   Query Tuning
              –   Schema Design
              –   Index Tuning




Copyright 2011 Severalnines AB                                        Control your database infrastructure   5
Agenda (3/4)

       •    Management and Administration
              –   Backup and Restore
              –   Geographical Replication
              –   Online and offline operations
              –   Ndbinfo tables
              –   Reporting
              –   Single user mode
              –   Scaling Cluster
       •    Disk Data
              –   Use cases
              –   Limitations
              –   Best practice configuration
       •    Designing a Cluster
              –   Capacity Planning and Dimensioning
              –   Hardware recommendations
              –   Best practice Configuration
              –   Storage calculations



Copyright 2011 Severalnines AB                          Control your database infrastructure   6
Agenda (4/4)

       •    Resolving Issues
              –   Common problems
              –   Error logs and Tracefiles
              –   Recovery and Escalation procedures
       •    Connectivity Overview
              –   NDBAPI
              –   Cluster/J
              –   LDAP
       •    Severalnines Tools
              –   Monitoring and Management
              –   Benchmarking
              –   Sandboxes
              –   Configuration and capacity planning
       •    Conclusion




Copyright 2011 Severalnines AB                          Control your database infrastructure   7
Agenda: Lab Exercises
            (only applicable to instructor-led training classes)


       •    Lab Exercises
              –   Installing and Loading data into MySQL Cluster
              –   Starting/stopping nodes, recovery
              –   Query tuning
              –   Backup and Restore
              –   Configuration Upgrade


       •    Would you like to try something particular?
              –   This is possible too, speak with your instructor




Copyright 2011 Severalnines AB                                       Control your database infrastructure   8
Prerequisites
       •    Readers / Participants have understanding of SQL and basic database concepts.

       •    Laptops/PCs for hands-on exercises
       •    Linux: 1GB RAM
       •    Windows: 2GB RAM
       •    Approx. 20GB disk space and Virtualbox installed.
       •    Virtualbox can be downloaded for free at http://www.virtualbox.org/wiki/Downloads

       •    MySQL Cluster version 7.1 or later




Copyright 2011 Severalnines AB                                                  Control your database infrastructure   9
3rd Installment of the Severalnines
                     Cluster Self-Training


               Part 2 : Detailed Concepts (ctd…)
                            Section 3




Copyright 2011 Severalnines AB           Control your database infrastructure   10
Topics covered in Section 3


     • Access Methods
     • Redo Logging and Check-pointing




Copyright 2011 Severalnines AB                Control your database infrastructure   11
Access Methods




Copyright 2011 Severalnines AB                    Control your database infrastructure   12
Access Methods

       • The Data Nodes can handle the following primitive
         types of requests:
              –   PRIMARY KEY
              –   INDEX SCAN
              –   UNIQUE INDEX
              –   (Note in 7.2.x a new “fast-join” interface exists as well).
       • Any of the following queries will be translated and
         execute a combination of the above.
              –   UPDATE t1 SET data=„abc‟ WHERE id=1;
              –   DELETE FROM t1 WHERE id>1;
              –   SELECT * FROM t1 WHERE t1.id=1
              –   SELECT * FROM t1, t2 WHERE t1.id=t2.id and t.id=1;


Copyright 2011 Severalnines AB                                    Control your database infrastructure   13
Primary Key

       • The Primary Key request is the fastest primitive type
         to access data in the data nodes.
       • SELECT data FROM subscriber WHERE subid=1;




                                                   STORAGE LAYER


                                                 DATA                DATA
                                                NODE 0              NODE 1

        subid              data
        1                  A      Partition 0
        3                  B                     P0                    P1

        2                  C      Partition 1
        4                  D

               subscriber
Copyright 2011 Severalnines AB                           Control your database infrastructure   14
Primary Key – Calculate Hash on PK

       • SELECT data FROM subscriber WHERE subid=1;

 1. MySQL Server (NDBAPI)
    calculates md5sum(subid=1)  128-bit value
 2. MySQL Server sends the request to the data node
    having the Primary partition for the requested data



                                                            STORAGE LAYER


                                                          DATA           DATA
                                                          NODE           NODE

        subid              data
        1                  A                Partition 0
        3                  B                              P0              P1

        2                  C                Partition 1
        4                  D

               subscriber
Copyright 2011 Severalnines AB                                     Control your database infrastructure   15
Primary Key – Determine Partition

       • SELECT data FROM subscriber WHERE subid=1;

                                                       PARTITION_HASH    INDEX_HASH
 1. MySQL Server (NDBAPI)
    calculates md5sum(subid=1)  128-bit value         64-bit            64-bit
 2. PARTITION=(PARTITION_HASH MODULO #PARTTIONS )




                                                                    STORAGE LAYER


                                                                  DATA                  DATA
                                                                  NODE                  NODE

        subid              data
        1                  A             Partition 0
        3                  B                                       P0                    P1

        2                  C             Partition 1
        4                  D

               subscriber
Copyright 2011 Severalnines AB                                                    Control your database infrastructure   16
Primary Key – Execute Request

       • SELECT data FROM subscriber WHERE subid=1;

                                                       PARTITION_HASH    INDEX_HASH
 1. MySQL Server (NDBAPI)
    calculates md5sum(subid=1)  128-bit value         64-bit            64-bit
 2. PARTITION=(PARTITION_HASH MODULO #PARTTIONS )
 3. Map PARTITTION to Data node and SEND REQUEST


                                                                    STORAGE LAYER


                                                                  DATA                  DATA
                                                                  NODE                  NODE

        subid              data
        1                  A             Partition 0
        3                  B                                       P0                    P1

        2                  C             Partition 1
        4                  D

               subscriber
Copyright 2011 Severalnines AB                                                    Control your database infrastructure   17
Unique Indexes

        • A Unique Index is used as a CONSTRAINT.
        • The Unique Index is represented as a hidden separate table.
              – Storage cost can be high.
        • CREATE UNIQUE INDEX ix_unique ON
          subscriber(data)

    subid        data        data2                  data         subid
    1            A           AA                     A            1
                                      Partition 0                                           Partition 0
    3            B           BB                     C            2

    2            C           CC                     B            3
                                      Partition 1                                           Partition 1
    4            D           DD                     D            4

            subscriber                                     Ix_unique




Copyright 2011 Severalnines AB                                       Control your database infrastructure   18
Unique Index Lookup

       • SELECT data2 from subscriber WHERE data=„B‟;
                                                                   STORAGE LAYER


                                                                 DATA                  DATA
                                                                 NODE                  NODE




                                                                 P0                      P1




     subid        data           data2                  data            subid
     1            A              AA                     A               1
                                          Partition 0                                            Partition 0
     3            B              BB                     C               2

     2            C              CC                     B               3
                                          Partition 1                                            Partition 1
     4            D              DD                     D               4

             subscriber                                        Ix_unique
Copyright 2011 Severalnines AB                                          Control your database infrastructure   19
Index Scans - Secondary Indexes

       • The ordered index is stored in the DataMemory
              – Each index cost 16B per record (no matter how many
                columns are indexed)
       • By default the PRIMARY KEY and UNIQUE KEY also
         has an ordered index
              – Avoid it by specifying USING HASH
                     • Saves 16B per record.

             ACC                      TUP           ACC                           TUP
                      P0                    P0            P0                            P0




         IndexMemory             DataMemory      IndexMemory            DataMemory
                       DATA NODE 1                         DATA NODE 2



Copyright 2011 Severalnines AB                                 Control your database infrastructure   20
Index Scans - Secondary Indexes

       • T-tree indexes are used for ordered secondary
         indexes
              – Optimized for In-memory data – does not carry any data
                (space) .
              – Each data node maintains a local ordered index of its data.



             ACC                      TUP             ACC                           TUP
                      P0                    P0              P0                            P0




         IndexMemory             DataMemory        IndexMemory            DataMemory
                       DATA NODE 1                           DATA NODE 2



Copyright 2011 Severalnines AB                                   Control your database infrastructure   21
Index Scans - single table

       • For Index Scans / Range scans all partitions needs to be
         scanned.
              – The MySQL Server will contact a TC on one of the data nodes.
              – The TC will then start an index on each LQH in the Cluster.
       • SELECT data FROM subscriber WHERE subid<4


                                                               STORAGE LAYER


                                                             DATA             DATA
                                                             NODE             NODE

        subid              data
        1                  A          Partition 0
        3                  B                                  P0               P1

        2                  C          Partition 1
        4                  D

               subscriber
                                                    Note – only the PRIMARY partitions are shown.
Copyright 2011 Severalnines AB                                          Control your database infrastructure   22
Index Scans – single table

       • Each node will send back the records matching the search
         criteria.



                                            Data is sent back in batches of up to 32



                                 1   A                               STORAGE LAYER
                                 3   B
                                             2     C
                                                                  DATA                  DATA
                                                                  NODE                  NODE

        subid              data
        1                  A             Partition 0
        3                  B                                        P0                   P1

        2                  C             Partition 1
        4                  D

               subscriber
                                                       Note – only the PRIMARY partitions are shown.
Copyright 2011 Severalnines AB                                                    Control your database infrastructure   23
Index Scans – single table

       • The NDBAPI performs a merge sort.



                        1        A
                        2        B
                        3        C

                                                              STORAGE LAYER


                                                            DATA             DATA
                                                            NODE             NODE

        subid               data
        1                   A        Partition 0
        3                   B                                P0               P1

        2                   C        Partition 1
        4                   D

               subscriber
                                                   Note – only the PRIMARY partitions are shown.
Copyright 2011 Severalnines AB                                         Control your database infrastructure   24
Redo Logging and Check-pointing




Copyright 2011 Severalnines AB         Control your database infrastructure   25
Redo Logging and Check-pointing

       • MySQL Cluster writes a Redo Log and Checkpoints
         data to disk
              – Redo Logs and Checkpoints are essential for Recovery.
              – Both components are needed.
       • The redo log is periodically written to disk.
              – Asynchronously written.
              – Controlled by the Global Checkpoint Protoctol, GCP.
       • Checkpoints
              – The entire data set (DataMemory) is checkpointed to disk
              – Controlled by the Local Checkpoint Protocol, LCP.




Copyright 2011 Severalnines AB                             Control your database infrastructure   26
Redo Logging

       • INSERT INTO subscriber(id, data) VALUES(1,’A’);

                                 Data Node 0            PREPARE


                          LQH


               ACC                TUP

                                        DataMemory
                 IM
                                   subid         data
                                            P0
                                   1             A
                                                         subid         data
                                                         1             A                         Partition 0

                 1A              REDOBUFFER
                                                              subscriber




Copyright 2011 Severalnines AB                                     Control your database infrastructure    27
Redo Logging

       • INSERT INTO subscriber(id, data) VALUES(1,’A’);

                                 Data Node 0            COMMIT


                          LQH


               ACC                TUP

                                        DataMemory
                 IM
                                   subid         data
                                            P0
                                   1             A
                                                         subid            data
                                                         1                A                         Partition 0

                 1A       C      REDOBUFFER
                                                                 subscriber




Copyright 2011 Severalnines AB                                        Control your database infrastructure    28
Redo Logging

       • INSERT INTO subscriber(id, data) VALUES(2,’B’);

                                 Data Node 0            PREPARE


                          LQH


               ACC                TUP

                                        DataMemory
                 IM
                                   subid         data
                                            P0
                                   1             A
                                                         subid         data
                                                         1             A                         Partition 0
                                                         2             B
                 1A       C      REDOBUFFER
                                 2B
                                                              subscriber




Copyright 2011 Severalnines AB                                     Control your database infrastructure    29
Redo Logging

       • INSERT INTO subscriber(id, data) VALUES(1,’A’);

                                 Data Node 0            COMMIT


                          LQH


               ACC                TUP

                                        DataMemory
                 IM
                                   subid         data
                                            P0
                                   1             A
                                   2             B       subid            data
                                                         1                A                         Partition 0
                                                         2                B
                 1A       C      REDOBUFFER
                                 2B   C
                                                                 subscriber




Copyright 2011 Severalnines AB                                        Control your database infrastructure    30
Redo Logging
       • GlobalCheckpoint happens – sync RedoBuffer to Disk
              – TimeBetweenGlobalCheckpoints: 1000             (sync every 1000ms)
                                 Data Node 0                   GCP


                          LQH


               ACC                TUP

                                         DataMemory
                 IM
                                   subid            data
                                               P0
                                   1                A
                                   2                B             subid         data
                                                                  1             A                         Partition 0
                                                                  2             B
                                 REDOBUFFER
                                                                      subscriber

         REDO LOG                   1A     C        2B     C


Copyright 2011 Severalnines AB                                              Control your database infrastructure    31
Redo Logging

       • The Redo log is actually split in for four segments.
       • The segments are stored in
       • /datadir/ndb_X_fs/D8..D11
              – Each segment consists of a number of files.
       • Do e.g
              – ls –al /datadir/ndb_X_fs/D8
              – How many files?
              – What about the file size?




Copyright 2011 Severalnines AB                                Control your database infrastructure   32
Problem

       • To save all the changes made from time 0 the Redo
         log could grow to infinitely large.
              – This is not practical.
       • The Redo Log must “re-cycled” after some time.
       • Checkpoints takes care of this problem.




Copyright 2011 Severalnines AB                     Control your database infrastructure   33
Local Checkpoints

       • A Checkpoint (called Local Checkpoints) is a disk image
         of the records stored in the DataMemory
              – All data nodes starts a Local Checkpoint at the same time.
       • Each data node checkpoints its own DataMemory.
              – logical image of database of each data node (both Primary and
                Secondary)
       • Periodically, the records in the DataMemory is written out
         to disk.
              – TimeBetweenLocalCheckpoints
              – DiskCheckpointSpeed
       • An LCP starts after
         TimeBetweenLocalCheckpoints=20 (by default)
         ofword changes has happened to the cluster.
              – 4*2^20 =4MB (by default), or if no changes every 57th
                minute. Only one LCP is active at a time.
Copyright 2011 Severalnines AB                                Control your database infrastructure   34
Local Checkpoints

         • LCP 0 is being written.
                  DataMemory
                      DataMemory
                 subid          data
                                                 LCP TIME = USED_DATAMEMORY / DiskCheckpointSpeed
                 1              A
                                                 Checkpointing 10000MB of used DataMemory at a speed of 10MB/s
                 2              B
                                                 takes 1000seconds.




                      LCP TIME

      LCP start                        LCP end


REDOLOG          1A      C       2B    C                   REDO LOG



             subid       data
LCP          1           A
             2           B


  Copyright 2011 Severalnines AB                                                        Control your database infrastructure   35
Local Checkpoints

         • After 2 LCPs the Redo Log can be recycled (cut the tail of..)
                  DataMemory
                      DataMemory                              DataMemory
                 subid          data                          subid     data
                 1              A                             1         A
                 2              B                             2         B
                                                              3         C
                                                              4         D


                      TimebetweenLocalCheckpoints

                      LCP TIME                                    LCP TIME

      LCP start                        LCP end      LCP start                  LCP end


REDOLOG          1A      C       2B    C            3C    C       4D RC

                                                              subid     data
                                                              1         A
             subid       data
LCP                                                           2         B
             1           A
                                                              3         C
             2           B
                                                              4         D

  Copyright 2011 Severalnines AB                                                         Control your database infrastructure   36
Dimensioning (1)
       • If the Redo log gets full before the 2nd LCP
              – No writes can be performed on MySQL Cluster until 2nd LCP finishes
              – There have been bugs in the area – a crashed cluster in this state could
                lead to irrecoverable errors.




Copyright 2011 Severalnines AB                                          Control your database infrastructure   37
Dimensioning (1)

       • The Size of Redo Log is the only disk size setting
         specified at Cluster start.
              – It is one of the most important parameters to set correctly.
       • The size of the Redo Log should accommodate 3x
         Local Chekpoints.
       • If LCP1 starts immediately after LCP0 the redo log
         must be able to store
              – 3 x<bytes written/s to cluster> / #Nodes / #Replicas
                xDataMemory /DiskCheckpointSpeed




Copyright 2011 Severalnines AB                                Control your database infrastructure   38
Dimensioning (2)

       • Size of the Redo Log is expressed in
         NoOfFragmentLogFiles.
              – Each FragmentLogFile is physically made up of 4 files each
                FragmentLogFileSize.
              – Size of each FragmentLogFileSize=256M
       • Example:
              – 2 data nodes, 2 replicas, write 10MB/s of data,
                DiskCheckpointspeed=10MB/s, Datamemory=10GB
              – Size of Redo in MB: 3 x 10MB/s / 2 / 2 *10000M/10MB/s = 30 /
                1 * 1000 =30 000MB
              – NoOfFragmentLogFiles= (30000MB) / 4 * 256MB = 30.
       • Best Practice!
              – NoOfFragmentLogFiles= [4-6 ] xDataMemory / 4
                xFragmentLogFileSize
              – 4x for read mostly, 6x for very write intensive applications or if
                using BLOBs.
Copyright 2011 Severalnines AB                                    Control your database infrastructure   39
Other Buffers to Dimension

       • RedoBuffer
              – 32-64MB is a good size
       • TotalSendBufferMemory/TotalReceiveBufferMemory
              – Buffers for communication
              – SendBufferMemory/ReceiveBufferMemory
                     • Set to 4-8M
       • BackupDataBufferSize/BackupLogBufferSize
              – BackupMemory=BackupDataBufferSize+BackupLogBufferSize
              – Set to 16M and 4M resp.
       • DiskPageBufferMemory and UndoBuffer – for disk data
         only
       • www.severalnines.com/config will set these buffers to
         recommended values based on your configuration and
         workload.

Copyright 2011 Severalnines AB                         Control your database infrastructure   40
Coming next in Section 4:

                          Detailed Concepts (ctd …)

                                    Recovery




Copyright 2011 Severalnines AB                   Control your database infrastructure   41
We hope these training slides are
                        useful to you!

            Please visit our website to view the
               next section of this training.

       For any questions, comments, feedback or to
        book a training class, please contact us at:

                        services@severalnines.com

                                 Thank you!

Copyright 2011 Severalnines AB                Control your database infrastructure   42
Disclaimer

 © Copyright 2011 Severalnines AB. All rights reserved.

 Severalnines& the Severalnineslogo(s) are trademarks of Severalnines AB.

 MySQL is a registered trademark of Oracle and/or its affiliates.

 Other names may be trademarks of their respective owners.




Copyright 2011 Severalnines AB                           Control your database infrastructure   43

Weitere ähnliche Inhalte

Mehr von Severalnines

Tips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudTips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudSeveralnines
 
Working with the Moodle Database: The Basics
Working with the Moodle Database: The BasicsWorking with the Moodle Database: The Basics
Working with the Moodle Database: The BasicsSeveralnines
 
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDBSysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDBSeveralnines
 
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...Severalnines
 
Webinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDBWebinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDBSeveralnines
 
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControlWebinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControlSeveralnines
 
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...Severalnines
 
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...Severalnines
 
Disaster Recovery Planning for MySQL & MariaDB
Disaster Recovery Planning for MySQL & MariaDBDisaster Recovery Planning for MySQL & MariaDB
Disaster Recovery Planning for MySQL & MariaDBSeveralnines
 
MariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash CourseMariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash CourseSeveralnines
 
Performance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDBPerformance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDBSeveralnines
 
Advanced MySql Data-at-Rest Encryption in Percona Server
Advanced MySql Data-at-Rest Encryption in Percona ServerAdvanced MySql Data-at-Rest Encryption in Percona Server
Advanced MySql Data-at-Rest Encryption in Percona ServerSeveralnines
 
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket KnifePolyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket KnifeSeveralnines
 
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...Severalnines
 
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQLWebinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQLSeveralnines
 
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance TuningWebinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance TuningSeveralnines
 
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDBWebinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDBSeveralnines
 
Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?Severalnines
 
Webinar slides: Designing Open Source Databases for High Availability
Webinar slides: Designing Open Source Databases for High AvailabilityWebinar slides: Designing Open Source Databases for High Availability
Webinar slides: Designing Open Source Databases for High AvailabilitySeveralnines
 
Webinar slides: How to Get Started with Open Source Database Management
Webinar slides: How to Get Started with Open Source Database ManagementWebinar slides: How to Get Started with Open Source Database Management
Webinar slides: How to Get Started with Open Source Database ManagementSeveralnines
 

Mehr von Severalnines (20)

Tips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloudTips to drive maria db cluster performance for nextcloud
Tips to drive maria db cluster performance for nextcloud
 
Working with the Moodle Database: The Basics
Working with the Moodle Database: The BasicsWorking with the Moodle Database: The Basics
Working with the Moodle Database: The Basics
 
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDBSysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
 
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
 
Webinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDBWebinar slides: How to Migrate from Oracle DB to MariaDB
Webinar slides: How to Migrate from Oracle DB to MariaDB
 
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControlWebinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
 
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
 
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
 
Disaster Recovery Planning for MySQL & MariaDB
Disaster Recovery Planning for MySQL & MariaDBDisaster Recovery Planning for MySQL & MariaDB
Disaster Recovery Planning for MySQL & MariaDB
 
MariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash CourseMariaDB Performance Tuning Crash Course
MariaDB Performance Tuning Crash Course
 
Performance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDBPerformance Tuning Cheat Sheet for MongoDB
Performance Tuning Cheat Sheet for MongoDB
 
Advanced MySql Data-at-Rest Encryption in Percona Server
Advanced MySql Data-at-Rest Encryption in Percona ServerAdvanced MySql Data-at-Rest Encryption in Percona Server
Advanced MySql Data-at-Rest Encryption in Percona Server
 
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket KnifePolyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
Polyglot Persistence Utilizing Open Source Databases as a Swiss Pocket Knife
 
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
Webinar slides: Free Monitoring (on Steroids) for MySQL, MariaDB, PostgreSQL ...
 
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQLWebinar slides: An Introduction to Performance Monitoring for PostgreSQL
Webinar slides: An Introduction to Performance Monitoring for PostgreSQL
 
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance TuningWebinar slides: Our Guide to MySQL & MariaDB Performance Tuning
Webinar slides: Our Guide to MySQL & MariaDB Performance Tuning
 
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDBWebinar slides: Migrating to Galera Cluster for MySQL and MariaDB
Webinar slides: Migrating to Galera Cluster for MySQL and MariaDB
 
Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?Webinar slides: How to Measure Database Availability?
Webinar slides: How to Measure Database Availability?
 
Webinar slides: Designing Open Source Databases for High Availability
Webinar slides: Designing Open Source Databases for High AvailabilityWebinar slides: Designing Open Source Databases for High Availability
Webinar slides: Designing Open Source Databases for High Availability
 
Webinar slides: How to Get Started with Open Source Database Management
Webinar slides: How to Get Started with Open Source Database ManagementWebinar slides: How to Get Started with Open Source Database Management
Webinar slides: How to Get Started with Open Source Database Management
 

Kürzlich hochgeladen

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 

Kürzlich hochgeladen (20)

Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 

Severalnines Self-Training: MySQL® Cluster - Part III

  • 1. MySQL Cluster Training presented by severalnines.com Address: Contact: SeveralninesAB Jean-Jérôme Schmidt c/o SICS, Box 1263 Email: services@severalnines.com Isafjordsgatan22 SE-164-29 Kista Copyright 2011 Severalnines AB Control your database infrastructure 1
  • 2. Introduction • At Severalnines, we believe in sharing information and knowledge; we all come from an open source background • We know a lot of things about MySQL Cluster and think that MySQL Cluster is a great technology • These free MySQL Cluster Training slides are a contribution of ours to the knowledge and information sharing that‟s common practice in the open source community • If you have any questions on these slides or would like to book an actual training class, please contact us at: services@severalnines.com Copyright 2011 Severalnines AB Control your database infrastructure 2
  • 3. Training Slides - Concept • Over the coming weeks we will be chronologically releasing slides for the different sections of our MySQL Cluster Training program on our website. • The full agenda of the training with all of its modules is outlined in the next slides so that you can see what topics will be covered over the coming weeks. • Particularly specialised topics such as Cluster/J or NDB API are not fully covered in the slides. We recommend our instructor-led training classes for such topics. • Please contact us for more details: services@severalnines.com Copyright 2011 Severalnines AB Control your database infrastructure 3
  • 4. Full Training Agenda (1/4) • MySQL Cluster Introduction – MySQL eco system – Scale up, scale out, and sharding – MySQL Cluster Architecture – Use cases – Features – Node types and Roles • Detailed Concepts – Data Distribution – Verifying data distribution – Access Methods – Partitioning – Node failures and failure detection – Network Partitioning – Transactions and Locking – Consistency Model – Redo logging and Checkpointing Copyright 2011 Severalnines AB Control your database infrastructure 4
  • 5. Agenda (2/4) • Installing MySQL Cluster – Setting up MySQL Cluster – Starting/stopping nodes – Recovery and restarts – Upgrading configuration – Upgrading Cluster • Performance Tuning (instructor-led only; contact us at services@severalnines.com) – Differences compared to Innodb/MyISAM – Designing efficient and fast applications – Identifying bottlenecks – Tweaking configuration (OS and MySQL Cluster) – Query Tuning – Schema Design – Index Tuning Copyright 2011 Severalnines AB Control your database infrastructure 5
  • 6. Agenda (3/4) • Management and Administration – Backup and Restore – Geographical Replication – Online and offline operations – Ndbinfo tables – Reporting – Single user mode – Scaling Cluster • Disk Data – Use cases – Limitations – Best practice configuration • Designing a Cluster – Capacity Planning and Dimensioning – Hardware recommendations – Best practice Configuration – Storage calculations Copyright 2011 Severalnines AB Control your database infrastructure 6
  • 7. Agenda (4/4) • Resolving Issues – Common problems – Error logs and Tracefiles – Recovery and Escalation procedures • Connectivity Overview – NDBAPI – Cluster/J – LDAP • Severalnines Tools – Monitoring and Management – Benchmarking – Sandboxes – Configuration and capacity planning • Conclusion Copyright 2011 Severalnines AB Control your database infrastructure 7
  • 8. Agenda: Lab Exercises (only applicable to instructor-led training classes) • Lab Exercises – Installing and Loading data into MySQL Cluster – Starting/stopping nodes, recovery – Query tuning – Backup and Restore – Configuration Upgrade • Would you like to try something particular? – This is possible too, speak with your instructor Copyright 2011 Severalnines AB Control your database infrastructure 8
  • 9. Prerequisites • Readers / Participants have understanding of SQL and basic database concepts. • Laptops/PCs for hands-on exercises • Linux: 1GB RAM • Windows: 2GB RAM • Approx. 20GB disk space and Virtualbox installed. • Virtualbox can be downloaded for free at http://www.virtualbox.org/wiki/Downloads • MySQL Cluster version 7.1 or later Copyright 2011 Severalnines AB Control your database infrastructure 9
  • 10. 3rd Installment of the Severalnines Cluster Self-Training Part 2 : Detailed Concepts (ctd…) Section 3 Copyright 2011 Severalnines AB Control your database infrastructure 10
  • 11. Topics covered in Section 3 • Access Methods • Redo Logging and Check-pointing Copyright 2011 Severalnines AB Control your database infrastructure 11
  • 12. Access Methods Copyright 2011 Severalnines AB Control your database infrastructure 12
  • 13. Access Methods • The Data Nodes can handle the following primitive types of requests: – PRIMARY KEY – INDEX SCAN – UNIQUE INDEX – (Note in 7.2.x a new “fast-join” interface exists as well). • Any of the following queries will be translated and execute a combination of the above. – UPDATE t1 SET data=„abc‟ WHERE id=1; – DELETE FROM t1 WHERE id>1; – SELECT * FROM t1 WHERE t1.id=1 – SELECT * FROM t1, t2 WHERE t1.id=t2.id and t.id=1; Copyright 2011 Severalnines AB Control your database infrastructure 13
  • 14. Primary Key • The Primary Key request is the fastest primitive type to access data in the data nodes. • SELECT data FROM subscriber WHERE subid=1; STORAGE LAYER DATA DATA NODE 0 NODE 1 subid data 1 A Partition 0 3 B P0 P1 2 C Partition 1 4 D subscriber Copyright 2011 Severalnines AB Control your database infrastructure 14
  • 15. Primary Key – Calculate Hash on PK • SELECT data FROM subscriber WHERE subid=1; 1. MySQL Server (NDBAPI) calculates md5sum(subid=1)  128-bit value 2. MySQL Server sends the request to the data node having the Primary partition for the requested data STORAGE LAYER DATA DATA NODE NODE subid data 1 A Partition 0 3 B P0 P1 2 C Partition 1 4 D subscriber Copyright 2011 Severalnines AB Control your database infrastructure 15
  • 16. Primary Key – Determine Partition • SELECT data FROM subscriber WHERE subid=1; PARTITION_HASH INDEX_HASH 1. MySQL Server (NDBAPI) calculates md5sum(subid=1)  128-bit value 64-bit 64-bit 2. PARTITION=(PARTITION_HASH MODULO #PARTTIONS ) STORAGE LAYER DATA DATA NODE NODE subid data 1 A Partition 0 3 B P0 P1 2 C Partition 1 4 D subscriber Copyright 2011 Severalnines AB Control your database infrastructure 16
  • 17. Primary Key – Execute Request • SELECT data FROM subscriber WHERE subid=1; PARTITION_HASH INDEX_HASH 1. MySQL Server (NDBAPI) calculates md5sum(subid=1)  128-bit value 64-bit 64-bit 2. PARTITION=(PARTITION_HASH MODULO #PARTTIONS ) 3. Map PARTITTION to Data node and SEND REQUEST STORAGE LAYER DATA DATA NODE NODE subid data 1 A Partition 0 3 B P0 P1 2 C Partition 1 4 D subscriber Copyright 2011 Severalnines AB Control your database infrastructure 17
  • 18. Unique Indexes • A Unique Index is used as a CONSTRAINT. • The Unique Index is represented as a hidden separate table. – Storage cost can be high. • CREATE UNIQUE INDEX ix_unique ON subscriber(data) subid data data2 data subid 1 A AA A 1 Partition 0 Partition 0 3 B BB C 2 2 C CC B 3 Partition 1 Partition 1 4 D DD D 4 subscriber Ix_unique Copyright 2011 Severalnines AB Control your database infrastructure 18
  • 19. Unique Index Lookup • SELECT data2 from subscriber WHERE data=„B‟; STORAGE LAYER DATA DATA NODE NODE P0 P1 subid data data2 data subid 1 A AA A 1 Partition 0 Partition 0 3 B BB C 2 2 C CC B 3 Partition 1 Partition 1 4 D DD D 4 subscriber Ix_unique Copyright 2011 Severalnines AB Control your database infrastructure 19
  • 20. Index Scans - Secondary Indexes • The ordered index is stored in the DataMemory – Each index cost 16B per record (no matter how many columns are indexed) • By default the PRIMARY KEY and UNIQUE KEY also has an ordered index – Avoid it by specifying USING HASH • Saves 16B per record. ACC TUP ACC TUP P0 P0 P0 P0 IndexMemory DataMemory IndexMemory DataMemory DATA NODE 1 DATA NODE 2 Copyright 2011 Severalnines AB Control your database infrastructure 20
  • 21. Index Scans - Secondary Indexes • T-tree indexes are used for ordered secondary indexes – Optimized for In-memory data – does not carry any data (space) . – Each data node maintains a local ordered index of its data. ACC TUP ACC TUP P0 P0 P0 P0 IndexMemory DataMemory IndexMemory DataMemory DATA NODE 1 DATA NODE 2 Copyright 2011 Severalnines AB Control your database infrastructure 21
  • 22. Index Scans - single table • For Index Scans / Range scans all partitions needs to be scanned. – The MySQL Server will contact a TC on one of the data nodes. – The TC will then start an index on each LQH in the Cluster. • SELECT data FROM subscriber WHERE subid<4 STORAGE LAYER DATA DATA NODE NODE subid data 1 A Partition 0 3 B P0 P1 2 C Partition 1 4 D subscriber Note – only the PRIMARY partitions are shown. Copyright 2011 Severalnines AB Control your database infrastructure 22
  • 23. Index Scans – single table • Each node will send back the records matching the search criteria. Data is sent back in batches of up to 32 1 A STORAGE LAYER 3 B 2 C DATA DATA NODE NODE subid data 1 A Partition 0 3 B P0 P1 2 C Partition 1 4 D subscriber Note – only the PRIMARY partitions are shown. Copyright 2011 Severalnines AB Control your database infrastructure 23
  • 24. Index Scans – single table • The NDBAPI performs a merge sort. 1 A 2 B 3 C STORAGE LAYER DATA DATA NODE NODE subid data 1 A Partition 0 3 B P0 P1 2 C Partition 1 4 D subscriber Note – only the PRIMARY partitions are shown. Copyright 2011 Severalnines AB Control your database infrastructure 24
  • 25. Redo Logging and Check-pointing Copyright 2011 Severalnines AB Control your database infrastructure 25
  • 26. Redo Logging and Check-pointing • MySQL Cluster writes a Redo Log and Checkpoints data to disk – Redo Logs and Checkpoints are essential for Recovery. – Both components are needed. • The redo log is periodically written to disk. – Asynchronously written. – Controlled by the Global Checkpoint Protoctol, GCP. • Checkpoints – The entire data set (DataMemory) is checkpointed to disk – Controlled by the Local Checkpoint Protocol, LCP. Copyright 2011 Severalnines AB Control your database infrastructure 26
  • 27. Redo Logging • INSERT INTO subscriber(id, data) VALUES(1,’A’); Data Node 0 PREPARE LQH ACC TUP DataMemory IM subid data P0 1 A subid data 1 A Partition 0 1A REDOBUFFER subscriber Copyright 2011 Severalnines AB Control your database infrastructure 27
  • 28. Redo Logging • INSERT INTO subscriber(id, data) VALUES(1,’A’); Data Node 0 COMMIT LQH ACC TUP DataMemory IM subid data P0 1 A subid data 1 A Partition 0 1A C REDOBUFFER subscriber Copyright 2011 Severalnines AB Control your database infrastructure 28
  • 29. Redo Logging • INSERT INTO subscriber(id, data) VALUES(2,’B’); Data Node 0 PREPARE LQH ACC TUP DataMemory IM subid data P0 1 A subid data 1 A Partition 0 2 B 1A C REDOBUFFER 2B subscriber Copyright 2011 Severalnines AB Control your database infrastructure 29
  • 30. Redo Logging • INSERT INTO subscriber(id, data) VALUES(1,’A’); Data Node 0 COMMIT LQH ACC TUP DataMemory IM subid data P0 1 A 2 B subid data 1 A Partition 0 2 B 1A C REDOBUFFER 2B C subscriber Copyright 2011 Severalnines AB Control your database infrastructure 30
  • 31. Redo Logging • GlobalCheckpoint happens – sync RedoBuffer to Disk – TimeBetweenGlobalCheckpoints: 1000 (sync every 1000ms) Data Node 0 GCP LQH ACC TUP DataMemory IM subid data P0 1 A 2 B subid data 1 A Partition 0 2 B REDOBUFFER subscriber REDO LOG 1A C 2B C Copyright 2011 Severalnines AB Control your database infrastructure 31
  • 32. Redo Logging • The Redo log is actually split in for four segments. • The segments are stored in • /datadir/ndb_X_fs/D8..D11 – Each segment consists of a number of files. • Do e.g – ls –al /datadir/ndb_X_fs/D8 – How many files? – What about the file size? Copyright 2011 Severalnines AB Control your database infrastructure 32
  • 33. Problem • To save all the changes made from time 0 the Redo log could grow to infinitely large. – This is not practical. • The Redo Log must “re-cycled” after some time. • Checkpoints takes care of this problem. Copyright 2011 Severalnines AB Control your database infrastructure 33
  • 34. Local Checkpoints • A Checkpoint (called Local Checkpoints) is a disk image of the records stored in the DataMemory – All data nodes starts a Local Checkpoint at the same time. • Each data node checkpoints its own DataMemory. – logical image of database of each data node (both Primary and Secondary) • Periodically, the records in the DataMemory is written out to disk. – TimeBetweenLocalCheckpoints – DiskCheckpointSpeed • An LCP starts after TimeBetweenLocalCheckpoints=20 (by default) ofword changes has happened to the cluster. – 4*2^20 =4MB (by default), or if no changes every 57th minute. Only one LCP is active at a time. Copyright 2011 Severalnines AB Control your database infrastructure 34
  • 35. Local Checkpoints • LCP 0 is being written. DataMemory DataMemory subid data LCP TIME = USED_DATAMEMORY / DiskCheckpointSpeed 1 A Checkpointing 10000MB of used DataMemory at a speed of 10MB/s 2 B takes 1000seconds. LCP TIME LCP start LCP end REDOLOG 1A C 2B C REDO LOG subid data LCP 1 A 2 B Copyright 2011 Severalnines AB Control your database infrastructure 35
  • 36. Local Checkpoints • After 2 LCPs the Redo Log can be recycled (cut the tail of..) DataMemory DataMemory DataMemory subid data subid data 1 A 1 A 2 B 2 B 3 C 4 D TimebetweenLocalCheckpoints LCP TIME LCP TIME LCP start LCP end LCP start LCP end REDOLOG 1A C 2B C 3C C 4D RC subid data 1 A subid data LCP 2 B 1 A 3 C 2 B 4 D Copyright 2011 Severalnines AB Control your database infrastructure 36
  • 37. Dimensioning (1) • If the Redo log gets full before the 2nd LCP – No writes can be performed on MySQL Cluster until 2nd LCP finishes – There have been bugs in the area – a crashed cluster in this state could lead to irrecoverable errors. Copyright 2011 Severalnines AB Control your database infrastructure 37
  • 38. Dimensioning (1) • The Size of Redo Log is the only disk size setting specified at Cluster start. – It is one of the most important parameters to set correctly. • The size of the Redo Log should accommodate 3x Local Chekpoints. • If LCP1 starts immediately after LCP0 the redo log must be able to store – 3 x<bytes written/s to cluster> / #Nodes / #Replicas xDataMemory /DiskCheckpointSpeed Copyright 2011 Severalnines AB Control your database infrastructure 38
  • 39. Dimensioning (2) • Size of the Redo Log is expressed in NoOfFragmentLogFiles. – Each FragmentLogFile is physically made up of 4 files each FragmentLogFileSize. – Size of each FragmentLogFileSize=256M • Example: – 2 data nodes, 2 replicas, write 10MB/s of data, DiskCheckpointspeed=10MB/s, Datamemory=10GB – Size of Redo in MB: 3 x 10MB/s / 2 / 2 *10000M/10MB/s = 30 / 1 * 1000 =30 000MB – NoOfFragmentLogFiles= (30000MB) / 4 * 256MB = 30. • Best Practice! – NoOfFragmentLogFiles= [4-6 ] xDataMemory / 4 xFragmentLogFileSize – 4x for read mostly, 6x for very write intensive applications or if using BLOBs. Copyright 2011 Severalnines AB Control your database infrastructure 39
  • 40. Other Buffers to Dimension • RedoBuffer – 32-64MB is a good size • TotalSendBufferMemory/TotalReceiveBufferMemory – Buffers for communication – SendBufferMemory/ReceiveBufferMemory • Set to 4-8M • BackupDataBufferSize/BackupLogBufferSize – BackupMemory=BackupDataBufferSize+BackupLogBufferSize – Set to 16M and 4M resp. • DiskPageBufferMemory and UndoBuffer – for disk data only • www.severalnines.com/config will set these buffers to recommended values based on your configuration and workload. Copyright 2011 Severalnines AB Control your database infrastructure 40
  • 41. Coming next in Section 4: Detailed Concepts (ctd …) Recovery Copyright 2011 Severalnines AB Control your database infrastructure 41
  • 42. We hope these training slides are useful to you! Please visit our website to view the next section of this training. For any questions, comments, feedback or to book a training class, please contact us at: services@severalnines.com Thank you! Copyright 2011 Severalnines AB Control your database infrastructure 42
  • 43. Disclaimer © Copyright 2011 Severalnines AB. All rights reserved. Severalnines& the Severalnineslogo(s) are trademarks of Severalnines AB. MySQL is a registered trademark of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Copyright 2011 Severalnines AB Control your database infrastructure 43

Hinweis der Redaktion

  1. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  2. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  3. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  4. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  5. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  6. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  7. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  8. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  9. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  10. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  11. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  12. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  13. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  14. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  15. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  16. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  17. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  18. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  19. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  20. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  21. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  22. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  23. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  24. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  25. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  26. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com
  27. Severalnines has been offering its products free of charge since 2007, while the founders were employed at MySQL. These products are the de-facto standard tools to assist MySQL customers and users in deploying their MySQL clusters. More information about Severalnines at www.severalnines.com