SlideShare une entreprise Scribd logo
1  sur  133
Télécharger pour lire hors ligne
René Cannaò
Senior DBA PalominoDB
rene@palominodb.com
@rene_cannao
MySQL Cluster
(NDB)
Tutorial
Agenda
Introduction - Presentation
MySQL Cluster Overview
MySQL Cluster Components
Partitioning
Internal Blocks
General Configuration
Transactions
Checkpoints on disk
Handling failure
Disk data
Start Types and Start Phases
Storage Requirements
Backups
NDB and binlog
Native NDB Online Backups
About myself
My name is René Cannaò
Working as DBA since 2005
Starting my experience with NDB in 2007
In 2008 I joined the MySQL Support Engineer
Team at Sun/Oracle
Working as Senior DBA for PalominoDB
We have a booth: please come and visit us!
Questions
If you have questions stop me at any time!
If the answer is short will be answered
immediately.
If the answer it long, we can discuss at the end
of the tutorial
What this course is Not
This course doesn't cover advanced topics like:
Advanced Setup
Performance Tuning
Configuration of multi-threads
Online add nodes
NDBAPI
noSQL access
Geographic Replication
BLOB/TEXT fields
MySQL Cluster Overview
MySQL Cluster Overview
High Availability Storage Engine for MySQL
Provides:
● High Availability
● Clustering
● Horizontal Scalability
● Shared Nothing Architecture
● SQL and noSQL access
High Availability and Clustering
High Availability:
● survives routine failures or maintenance
○ hardware or network failure, software upgrade, etc
● provides continuous services
● no interruption of services
Clustering:
● parallel processing
● increase availability
Scalability
Ability to handle increased number of requests
Vertical:
● replace HW with more powerful one
Horizontal:
● add component to the system
Shared Nothing Architecture
Characterized by:
● No single point of failure
● Redundancy
● Automatic Failover
MySQL Cluster Summary
Shared Nothing Architecture
No Single Point Of Failure (SPOF)
Synchronous replication between nodes
Automatic failover with no data loss
ACID transaction
Durability with NumberOfReplica > 1
READ COMMITTED transaction isolation level
Row level locking
MySQL Cluster
Components
Components Overview
mysql client MySQL C APIPHP Connector/J
NDB API
NDB
Management
Clients
NDB
Management
Servers
mysqld mysqld mysqld
ndbd
ndbd ndbd
ndbd
Cluster Nodes
3 Node Types are present in a MySQL Cluster:
● Management Node
● Data Node
● Access Node
Management Node
ndb_mgmd process
Administrative tasks:
● configure the Cluster
● start / stop other nodes
● run backup
● monitoring
● coordinator
Data Node
ndbd process ( or ndbmtd )
Stores cluster data
● mainly in memory
● also on disk ( limitations apply )
Coordinate transactions
Data Node ( ndbmtd )
What is ndbmtd ?
Multi-threaded equivalent of ndbd
File system compatible with ndbd
By default run in single thread mode
Configured via MaxNoOfExecutionThreads of
ThreadConfig
API Node
Process able to access data stored in Data
Nodes:
● mysqld process with NDBCLUSTER support
● application that connects to the cluster
through NDB API (without mysqld)
Partitioning
Vertical Partitioning
Horizontal Partitioning
Partitions example (1/2)
5681 Alfred 30 2010-11-10
8675 Lisa 34 1971-01-12
5645 Mark 21 1982-01-02
0965 Josh 36 2009-06-33
5843 Allan 22 2007-04-12
1297 Albert 40 2000-12-20
1875 Anne 34 1984-11-22
9346 Mary 22 1983-08-05
8234 Isaac 20 1977-07-06
8839 Leonardo 28 1999-11-08
7760 Donna 37 1997-03-04
3301 Ted 33 2005-05-23
Table
Partitions example (2/2)
5681 Alfred 30 2010-11-10
8675 Lisa 34 1971-01-12
5645 Mark 21 1982-01-02
0965 Josh 36 2009-06-33
5843 Allan 22 2007-04-12
1297 Albert 40 2000-12-20
1875 Anne 34 1984-11-22
9346 Mary 22 1983-08-05
8234 Isaac 20 1977-07-06
8839 Leonardo 28 1999-11-08
7760 Donna 37 1997-03-04
3301 Ted 33 2005-05-23
P1
P2
P3
P4
Table
Partitioning in MySQL Cluster
MySQL Cluster natively supports Partitioning
Distribute portions of individual tables in
different locations
PARTITION BY (LINEAR) KEY is the only
partitioning type supported
Partitions, Node Groups & Replicas
Partition:
portion of the data stored in the cluster
Node Groups:
set of data nodes that stores a set of partitions
Replicas:
copies of a cluster partition
Partitions in NDB
P2P1 P3 P4
NDB1 NDB2 NDB3 NDB4
Partitions and Replicas
P2P
P1S
P1P
P2S
P3P
P4S
P4P
P3S
NDB1 NDB2 NDB3 NDB4
Node Groups
P2P
P1S
P1P
P2S
P3P
P4S
P4P
P3S
NDB1 NDB2 NDB3 NDB4
Node Group 0 Node Group 1
Node Groups
P2P
P1S
P1P
P2S
P3P
P4S
P4P
P3S
NDB1 NDB2 NDB3 NDB4
Node Group 0 Node Group 1
Node Groups
P2P
P1S
P1P
P2S
P3P
P4S
P4P
P3S
NDB1 NDB2 NDB3 NDB4
Node Group 0 Node Group 1
Internal Blocks
Blocks in Data Node (1/2)
A data node is internally structured in several
blocks/code with different functions:
● Transaction Coordinator (TC) :
○ coordinates transactions
○ starts Two Phase Commit
○ distributes requests to LQH
● Local Query Handler (LQH)
○ allocates local operation records
○ manages the Redo Log
Blocks in Data Node (2/2)
● ACC
○ stores hash indexes
○ manages records locking
● TUP
○ stores row data
● TUX
○ stores ordered indexes
● BACKUP , CMVMI , DICT , DIH , SUMA , etc
Ref:
http://dev.mysql.com/doc/ndbapi/en/ndb-internals-ndb-protocol.html
Blocks on ndbd (simplified)
Blocks on ndbmtd (simplified)
Where is data stored?
In memory!
TUP TUX
LQH
TC
ACC
IndexMemory
primary keys
unique keys
DataMemory
data rows
ordered indexes
General Configuration
Global parameters
NoOfReplicas (mandatory)
Defines the number of replicas for each partition/table
DataDir:
Location for log/trace files and pid file
FileSystemPath:
location for of all files related to MySQL Cluster
Global boolean parameters
LockPagesInMainMemory (0) :
Lock all memory in RAM ( no swap )
StopOnError (1) :
Automatic restart of data node in case of failure
IndexMemory and DataMemory
IndexMemory: defines the amount of memory
for hashes indexes ( PK and UNIQUE )
DataMemory: defines the amount of memory
for:
data
ordered indexes
UNDO information
Metadata Objects
MaxNoOfTables
MaxNoOfOrderedIndexes
MaxNoOfUniqueHashIndexes
Transactions
Transactions Overview
Two Phase Commit
ACID
● Durability with multiple copies
● Committed on memory
READ_COMMITTED
Transaction implementation
● The API node contacts a TC in one of the Data Node
(round-robin fashion, or Distribution Awareness)
● The TC starts the transaction and the Two Phase
Commit (2PC) protocol
● The TC contacts the LQH of the Data Nodes involved in
the transaction
● LQH handles row level locking:
○ Exclusive lock
○ Shared lock
○ No lock
Two Phase Commit (1/2)
Phase 1 , Prepare :
Node groups get their information updated
Phase 2 , Commit :
the change is committed
Two Phase Commit (2/2)
Rows operations
Primary key operation ( read and write )
Unique index operation ( read )
Ordered index scans ( read only )
Full-table scans (read only)
Primary Key Write (1/4)
● API node connects to TC
● TC connects to LQH of the data node with the primary
fragment
● LQH queries ACC to get the row id
● LQH performs the operation on TUP
● LQH connects to the LQH of the data node with the
secondary fragment
● LQH on secondary performs the same operation
● LQH on secondary informs TC that the prepare phase is
completed
● TC starts the commit phase
Primary Key Write (2/4)
Primary Key Write (3/4)
Primary Key Write (4/4)
Primary Key Read
Without distribution awareness
Primary Key Read
With distribution awareness
Unique Index Read (1/2)
Unique Index is internally implemented as a
hidden table with two columns where the PK is
the Unique Key itself and the second column is
the PK of the main table.
To read a Unique index:
● A PK read is performed on hidden table to
get the value of the PK of main table
● A PK read is performed on main table
Unique Index Read (2/2)
Full Table Scan
Ordered Index Scan
Transaction Parameters (1/3)
MaxNoOfConcurrentTransactions: number of
simultaneous transactions that can run in a node
(maximum number of tables accessed in any
single transaction + 1)
* number of cluster SQL nodes
Transaction Parameters (2/3)
MaxNoOfConcurrentOperations:
Total number of records that at any time can be
updated or locked in data node, and UNDO.
Beside the data node, TC needs information
about all the records involved in a transaction
MaxNoOfLocalOperations: for not too large
transactions, it defaults to
MaxNoOfConcurrentOperationsx1.1
Transaction Parameters (3/3)
MaxDMLOperationsPerTransaction
Limits the number of DML operations
Count is in # of records, not # of statements
TransactionInactiveTimeout
Idle transactions are rolled back
TransactionDeadlockDetectionTimeout
Time based deadlock and lock wait detection
Also possible that the data node is dead or overloaded
Checkpoints on disk
Checkpoints
MySQL Cluster is a in-memory storage engine:
● data is only in memory? WRONG!
● data is regularly saved on disk
When a data node writes on disk is performing
a checkpoint
Exception:
MySQL Cluster can also run in DiskLess mode, with
"reduced durability" and unable to run Native NDB Backup
Checkpoint types
Local Checkpoint (LCP):
● specific to a single node;
● all data in memory is saved to disk
● can take minutes or hours
Global Checkpoint (GCP):
● transactions across nodes are synchronized
● redo log flushed on disk
Memory and disk checkpoints
Coordinator
DataMemory
IndexMemory
RedoBuffer
LCP0
LCP1
LCP0
DataMemory
IndexMemory
RedoBuffer
LCP1
RedoLog Files RedoLog Files
LCP LCP
GCP GCP
Undo and Redo Parameters
UndoIndexBuffer and UndoDataBuffer
Buffers used during local checkpoint to perform consistent
snapshot without blocking writes.
RedoBuffer
In memory buffer for REDO log (on disk)
Checkpointing parameters
TimeBetweenLocalCheckpoints
Doesn't define a time interval, but the amount of writes
operations ( as a base-2 logarithm of 4-byte words) .
Examples:
20 ( default ) means 4 x 220
= 4MB
24 means 4 x 224
= 64MB
TimeBetweenGlobalCheckpoints
Defines how often commits are flushed to REDO logs
Fragment Log Files
NoOfFragmentLogFiles ( default 16 )
FragmentLogFileSize ( default 16 MB )
REDO logs are organized in a ring, where head and tail
never meet. If checkpointing is slow, updating transactions
are aborted. Total REDO logs size is defined as:
NoOfFragmentLogFiles set of 4 FragmentLogFileSize
Default : 16 x 4 x 16MB = 1024MB
InitFragmentLogFiles : SPARSE or FULL
Checkpoint write control
ODirect: (off) O_DIRECT for LCP and GCP
CompressedLCP: (off) equivalent of gzip --fast
DiskCheckpointSpeed: speed of local
checkpoints to disk ( default 10MB/s )
DiskCheckpointSpeedInRestart : during restart
Diskless mode
Diskless :
It is possible to configure the whole Cluster to
run without using the disk.
When Diskless is enabled ( disabled by default ):
● LCP and GCP are not performed;
● NDB Native Backup is not possible;
● a complete cluster failure ( or shutdown ) =
data lost
Handling Failure
Data node failure (1/2)
Failures happen!
HW failure, network issue, OS crash, SW bug, …
MySQL Cluster is constantly monitoring itself
Each data node periodically checks other data nodes via
heartbeat
Each data node periodically checks API nodes via
heartbeat
Data node failure (2/2)
If a node fails to respond to heartbeats, the data node that
detects the failure communicates it to other data nodes
The data nodes stop using the failed node and switch to the
secondary node for the same fragment
Timeouts Parameters
TimeBetweenWatchDogCheck
The watchdog thread checks if the main thread got stuck
HeartbeatIntervalDbDb
Heartbeat interval between data nodes
HeartbeatIntervalDbApi
Heartbeat interval between data nodes and API nodes
Disk Data
Available since MySQL 5.1.6
Store non-indexed columns on disk
Doesn't support variable sized storage
On disk : tablespaces and undo logs
In memory : page buffer ( cache )
Disk Data
Objects:
● Undo log files: store information to rollback transactions
● Undo log group: a collection of undo log files
● Data files: store MySQL Cluster Disk Data table data
● Tablespace : a named collection of data files
Notes:
● Each tablespace needs an undo log group assigned
● currently, only one undo log group can exist in the same
MySQL Cluster
Disk Data Objects
Disk Data - data flow
Disk Page Buffer
Tablespace 1 Tablespace 2 Undo Log Group
ThreadIOPool
Metadata
Shared Memory
Undo Buffer
Pages
Requests
Queues
Disk Data Configuration Parameters
DiskPageBufferMemory : cache for disk pages
SharedGlobalMemory : shared memory for
● DataDisk UNDO buffer
● DiskData metadata ( tablespace / undo / files )
● Buffers for disk operations
DiskIOThreadPool : number of threads for I/O
Using SQL statement:
CREATE LOGFILE GROUP logfile_group
ADD UNDOFILE 'undo_file'
[INITIAL_SIZE [=] initial_size]
[UNDO_BUFFER_SIZE [=] undo_buffer_size]
ENGINE [=] engine_name
Create Undo Log Group
UNDOFILE : filename on disk
INITIAL_SIZE : 128MB by default
UNDO_BUFFER_SIZE : 8MB by default
ENGINE : { NDB | NDBCLUSTER }
Create Undo Log Group
ALTER LOGFILE GROUP logfile_group
ADD UNDOFILE 'undo_file'
[INITIAL_SIZE [=] initial_size]
ENGINE [=] engine_name
Alter Undo Log Group
CREATE LOGFILE GROUP lg1
ADD UNDOFILE 'undo1.log'
INITIAL_SIZE = 134217728
UNDO_BUFFER_SIZE = 8388608
ENGINE = NDBCLUSTER
ALTER LOGFILE GROUP lg1
ADD UNDOFILE 'undo2.log'
INITIAL_SIZE = 134217728
ENGINE = NDBCLUSTER
Create Undo Log Group : example
In [NDBD] definition:
InitialLogFileGroup = [name=name;]
[undo_buffer_size=size;] file-specification-list
Example:
InitialLogFileGroup = name=lg1;
undo_buffer_size=8M; undo1.log:128M;undo2.log:128M
Create Undo Log Group
Using SQL statement:
CREATE TABLESPACE tablespace_name
ADD DATAFILE 'file_name'
USE LOGFILE GROUP logfile_group
[INITIAL_SIZE [=] initial_size]
ENGINE [=] engine_name
Create Tablespace
logfile_group : mandatory! The log file group must be
specified
DATAFILE : filename on disk
INITIAL_SIZE : 128MB by default
ENGINE : { NDB | NDBCLUSTER }
Create Tablespace
Using SQL statement:
ALTER TABLESPACE tablespace_name
{ADD|DROP} DATAFILE 'file_name'
[INITIAL_SIZE [=] size]
ENGINE [=] engine_name
Alter Tablespace
CREATE TABLESPACE ts1
ADD DATAFILE 'datafile1.data'
USE LOGFILE GROUP lg1
INITIAL_SIZE = 67108864
ENGINE = NDBCLUSTER;
ALTER TABLESPACE ts1
ADD DATAFILE 'datafile2.data'
INITIAL_SIZE = 134217728
ENGINE = NDBCLUSTER;
Create Tablespace : example
In [NDBD] definition:
InitialTablespace = [name=name;] [extent_size=size;]
file-specification-list
Example:
InitialTablespace = name=ts1;
datafile1.data:64M; datafile2.data:128M
Note: no need to specify the Undo Log Group
Create Tablespace
Start Types
and
Start Phases
Start Types
● (IS) Initial start
● (S) System restart
● (N) Node restart
● (IN) Initial node restart
Initial start (IS)
All the data nodes start with clean filesystem.
During the very first start, or when all data
nodes are started with --initial
Note:
Disk Data files are not removed from the
filesystem when data node is started with --
initial
System restart (S)
The whole Cluster is restarted after it has been
shutdown .
The Cluster resumes operations from where it
was left before shutdown. No data is lost.
Node restart (N)
The Node is restarted while the Cluster is
running.
This is necessary during upgrade/downgrade,
changing configuration, performing HW/SW
maintenance, etc
Initial node restart (IN)
Similar to node restart (the Cluster is running) ,
but the data node is started with a clean
filesystem.
Use --initial to clean the filesystem .
Note: --initial doesn't delete DiskData files
Start Phases ( 1/4 )
Phase -1 : setup and initialization
Phase 0 : filesystem initialization
Phase 1 : communication inter-blocks and
between nodes is initialized
Phase 2 : status of all nodes is checked
Phase 3 : DBLQH and DBTC setup
communication between them
Start Phases ( 2/4 )
Phase 4:
● IS or IN : Redo Log Files are created
● S : reads schemas, reads data from last
Local Checkpoint, reads and apply all the
Global Checkpoints from Redo Log
● N : find the tail of the Redo Log
Start Phases ( 3/4 )
Phase 5 : for IS or S, a LCP is performed,
followed by GCP
Phase 6 : node groups are created
Phase 7 : arbitrator is selected, data nodes are
marked as Started, and API/SQL nodes can
connect
Phase 8 : for S , all indexes are rebuilt
Phase 9 : internal variables are reset
Start Phases ( 4/4 )
Phase 100 : ( obsolete )
Phase 101 :
● data node takes responsibility for delivery its
primary data to subscribers
● for IS or S : transaction handlers is enabled
● for N or IN : new node can act as TC
Storage requirements
In general, storage requirements for MySQL
Cluster is the same as storage requirements for
other storage engines.
But a lot of extra factors need to be considered
when calculating storage requirements for
MySQL Cluster tables.
Storage requirements
Each individual column is 4-byte aligned.
CREATE TABLE ndb1 (
id INT NOT NULL PRIMARY KEY,
type_id TINYINT, status TINYINT,
name BINARY(14),
KEY idx_status ( status ), KEY idx_name ( name )
) ENGINE = ndbcluster;
Bytes used per row: 4+4+4+16 = 28 ( storage )
4-byte alignment
If table definition allows NULL for some columns, MySQL
Cluster reserves 4 bytes for 32 nullable columns ( or 8
bytes for 64 columns)
CREATE TABLE ndb1 (
id INT NOT NULL PRIMARY KEY,
type_id TINYINT, status TINYINT,
name BINARY(14),
KEY idx_status ( status ), KEY idx_name ( name )
) ENGINE = ndbcluster;
Bytes used per row: 4 ( NULL ) + 28 ( storage )
NULL values
Each record has a 16 bytes overhead
Each ordered index has a 10 bytes overhead
per record
Each page is 32KB , and each record must be
stored in just one page
Each page has a 128 byte page overhead
DataMemory overhead
Each primary/unique key requires 25 bytes for
the hash index plus the size of the field
8 more bytes are required if the size of the field
is larger than 32 bytes
IndexMemory overhead
Storage requirement for test table
CREATE TABLE ndb1 (
id INT NOT NULL PRIMARY KEY,
type_id TINYINT, status TINYINT,
name BINARY(14),
KEY idx_status ( status ), KEY idx_name ( name )
) ENGINE = ndbcluster;
Memory used per row = ~107 bytes
● 4 bytes for NULL values
● 28 bytes for storage
● 16 bytes for record overhead
● 30 bytes for ordered indexes (3)
● 29 bytes for primary key index ( 25 bytes + 4 bytes )
plus all the wasted memory in page overhead/alignment
Hidden Primary Key
In MySQL Cluster every table requires a
primary key.
A hidden primary key is create if PK is not
explicitly defined
The hidden PK uses 31-35 bytes per record
Backups
Why backup?
● Isn't MySQL Cluster fully redundant?
● Human mistakes
● Application bugs
● Point in time recovery
● Deploy of development/testing envs
● Deploy a DR site
● ... others
Backup methodologies
mysqldump
Native Online NDB Backup
Backup with mysqldump
storage engine agnostic
dumps other objects like triggers, view, SP
connects to any API node
Backup with mysqldump ( cont. )
Usage:
mysqldump [options] db_name [tbl_name ...]
mysqldump [options] --databases db_name ...
mysqldump [options] --all-databases
shell> mysqldump world > world.sql
Question: What about --single-transaction ?
Backup with mysqldump ( cont. )
Bad news:
No write traffic to MySQL Cluster
○ SINGLE USER MODE
○ reduced availability
Backup with mysqldump ( cont. )
Check the content of the dump for:
● CREATE TABLE
● INSERT INTO
● CREATE LOGFILE
● CREATE TABLESPACE
Restore from mysqldump
Standard recovery procedure:
shell> mysql -e "DROP DATABASE world;"
shell> mysqladmin create world
shell> cat world.sql | mysql world
Restore from mysqldump ( cont. )
Point in time recovery?
● shell> mysqldump --master-data ...
● apply binlog : from which API node?
NDB and binlog
MySQL Cluster Overview ( reminder )
mysql client MySQL C APIPHP Connector/J
NDB API
NDB
Management
Clients
NDB
Management
Servers
mysqld mysqld mysqld
ndbd
ndbd ndbd
ndbd
MySQL Cluster and binlog
ndbd
ndbd ndbd
ndbd
mysqld
NDB Engine binlog
mysqld
NDB Engine binlog
mysqld
NDB Engine binlog
NDB binlog injector thread
When connecting to the data nodes,
NDBCluster storage engine subscribes to all
the tables in the Cluster.
When any data changes in the Cluster, the
NDB binlog injection thread gets notified of the
change, and writes to the local binlog.
binlog_format=ROW
Asynchronous Replication to
standard MySQL ( ex: InnoDB )
ndbd
ndbd ndbd
ndbd
mysqld
NDB Engine
binlog
mysqld
NDB Engine
binlog
mysqld
asynchronous
replication
Asynchronous Replication
to MySQL Cluster
ndbd
ndbd ndbd
ndbd
mysqld
NDB Engine
binlog
mysqld
NDB Engine
binlog
mysqld
asynchronous
replication
ndbd
ndbd ndbd
ndbd
ndbd
ndbd ndbd
ndbd
NDB Engine
Native Online
NDB Backups
Native Online NDB Backup
Hot backup
Consistent backup
Initialized by a cluster management node
NDB Backup Files
Three main components:
● Metadata : BACKUP-backup_id.node_id.ctl
● Table records : BACKUP-backup_id-0.node_id.data
different nodes save different fragments during the
backup
● Transactional log : BACKUP-backup_id-0.node_id.log
different nodes save different logs because they store
different fragments
Saved on all data nodes: each data node performs the
backup of its own fragment
START BACKUP
shell> ndb_mgm
ndb_mgm> START BACKUP
Waiting for completed, this may take several minutes
Node 1: Backup 4 started from node 12
Node 1: Backup 4 started from node 12 completed
StartGCP: 218537 StopGCP: 218575
#Records: 2717875 #LogRecords: 167
Data: 1698871988 bytes Log: 99056 bytes
START BACKUP (cont.)
Waiting for completed, this may take several minutes
Node Did: Backup Bid started from node Mid
Node Did: Backup Bid started from node Mid completed
StartGCP: 218537 StopGCP: 218575
#Records: 2717875 #LogRecords: 167
Data: 1698871988 bytes Log: 99056 bytes
Did : data node coordinating the backup
Bid : unique identifier for the current backup
Mid : management node that started the backup
Number of Global Checkpoints executed during backup
Number and size of records in backup
Number and size of records in log
START BACKUP (cont.)
START BACKUP options:
● NOWAIT
● WAIT STARTED
● WAIT COMPLETED ( default )
Backup Parameters
BackupDataBufferSize:
stores data before is written to disk
BackupLogBufferSize:
buffers log records before are written to disk
BackupMemory:
BackupDataBufferSize + BackupLogBufferSize
Backup Parameters (cont.)
BackupWriteSize:
default size of messages written to disk from
backup buffers ( data and log )
BackupMaxWriteSize:
maximum size of messages written to disk
CompressedBackup:
equivalent to gzip --fast
Restore from Online backup
ndb_restore: program that performs the restore
Procedure:
● import the metadata from just one node
● import the data from each node
ndb_restore
Important options:
-c string : specify the connect string
-m : restore metadata
-r : restore data
-b # : backup ID
-n # : node ID
-p # : restore in parallel
--no-binlog
ndb_restore (cont.)
--include-databases = db_lists
--exclude-databases = db_lists
--include-tables = table_lists
--exclude-tables = table_lists
--rewrite-database = olddb,newdb
... and more!
Q & A

Contenu connexe

Tendances

Zero Downtime Schema Changes - Galera Cluster - Best Practices
Zero Downtime Schema Changes - Galera Cluster - Best PracticesZero Downtime Schema Changes - Galera Cluster - Best Practices
Zero Downtime Schema Changes - Galera Cluster - Best PracticesSeveralnines
 
M|18 Creating a Reference Architecture for High Availability at Nokia
M|18 Creating a Reference Architecture for High Availability at NokiaM|18 Creating a Reference Architecture for High Availability at Nokia
M|18 Creating a Reference Architecture for High Availability at NokiaMariaDB plc
 
Master master vs master-slave database
Master master vs master-slave databaseMaster master vs master-slave database
Master master vs master-slave databaseWipro
 
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - SlidesSeveralnines
 
Run Cloud Native MySQL NDB Cluster in Kubernetes
Run Cloud Native MySQL NDB Cluster in KubernetesRun Cloud Native MySQL NDB Cluster in Kubernetes
Run Cloud Native MySQL NDB Cluster in KubernetesBernd Ocklin
 
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北Ivan Tu
 
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...ScyllaDB
 
Scylla on Kubernetes: Introducing the Scylla Operator
Scylla on Kubernetes: Introducing the Scylla OperatorScylla on Kubernetes: Introducing the Scylla Operator
Scylla on Kubernetes: Introducing the Scylla OperatorScyllaDB
 
NewSQL overview, Feb 2015
NewSQL overview, Feb 2015NewSQL overview, Feb 2015
NewSQL overview, Feb 2015Ivan Glushkov
 
Choosing between Codership's MySQL Galera, MariaDB Galera Cluster and Percona...
Choosing between Codership's MySQL Galera, MariaDB Galera Cluster and Percona...Choosing between Codership's MySQL Galera, MariaDB Galera Cluster and Percona...
Choosing between Codership's MySQL Galera, MariaDB Galera Cluster and Percona...Codership Oy - Creators of Galera Cluster
 
Scaling with sync_replication using Galera and EC2
Scaling with sync_replication using Galera and EC2Scaling with sync_replication using Galera and EC2
Scaling with sync_replication using Galera and EC2Marco Tusa
 
M|18 Why Abstract Away the Underlying Database Infrastructure
M|18 Why Abstract Away the Underlying Database InfrastructureM|18 Why Abstract Away the Underlying Database Infrastructure
M|18 Why Abstract Away the Underlying Database InfrastructureMariaDB plc
 
Percona XtraDB Cluster ( Ensure high Availability )
Percona XtraDB Cluster ( Ensure high Availability )Percona XtraDB Cluster ( Ensure high Availability )
Percona XtraDB Cluster ( Ensure high Availability )Mydbops
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability SolutionsLenz Grimmer
 
Scylla Summit 2016: Scylla at Samsung SDS
Scylla Summit 2016: Scylla at Samsung SDSScylla Summit 2016: Scylla at Samsung SDS
Scylla Summit 2016: Scylla at Samsung SDSScyllaDB
 
M|18 Writing Stored Procedures in the Real World
M|18 Writing Stored Procedures in the Real WorldM|18 Writing Stored Procedures in the Real World
M|18 Writing Stored Procedures in the Real WorldMariaDB plc
 
Migrating to XtraDB Cluster
Migrating to XtraDB ClusterMigrating to XtraDB Cluster
Migrating to XtraDB Clusterpercona2013
 

Tendances (20)

Zero Downtime Schema Changes - Galera Cluster - Best Practices
Zero Downtime Schema Changes - Galera Cluster - Best PracticesZero Downtime Schema Changes - Galera Cluster - Best Practices
Zero Downtime Schema Changes - Galera Cluster - Best Practices
 
M|18 Creating a Reference Architecture for High Availability at Nokia
M|18 Creating a Reference Architecture for High Availability at NokiaM|18 Creating a Reference Architecture for High Availability at Nokia
M|18 Creating a Reference Architecture for High Availability at Nokia
 
Master master vs master-slave database
Master master vs master-slave databaseMaster master vs master-slave database
Master master vs master-slave database
 
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides
9 DevOps Tips for Going in Production with Galera Cluster for MySQL - Slides
 
Run Cloud Native MySQL NDB Cluster in Kubernetes
Run Cloud Native MySQL NDB Cluster in KubernetesRun Cloud Native MySQL NDB Cluster in Kubernetes
Run Cloud Native MySQL NDB Cluster in Kubernetes
 
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北
3 周彦偉-隨需而變 我所經歷的my sql架構變遷﹣周彥偉﹣acmug@2015.12台北
 
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...
Scylla Summit 2016: Outbrain Case Study - Lowering Latency While Doing 20X IO...
 
Scylla on Kubernetes: Introducing the Scylla Operator
Scylla on Kubernetes: Introducing the Scylla OperatorScylla on Kubernetes: Introducing the Scylla Operator
Scylla on Kubernetes: Introducing the Scylla Operator
 
NewSQL overview, Feb 2015
NewSQL overview, Feb 2015NewSQL overview, Feb 2015
NewSQL overview, Feb 2015
 
Choosing between Codership's MySQL Galera, MariaDB Galera Cluster and Percona...
Choosing between Codership's MySQL Galera, MariaDB Galera Cluster and Percona...Choosing between Codership's MySQL Galera, MariaDB Galera Cluster and Percona...
Choosing between Codership's MySQL Galera, MariaDB Galera Cluster and Percona...
 
Scaling with sync_replication using Galera and EC2
Scaling with sync_replication using Galera and EC2Scaling with sync_replication using Galera and EC2
Scaling with sync_replication using Galera and EC2
 
M|18 Why Abstract Away the Underlying Database Infrastructure
M|18 Why Abstract Away the Underlying Database InfrastructureM|18 Why Abstract Away the Underlying Database Infrastructure
M|18 Why Abstract Away the Underlying Database Infrastructure
 
Percona XtraDB Cluster ( Ensure high Availability )
Percona XtraDB Cluster ( Ensure high Availability )Percona XtraDB Cluster ( Ensure high Availability )
Percona XtraDB Cluster ( Ensure high Availability )
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
 
MySQL highav Availability
MySQL highav AvailabilityMySQL highav Availability
MySQL highav Availability
 
Taking Full Advantage of Galera Multi Master Cluster
Taking Full Advantage of Galera Multi Master ClusterTaking Full Advantage of Galera Multi Master Cluster
Taking Full Advantage of Galera Multi Master Cluster
 
BigData Developers MeetUp
BigData Developers MeetUpBigData Developers MeetUp
BigData Developers MeetUp
 
Scylla Summit 2016: Scylla at Samsung SDS
Scylla Summit 2016: Scylla at Samsung SDSScylla Summit 2016: Scylla at Samsung SDS
Scylla Summit 2016: Scylla at Samsung SDS
 
M|18 Writing Stored Procedures in the Real World
M|18 Writing Stored Procedures in the Real WorldM|18 Writing Stored Procedures in the Real World
M|18 Writing Stored Procedures in the Real World
 
Migrating to XtraDB Cluster
Migrating to XtraDB ClusterMigrating to XtraDB Cluster
Migrating to XtraDB Cluster
 

En vedette

MySQL Cluster performance best practices
MySQL Cluster performance best practicesMySQL Cluster performance best practices
MySQL Cluster performance best practicesMat Keep
 
Boost performance with MySQL 5.1 partitions
Boost performance with MySQL 5.1 partitionsBoost performance with MySQL 5.1 partitions
Boost performance with MySQL 5.1 partitionsGiuseppe Maxia
 
Introduction to MySQL Cluster
Introduction to MySQL ClusterIntroduction to MySQL Cluster
Introduction to MySQL ClusterAbel Flórez
 
MySQL DW Breakfast
MySQL DW BreakfastMySQL DW Breakfast
MySQL DW BreakfastIvan Zoratti
 
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 QueriesBernd Ocklin
 
The thinking persons guide to data warehouse design
The thinking persons guide to data warehouse designThe thinking persons guide to data warehouse design
The thinking persons guide to data warehouse designCalpont
 
Yahoo: Experiences with MySQL GTID and Multi Threaded Replication
Yahoo: Experiences with MySQL GTID and Multi Threaded ReplicationYahoo: Experiences with MySQL GTID and Multi Threaded Replication
Yahoo: Experiences with MySQL GTID and Multi Threaded ReplicationYashada Jadhav
 
Mysql cluster introduction
Mysql cluster introductionMysql cluster introduction
Mysql cluster introductionAndrew Morgan
 
Proxysql use case scenarios plam 2016
Proxysql use case scenarios    plam 2016Proxysql use case scenarios    plam 2016
Proxysql use case scenarios plam 2016Alkin Tezuysal
 
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL ClusterMySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL ClusterPar-Tec S.p.A.
 
MySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and ScalabilityMySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and ScalabilityShivji Kumar Jha
 
Conference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance TuningConference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance TuningSeveralnines
 
FOSSASIA 2015: MySQL Group Replication
FOSSASIA 2015: MySQL Group ReplicationFOSSASIA 2015: MySQL Group Replication
FOSSASIA 2015: MySQL Group ReplicationShivji Kumar Jha
 
MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMario Beck
 
FOSDEM 2015 - NoSQL and SQL the best of both worlds
FOSDEM 2015 - NoSQL and SQL the best of both worldsFOSDEM 2015 - NoSQL and SQL the best of both worlds
FOSDEM 2015 - NoSQL and SQL the best of both worldsAndrew Morgan
 
MySQL User Camp: MySQL Cluster
MySQL User Camp: MySQL ClusterMySQL User Camp: MySQL Cluster
MySQL User Camp: MySQL ClusterShivji Kumar Jha
 

En vedette (20)

MySQL Cluster Basics
MySQL Cluster BasicsMySQL Cluster Basics
MySQL Cluster Basics
 
MySQL Cluster performance best practices
MySQL Cluster performance best practicesMySQL Cluster performance best practices
MySQL Cluster performance best practices
 
Boost performance with MySQL 5.1 partitions
Boost performance with MySQL 5.1 partitionsBoost performance with MySQL 5.1 partitions
Boost performance with MySQL 5.1 partitions
 
Mysql cluster
Mysql clusterMysql cluster
Mysql cluster
 
Introduction to MySQL Cluster
Introduction to MySQL ClusterIntroduction to MySQL Cluster
Introduction to MySQL Cluster
 
MySQL DW Breakfast
MySQL DW BreakfastMySQL DW Breakfast
MySQL DW Breakfast
 
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
 
The thinking persons guide to data warehouse design
The thinking persons guide to data warehouse designThe thinking persons guide to data warehouse design
The thinking persons guide to data warehouse design
 
Yahoo: Experiences with MySQL GTID and Multi Threaded Replication
Yahoo: Experiences with MySQL GTID and Multi Threaded ReplicationYahoo: Experiences with MySQL GTID and Multi Threaded Replication
Yahoo: Experiences with MySQL GTID and Multi Threaded Replication
 
Mysql cluster introduction
Mysql cluster introductionMysql cluster introduction
Mysql cluster introduction
 
Proxysql use case scenarios plam 2016
Proxysql use case scenarios    plam 2016Proxysql use case scenarios    plam 2016
Proxysql use case scenarios plam 2016
 
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL ClusterMySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
MySQL Tech Tour 2015 - Progettare, installare e configurare MySQL Cluster
 
MySQL user camp march 11th 2016
MySQL user camp march 11th 2016MySQL user camp march 11th 2016
MySQL user camp march 11th 2016
 
MySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and ScalabilityMySQL Developer Day conference: MySQL Replication and Scalability
MySQL Developer Day conference: MySQL Replication and Scalability
 
Conference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance TuningConference slides: MySQL Cluster Performance Tuning
Conference slides: MySQL Cluster Performance Tuning
 
FOSSASIA 2015: MySQL Group Replication
FOSSASIA 2015: MySQL Group ReplicationFOSSASIA 2015: MySQL Group Replication
FOSSASIA 2015: MySQL Group Replication
 
MySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB ClusterMySQL InnoDB Cluster and NDB Cluster
MySQL InnoDB Cluster and NDB Cluster
 
FOSDEM 2015 - NoSQL and SQL the best of both worlds
FOSDEM 2015 - NoSQL and SQL the best of both worldsFOSDEM 2015 - NoSQL and SQL the best of both worlds
FOSDEM 2015 - NoSQL and SQL the best of both worlds
 
MySQL User Camp: MySQL Cluster
MySQL User Camp: MySQL ClusterMySQL User Camp: MySQL Cluster
MySQL User Camp: MySQL Cluster
 
MySQL User Camp: GTIDs
MySQL User Camp: GTIDsMySQL User Camp: GTIDs
MySQL User Camp: GTIDs
 

Similaire à Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability

A Brief Introduction of TiDB (Percona Live)
A Brief Introduction of TiDB (Percona Live)A Brief Introduction of TiDB (Percona Live)
A Brief Introduction of TiDB (Percona Live)PingCAP
 
Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication Mydbops
 
An Introduction to Apache Cassandra
An Introduction to Apache CassandraAn Introduction to Apache Cassandra
An Introduction to Apache CassandraSaeid Zebardast
 
M|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsM|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsMariaDB plc
 
Buytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerBuytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerkuchinskaya
 
MariaDB MaxScale: an Intelligent Database Proxy
MariaDB MaxScale: an Intelligent Database ProxyMariaDB MaxScale: an Intelligent Database Proxy
MariaDB MaxScale: an Intelligent Database ProxyMarkus Mäkelä
 
Shared Database Concurrency
Shared Database ConcurrencyShared Database Concurrency
Shared Database ConcurrencyAivars Kalvans
 
MySQL Cluster Performance Tuning - 2013 MySQL User Conference
MySQL Cluster Performance Tuning - 2013 MySQL User ConferenceMySQL Cluster Performance Tuning - 2013 MySQL User Conference
MySQL Cluster Performance Tuning - 2013 MySQL User ConferenceSeveralnines
 
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022StreamNative
 
Presentations from the Cloudera Impala meetup on Aug 20 2013
Presentations from the Cloudera Impala meetup on Aug 20 2013Presentations from the Cloudera Impala meetup on Aug 20 2013
Presentations from the Cloudera Impala meetup on Aug 20 2013Cloudera, Inc.
 
My SQL Portal Database (Cluster)
My SQL Portal Database (Cluster)My SQL Portal Database (Cluster)
My SQL Portal Database (Cluster)Nicholas Adu Gyamfi
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability SolutionsLenz Grimmer
 
Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02Louis liu
 
Logs @ OVHcloud
Logs @ OVHcloudLogs @ OVHcloud
Logs @ OVHcloudOVHcloud
 

Similaire à Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability (20)

Percona FT / TokuDB
Percona FT / TokuDBPercona FT / TokuDB
Percona FT / TokuDB
 
MySQL HA
MySQL HAMySQL HA
MySQL HA
 
A Brief Introduction of TiDB (Percona Live)
A Brief Introduction of TiDB (Percona Live)A Brief Introduction of TiDB (Percona Live)
A Brief Introduction of TiDB (Percona Live)
 
Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication Evolution of MySQL Parallel Replication
Evolution of MySQL Parallel Replication
 
An Introduction to Apache Cassandra
An Introduction to Apache CassandraAn Introduction to Apache Cassandra
An Introduction to Apache Cassandra
 
M|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change MethodsM|18 Battle of the Online Schema Change Methods
M|18 Battle of the Online Schema Change Methods
 
MYSQL
MYSQLMYSQL
MYSQL
 
Buytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemakerBuytaert kris my_sql-pacemaker
Buytaert kris my_sql-pacemaker
 
MariaDB MaxScale: an Intelligent Database Proxy
MariaDB MaxScale: an Intelligent Database ProxyMariaDB MaxScale: an Intelligent Database Proxy
MariaDB MaxScale: an Intelligent Database Proxy
 
NoSQL with MySQL
NoSQL with MySQLNoSQL with MySQL
NoSQL with MySQL
 
Shared Database Concurrency
Shared Database ConcurrencyShared Database Concurrency
Shared Database Concurrency
 
MySQL Cluster Performance Tuning - 2013 MySQL User Conference
MySQL Cluster Performance Tuning - 2013 MySQL User ConferenceMySQL Cluster Performance Tuning - 2013 MySQL User Conference
MySQL Cluster Performance Tuning - 2013 MySQL User Conference
 
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
Towards a ZooKeeper-less Pulsar, etcd, etcd, etcd. - Pulsar Summit SF 2022
 
Presentations from the Cloudera Impala meetup on Aug 20 2013
Presentations from the Cloudera Impala meetup on Aug 20 2013Presentations from the Cloudera Impala meetup on Aug 20 2013
Presentations from the Cloudera Impala meetup on Aug 20 2013
 
My SQL Portal Database (Cluster)
My SQL Portal Database (Cluster)My SQL Portal Database (Cluster)
My SQL Portal Database (Cluster)
 
Data race
Data raceData race
Data race
 
Linux Internals - Part II
Linux Internals - Part IILinux Internals - Part II
Linux Internals - Part II
 
MySQL High Availability Solutions
MySQL High Availability SolutionsMySQL High Availability Solutions
MySQL High Availability Solutions
 
Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02Mysqlhacodebits20091203 1260184765-phpapp02
Mysqlhacodebits20091203 1260184765-phpapp02
 
Logs @ OVHcloud
Logs @ OVHcloudLogs @ OVHcloud
Logs @ OVHcloud
 

Plus de Pythian

DB Engineering - From Antiquated to Engineer
DB Engineering - From Antiquated to EngineerDB Engineering - From Antiquated to Engineer
DB Engineering - From Antiquated to EngineerPythian
 
TechTalk v2.0 - Performance tuning Cassandra + AWS
TechTalk v2.0 - Performance tuning Cassandra + AWSTechTalk v2.0 - Performance tuning Cassandra + AWS
TechTalk v2.0 - Performance tuning Cassandra + AWSPythian
 
Percona Live 2014 - Scaling MySQL in AWS
Percona Live 2014 - Scaling MySQL in AWSPercona Live 2014 - Scaling MySQL in AWS
Percona Live 2014 - Scaling MySQL in AWSPythian
 
MySQL administration in Amazon RDS
MySQL administration in Amazon RDSMySQL administration in Amazon RDS
MySQL administration in Amazon RDSPythian
 
Maximizing SQL Reviews and Tuning with pt-query-digest
Maximizing SQL Reviews and Tuning with pt-query-digestMaximizing SQL Reviews and Tuning with pt-query-digest
Maximizing SQL Reviews and Tuning with pt-query-digestPythian
 
Online Schema Changes for Maximizing Uptime
 Online Schema Changes for Maximizing Uptime Online Schema Changes for Maximizing Uptime
Online Schema Changes for Maximizing UptimePythian
 
MYSQL Patterns in Amazon - Make the Cloud Work For You
MYSQL Patterns in Amazon - Make the Cloud Work For YouMYSQL Patterns in Amazon - Make the Cloud Work For You
MYSQL Patterns in Amazon - Make the Cloud Work For YouPythian
 
MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to SphinxMYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to SphinxPythian
 
Pdb my sql backup london percona live 2012
Pdb my sql backup   london percona live 2012Pdb my sql backup   london percona live 2012
Pdb my sql backup london percona live 2012Pythian
 

Plus de Pythian (9)

DB Engineering - From Antiquated to Engineer
DB Engineering - From Antiquated to EngineerDB Engineering - From Antiquated to Engineer
DB Engineering - From Antiquated to Engineer
 
TechTalk v2.0 - Performance tuning Cassandra + AWS
TechTalk v2.0 - Performance tuning Cassandra + AWSTechTalk v2.0 - Performance tuning Cassandra + AWS
TechTalk v2.0 - Performance tuning Cassandra + AWS
 
Percona Live 2014 - Scaling MySQL in AWS
Percona Live 2014 - Scaling MySQL in AWSPercona Live 2014 - Scaling MySQL in AWS
Percona Live 2014 - Scaling MySQL in AWS
 
MySQL administration in Amazon RDS
MySQL administration in Amazon RDSMySQL administration in Amazon RDS
MySQL administration in Amazon RDS
 
Maximizing SQL Reviews and Tuning with pt-query-digest
Maximizing SQL Reviews and Tuning with pt-query-digestMaximizing SQL Reviews and Tuning with pt-query-digest
Maximizing SQL Reviews and Tuning with pt-query-digest
 
Online Schema Changes for Maximizing Uptime
 Online Schema Changes for Maximizing Uptime Online Schema Changes for Maximizing Uptime
Online Schema Changes for Maximizing Uptime
 
MYSQL Patterns in Amazon - Make the Cloud Work For You
MYSQL Patterns in Amazon - Make the Cloud Work For YouMYSQL Patterns in Amazon - Make the Cloud Work For You
MYSQL Patterns in Amazon - Make the Cloud Work For You
 
MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to SphinxMYSQL Query Anti-Patterns That Can Be Moved to Sphinx
MYSQL Query Anti-Patterns That Can Be Moved to Sphinx
 
Pdb my sql backup london percona live 2012
Pdb my sql backup   london percona live 2012Pdb my sql backup   london percona live 2012
Pdb my sql backup london percona live 2012
 

Dernier

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard37
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)Samir Dash
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 
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 WorkerThousandEyes
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 

Dernier (20)

Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
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
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability

  • 1. René Cannaò Senior DBA PalominoDB rene@palominodb.com @rene_cannao MySQL Cluster (NDB) Tutorial
  • 2. Agenda Introduction - Presentation MySQL Cluster Overview MySQL Cluster Components Partitioning Internal Blocks General Configuration Transactions Checkpoints on disk Handling failure Disk data Start Types and Start Phases Storage Requirements Backups NDB and binlog Native NDB Online Backups
  • 3. About myself My name is René Cannaò Working as DBA since 2005 Starting my experience with NDB in 2007 In 2008 I joined the MySQL Support Engineer Team at Sun/Oracle Working as Senior DBA for PalominoDB We have a booth: please come and visit us!
  • 4. Questions If you have questions stop me at any time! If the answer is short will be answered immediately. If the answer it long, we can discuss at the end of the tutorial
  • 5. What this course is Not This course doesn't cover advanced topics like: Advanced Setup Performance Tuning Configuration of multi-threads Online add nodes NDBAPI noSQL access Geographic Replication BLOB/TEXT fields
  • 7. MySQL Cluster Overview High Availability Storage Engine for MySQL Provides: ● High Availability ● Clustering ● Horizontal Scalability ● Shared Nothing Architecture ● SQL and noSQL access
  • 8. High Availability and Clustering High Availability: ● survives routine failures or maintenance ○ hardware or network failure, software upgrade, etc ● provides continuous services ● no interruption of services Clustering: ● parallel processing ● increase availability
  • 9. Scalability Ability to handle increased number of requests Vertical: ● replace HW with more powerful one Horizontal: ● add component to the system
  • 10. Shared Nothing Architecture Characterized by: ● No single point of failure ● Redundancy ● Automatic Failover
  • 11. MySQL Cluster Summary Shared Nothing Architecture No Single Point Of Failure (SPOF) Synchronous replication between nodes Automatic failover with no data loss ACID transaction Durability with NumberOfReplica > 1 READ COMMITTED transaction isolation level Row level locking
  • 13. Components Overview mysql client MySQL C APIPHP Connector/J NDB API NDB Management Clients NDB Management Servers mysqld mysqld mysqld ndbd ndbd ndbd ndbd
  • 14. Cluster Nodes 3 Node Types are present in a MySQL Cluster: ● Management Node ● Data Node ● Access Node
  • 15. Management Node ndb_mgmd process Administrative tasks: ● configure the Cluster ● start / stop other nodes ● run backup ● monitoring ● coordinator
  • 16. Data Node ndbd process ( or ndbmtd ) Stores cluster data ● mainly in memory ● also on disk ( limitations apply ) Coordinate transactions
  • 17. Data Node ( ndbmtd ) What is ndbmtd ? Multi-threaded equivalent of ndbd File system compatible with ndbd By default run in single thread mode Configured via MaxNoOfExecutionThreads of ThreadConfig
  • 18. API Node Process able to access data stored in Data Nodes: ● mysqld process with NDBCLUSTER support ● application that connects to the cluster through NDB API (without mysqld)
  • 22. Partitions example (1/2) 5681 Alfred 30 2010-11-10 8675 Lisa 34 1971-01-12 5645 Mark 21 1982-01-02 0965 Josh 36 2009-06-33 5843 Allan 22 2007-04-12 1297 Albert 40 2000-12-20 1875 Anne 34 1984-11-22 9346 Mary 22 1983-08-05 8234 Isaac 20 1977-07-06 8839 Leonardo 28 1999-11-08 7760 Donna 37 1997-03-04 3301 Ted 33 2005-05-23 Table
  • 23. Partitions example (2/2) 5681 Alfred 30 2010-11-10 8675 Lisa 34 1971-01-12 5645 Mark 21 1982-01-02 0965 Josh 36 2009-06-33 5843 Allan 22 2007-04-12 1297 Albert 40 2000-12-20 1875 Anne 34 1984-11-22 9346 Mary 22 1983-08-05 8234 Isaac 20 1977-07-06 8839 Leonardo 28 1999-11-08 7760 Donna 37 1997-03-04 3301 Ted 33 2005-05-23 P1 P2 P3 P4 Table
  • 24. Partitioning in MySQL Cluster MySQL Cluster natively supports Partitioning Distribute portions of individual tables in different locations PARTITION BY (LINEAR) KEY is the only partitioning type supported
  • 25. Partitions, Node Groups & Replicas Partition: portion of the data stored in the cluster Node Groups: set of data nodes that stores a set of partitions Replicas: copies of a cluster partition
  • 26. Partitions in NDB P2P1 P3 P4 NDB1 NDB2 NDB3 NDB4
  • 28. Node Groups P2P P1S P1P P2S P3P P4S P4P P3S NDB1 NDB2 NDB3 NDB4 Node Group 0 Node Group 1
  • 29. Node Groups P2P P1S P1P P2S P3P P4S P4P P3S NDB1 NDB2 NDB3 NDB4 Node Group 0 Node Group 1
  • 30. Node Groups P2P P1S P1P P2S P3P P4S P4P P3S NDB1 NDB2 NDB3 NDB4 Node Group 0 Node Group 1
  • 32. Blocks in Data Node (1/2) A data node is internally structured in several blocks/code with different functions: ● Transaction Coordinator (TC) : ○ coordinates transactions ○ starts Two Phase Commit ○ distributes requests to LQH ● Local Query Handler (LQH) ○ allocates local operation records ○ manages the Redo Log
  • 33. Blocks in Data Node (2/2) ● ACC ○ stores hash indexes ○ manages records locking ● TUP ○ stores row data ● TUX ○ stores ordered indexes ● BACKUP , CMVMI , DICT , DIH , SUMA , etc Ref: http://dev.mysql.com/doc/ndbapi/en/ndb-internals-ndb-protocol.html
  • 34. Blocks on ndbd (simplified)
  • 35. Blocks on ndbmtd (simplified)
  • 36. Where is data stored? In memory! TUP TUX LQH TC ACC IndexMemory primary keys unique keys DataMemory data rows ordered indexes
  • 38. Global parameters NoOfReplicas (mandatory) Defines the number of replicas for each partition/table DataDir: Location for log/trace files and pid file FileSystemPath: location for of all files related to MySQL Cluster
  • 39. Global boolean parameters LockPagesInMainMemory (0) : Lock all memory in RAM ( no swap ) StopOnError (1) : Automatic restart of data node in case of failure
  • 40. IndexMemory and DataMemory IndexMemory: defines the amount of memory for hashes indexes ( PK and UNIQUE ) DataMemory: defines the amount of memory for: data ordered indexes UNDO information
  • 43. Transactions Overview Two Phase Commit ACID ● Durability with multiple copies ● Committed on memory READ_COMMITTED
  • 44. Transaction implementation ● The API node contacts a TC in one of the Data Node (round-robin fashion, or Distribution Awareness) ● The TC starts the transaction and the Two Phase Commit (2PC) protocol ● The TC contacts the LQH of the Data Nodes involved in the transaction ● LQH handles row level locking: ○ Exclusive lock ○ Shared lock ○ No lock
  • 45. Two Phase Commit (1/2) Phase 1 , Prepare : Node groups get their information updated Phase 2 , Commit : the change is committed
  • 47. Rows operations Primary key operation ( read and write ) Unique index operation ( read ) Ordered index scans ( read only ) Full-table scans (read only)
  • 48. Primary Key Write (1/4) ● API node connects to TC ● TC connects to LQH of the data node with the primary fragment ● LQH queries ACC to get the row id ● LQH performs the operation on TUP ● LQH connects to the LQH of the data node with the secondary fragment ● LQH on secondary performs the same operation ● LQH on secondary informs TC that the prepare phase is completed ● TC starts the commit phase
  • 52. Primary Key Read Without distribution awareness
  • 53. Primary Key Read With distribution awareness
  • 54. Unique Index Read (1/2) Unique Index is internally implemented as a hidden table with two columns where the PK is the Unique Key itself and the second column is the PK of the main table. To read a Unique index: ● A PK read is performed on hidden table to get the value of the PK of main table ● A PK read is performed on main table
  • 58. Transaction Parameters (1/3) MaxNoOfConcurrentTransactions: number of simultaneous transactions that can run in a node (maximum number of tables accessed in any single transaction + 1) * number of cluster SQL nodes
  • 59. Transaction Parameters (2/3) MaxNoOfConcurrentOperations: Total number of records that at any time can be updated or locked in data node, and UNDO. Beside the data node, TC needs information about all the records involved in a transaction MaxNoOfLocalOperations: for not too large transactions, it defaults to MaxNoOfConcurrentOperationsx1.1
  • 60. Transaction Parameters (3/3) MaxDMLOperationsPerTransaction Limits the number of DML operations Count is in # of records, not # of statements TransactionInactiveTimeout Idle transactions are rolled back TransactionDeadlockDetectionTimeout Time based deadlock and lock wait detection Also possible that the data node is dead or overloaded
  • 62. Checkpoints MySQL Cluster is a in-memory storage engine: ● data is only in memory? WRONG! ● data is regularly saved on disk When a data node writes on disk is performing a checkpoint Exception: MySQL Cluster can also run in DiskLess mode, with "reduced durability" and unable to run Native NDB Backup
  • 63. Checkpoint types Local Checkpoint (LCP): ● specific to a single node; ● all data in memory is saved to disk ● can take minutes or hours Global Checkpoint (GCP): ● transactions across nodes are synchronized ● redo log flushed on disk
  • 64. Memory and disk checkpoints Coordinator DataMemory IndexMemory RedoBuffer LCP0 LCP1 LCP0 DataMemory IndexMemory RedoBuffer LCP1 RedoLog Files RedoLog Files LCP LCP GCP GCP
  • 65. Undo and Redo Parameters UndoIndexBuffer and UndoDataBuffer Buffers used during local checkpoint to perform consistent snapshot without blocking writes. RedoBuffer In memory buffer for REDO log (on disk)
  • 66. Checkpointing parameters TimeBetweenLocalCheckpoints Doesn't define a time interval, but the amount of writes operations ( as a base-2 logarithm of 4-byte words) . Examples: 20 ( default ) means 4 x 220 = 4MB 24 means 4 x 224 = 64MB TimeBetweenGlobalCheckpoints Defines how often commits are flushed to REDO logs
  • 67. Fragment Log Files NoOfFragmentLogFiles ( default 16 ) FragmentLogFileSize ( default 16 MB ) REDO logs are organized in a ring, where head and tail never meet. If checkpointing is slow, updating transactions are aborted. Total REDO logs size is defined as: NoOfFragmentLogFiles set of 4 FragmentLogFileSize Default : 16 x 4 x 16MB = 1024MB InitFragmentLogFiles : SPARSE or FULL
  • 68. Checkpoint write control ODirect: (off) O_DIRECT for LCP and GCP CompressedLCP: (off) equivalent of gzip --fast DiskCheckpointSpeed: speed of local checkpoints to disk ( default 10MB/s ) DiskCheckpointSpeedInRestart : during restart
  • 69. Diskless mode Diskless : It is possible to configure the whole Cluster to run without using the disk. When Diskless is enabled ( disabled by default ): ● LCP and GCP are not performed; ● NDB Native Backup is not possible; ● a complete cluster failure ( or shutdown ) = data lost
  • 71. Data node failure (1/2) Failures happen! HW failure, network issue, OS crash, SW bug, … MySQL Cluster is constantly monitoring itself Each data node periodically checks other data nodes via heartbeat Each data node periodically checks API nodes via heartbeat
  • 72. Data node failure (2/2) If a node fails to respond to heartbeats, the data node that detects the failure communicates it to other data nodes The data nodes stop using the failed node and switch to the secondary node for the same fragment
  • 73. Timeouts Parameters TimeBetweenWatchDogCheck The watchdog thread checks if the main thread got stuck HeartbeatIntervalDbDb Heartbeat interval between data nodes HeartbeatIntervalDbApi Heartbeat interval between data nodes and API nodes
  • 75. Available since MySQL 5.1.6 Store non-indexed columns on disk Doesn't support variable sized storage On disk : tablespaces and undo logs In memory : page buffer ( cache ) Disk Data
  • 76. Objects: ● Undo log files: store information to rollback transactions ● Undo log group: a collection of undo log files ● Data files: store MySQL Cluster Disk Data table data ● Tablespace : a named collection of data files Notes: ● Each tablespace needs an undo log group assigned ● currently, only one undo log group can exist in the same MySQL Cluster Disk Data Objects
  • 77. Disk Data - data flow Disk Page Buffer Tablespace 1 Tablespace 2 Undo Log Group ThreadIOPool Metadata Shared Memory Undo Buffer Pages Requests Queues
  • 78. Disk Data Configuration Parameters DiskPageBufferMemory : cache for disk pages SharedGlobalMemory : shared memory for ● DataDisk UNDO buffer ● DiskData metadata ( tablespace / undo / files ) ● Buffers for disk operations DiskIOThreadPool : number of threads for I/O
  • 79. Using SQL statement: CREATE LOGFILE GROUP logfile_group ADD UNDOFILE 'undo_file' [INITIAL_SIZE [=] initial_size] [UNDO_BUFFER_SIZE [=] undo_buffer_size] ENGINE [=] engine_name Create Undo Log Group
  • 80. UNDOFILE : filename on disk INITIAL_SIZE : 128MB by default UNDO_BUFFER_SIZE : 8MB by default ENGINE : { NDB | NDBCLUSTER } Create Undo Log Group
  • 81. ALTER LOGFILE GROUP logfile_group ADD UNDOFILE 'undo_file' [INITIAL_SIZE [=] initial_size] ENGINE [=] engine_name Alter Undo Log Group
  • 82. CREATE LOGFILE GROUP lg1 ADD UNDOFILE 'undo1.log' INITIAL_SIZE = 134217728 UNDO_BUFFER_SIZE = 8388608 ENGINE = NDBCLUSTER ALTER LOGFILE GROUP lg1 ADD UNDOFILE 'undo2.log' INITIAL_SIZE = 134217728 ENGINE = NDBCLUSTER Create Undo Log Group : example
  • 83. In [NDBD] definition: InitialLogFileGroup = [name=name;] [undo_buffer_size=size;] file-specification-list Example: InitialLogFileGroup = name=lg1; undo_buffer_size=8M; undo1.log:128M;undo2.log:128M Create Undo Log Group
  • 84. Using SQL statement: CREATE TABLESPACE tablespace_name ADD DATAFILE 'file_name' USE LOGFILE GROUP logfile_group [INITIAL_SIZE [=] initial_size] ENGINE [=] engine_name Create Tablespace
  • 85. logfile_group : mandatory! The log file group must be specified DATAFILE : filename on disk INITIAL_SIZE : 128MB by default ENGINE : { NDB | NDBCLUSTER } Create Tablespace
  • 86. Using SQL statement: ALTER TABLESPACE tablespace_name {ADD|DROP} DATAFILE 'file_name' [INITIAL_SIZE [=] size] ENGINE [=] engine_name Alter Tablespace
  • 87. CREATE TABLESPACE ts1 ADD DATAFILE 'datafile1.data' USE LOGFILE GROUP lg1 INITIAL_SIZE = 67108864 ENGINE = NDBCLUSTER; ALTER TABLESPACE ts1 ADD DATAFILE 'datafile2.data' INITIAL_SIZE = 134217728 ENGINE = NDBCLUSTER; Create Tablespace : example
  • 88. In [NDBD] definition: InitialTablespace = [name=name;] [extent_size=size;] file-specification-list Example: InitialTablespace = name=ts1; datafile1.data:64M; datafile2.data:128M Note: no need to specify the Undo Log Group Create Tablespace
  • 90. Start Types ● (IS) Initial start ● (S) System restart ● (N) Node restart ● (IN) Initial node restart
  • 91. Initial start (IS) All the data nodes start with clean filesystem. During the very first start, or when all data nodes are started with --initial Note: Disk Data files are not removed from the filesystem when data node is started with -- initial
  • 92. System restart (S) The whole Cluster is restarted after it has been shutdown . The Cluster resumes operations from where it was left before shutdown. No data is lost.
  • 93. Node restart (N) The Node is restarted while the Cluster is running. This is necessary during upgrade/downgrade, changing configuration, performing HW/SW maintenance, etc
  • 94. Initial node restart (IN) Similar to node restart (the Cluster is running) , but the data node is started with a clean filesystem. Use --initial to clean the filesystem . Note: --initial doesn't delete DiskData files
  • 95. Start Phases ( 1/4 ) Phase -1 : setup and initialization Phase 0 : filesystem initialization Phase 1 : communication inter-blocks and between nodes is initialized Phase 2 : status of all nodes is checked Phase 3 : DBLQH and DBTC setup communication between them
  • 96. Start Phases ( 2/4 ) Phase 4: ● IS or IN : Redo Log Files are created ● S : reads schemas, reads data from last Local Checkpoint, reads and apply all the Global Checkpoints from Redo Log ● N : find the tail of the Redo Log
  • 97. Start Phases ( 3/4 ) Phase 5 : for IS or S, a LCP is performed, followed by GCP Phase 6 : node groups are created Phase 7 : arbitrator is selected, data nodes are marked as Started, and API/SQL nodes can connect Phase 8 : for S , all indexes are rebuilt Phase 9 : internal variables are reset
  • 98. Start Phases ( 4/4 ) Phase 100 : ( obsolete ) Phase 101 : ● data node takes responsibility for delivery its primary data to subscribers ● for IS or S : transaction handlers is enabled ● for N or IN : new node can act as TC
  • 100. In general, storage requirements for MySQL Cluster is the same as storage requirements for other storage engines. But a lot of extra factors need to be considered when calculating storage requirements for MySQL Cluster tables. Storage requirements
  • 101. Each individual column is 4-byte aligned. CREATE TABLE ndb1 ( id INT NOT NULL PRIMARY KEY, type_id TINYINT, status TINYINT, name BINARY(14), KEY idx_status ( status ), KEY idx_name ( name ) ) ENGINE = ndbcluster; Bytes used per row: 4+4+4+16 = 28 ( storage ) 4-byte alignment
  • 102. If table definition allows NULL for some columns, MySQL Cluster reserves 4 bytes for 32 nullable columns ( or 8 bytes for 64 columns) CREATE TABLE ndb1 ( id INT NOT NULL PRIMARY KEY, type_id TINYINT, status TINYINT, name BINARY(14), KEY idx_status ( status ), KEY idx_name ( name ) ) ENGINE = ndbcluster; Bytes used per row: 4 ( NULL ) + 28 ( storage ) NULL values
  • 103. Each record has a 16 bytes overhead Each ordered index has a 10 bytes overhead per record Each page is 32KB , and each record must be stored in just one page Each page has a 128 byte page overhead DataMemory overhead
  • 104. Each primary/unique key requires 25 bytes for the hash index plus the size of the field 8 more bytes are required if the size of the field is larger than 32 bytes IndexMemory overhead
  • 105. Storage requirement for test table CREATE TABLE ndb1 ( id INT NOT NULL PRIMARY KEY, type_id TINYINT, status TINYINT, name BINARY(14), KEY idx_status ( status ), KEY idx_name ( name ) ) ENGINE = ndbcluster; Memory used per row = ~107 bytes ● 4 bytes for NULL values ● 28 bytes for storage ● 16 bytes for record overhead ● 30 bytes for ordered indexes (3) ● 29 bytes for primary key index ( 25 bytes + 4 bytes ) plus all the wasted memory in page overhead/alignment
  • 106. Hidden Primary Key In MySQL Cluster every table requires a primary key. A hidden primary key is create if PK is not explicitly defined The hidden PK uses 31-35 bytes per record
  • 108. Why backup? ● Isn't MySQL Cluster fully redundant? ● Human mistakes ● Application bugs ● Point in time recovery ● Deploy of development/testing envs ● Deploy a DR site ● ... others
  • 110. Backup with mysqldump storage engine agnostic dumps other objects like triggers, view, SP connects to any API node
  • 111. Backup with mysqldump ( cont. ) Usage: mysqldump [options] db_name [tbl_name ...] mysqldump [options] --databases db_name ... mysqldump [options] --all-databases shell> mysqldump world > world.sql Question: What about --single-transaction ?
  • 112. Backup with mysqldump ( cont. ) Bad news: No write traffic to MySQL Cluster ○ SINGLE USER MODE ○ reduced availability
  • 113. Backup with mysqldump ( cont. ) Check the content of the dump for: ● CREATE TABLE ● INSERT INTO ● CREATE LOGFILE ● CREATE TABLESPACE
  • 114. Restore from mysqldump Standard recovery procedure: shell> mysql -e "DROP DATABASE world;" shell> mysqladmin create world shell> cat world.sql | mysql world
  • 115. Restore from mysqldump ( cont. ) Point in time recovery? ● shell> mysqldump --master-data ... ● apply binlog : from which API node?
  • 117. MySQL Cluster Overview ( reminder ) mysql client MySQL C APIPHP Connector/J NDB API NDB Management Clients NDB Management Servers mysqld mysqld mysqld ndbd ndbd ndbd ndbd
  • 118. MySQL Cluster and binlog ndbd ndbd ndbd ndbd mysqld NDB Engine binlog mysqld NDB Engine binlog mysqld NDB Engine binlog
  • 119. NDB binlog injector thread When connecting to the data nodes, NDBCluster storage engine subscribes to all the tables in the Cluster. When any data changes in the Cluster, the NDB binlog injection thread gets notified of the change, and writes to the local binlog. binlog_format=ROW
  • 120. Asynchronous Replication to standard MySQL ( ex: InnoDB ) ndbd ndbd ndbd ndbd mysqld NDB Engine binlog mysqld NDB Engine binlog mysqld asynchronous replication
  • 121. Asynchronous Replication to MySQL Cluster ndbd ndbd ndbd ndbd mysqld NDB Engine binlog mysqld NDB Engine binlog mysqld asynchronous replication ndbd ndbd ndbd ndbd ndbd ndbd ndbd ndbd NDB Engine
  • 123. Native Online NDB Backup Hot backup Consistent backup Initialized by a cluster management node
  • 124. NDB Backup Files Three main components: ● Metadata : BACKUP-backup_id.node_id.ctl ● Table records : BACKUP-backup_id-0.node_id.data different nodes save different fragments during the backup ● Transactional log : BACKUP-backup_id-0.node_id.log different nodes save different logs because they store different fragments Saved on all data nodes: each data node performs the backup of its own fragment
  • 125. START BACKUP shell> ndb_mgm ndb_mgm> START BACKUP Waiting for completed, this may take several minutes Node 1: Backup 4 started from node 12 Node 1: Backup 4 started from node 12 completed StartGCP: 218537 StopGCP: 218575 #Records: 2717875 #LogRecords: 167 Data: 1698871988 bytes Log: 99056 bytes
  • 126. START BACKUP (cont.) Waiting for completed, this may take several minutes Node Did: Backup Bid started from node Mid Node Did: Backup Bid started from node Mid completed StartGCP: 218537 StopGCP: 218575 #Records: 2717875 #LogRecords: 167 Data: 1698871988 bytes Log: 99056 bytes Did : data node coordinating the backup Bid : unique identifier for the current backup Mid : management node that started the backup Number of Global Checkpoints executed during backup Number and size of records in backup Number and size of records in log
  • 127. START BACKUP (cont.) START BACKUP options: ● NOWAIT ● WAIT STARTED ● WAIT COMPLETED ( default )
  • 128. Backup Parameters BackupDataBufferSize: stores data before is written to disk BackupLogBufferSize: buffers log records before are written to disk BackupMemory: BackupDataBufferSize + BackupLogBufferSize
  • 129. Backup Parameters (cont.) BackupWriteSize: default size of messages written to disk from backup buffers ( data and log ) BackupMaxWriteSize: maximum size of messages written to disk CompressedBackup: equivalent to gzip --fast
  • 130. Restore from Online backup ndb_restore: program that performs the restore Procedure: ● import the metadata from just one node ● import the data from each node
  • 131. ndb_restore Important options: -c string : specify the connect string -m : restore metadata -r : restore data -b # : backup ID -n # : node ID -p # : restore in parallel --no-binlog
  • 132. ndb_restore (cont.) --include-databases = db_lists --exclude-databases = db_lists --include-tables = table_lists --exclude-tables = table_lists --rewrite-database = olddb,newdb ... and more!
  • 133. Q & A