SlideShare a Scribd company logo
1 of 38
Download to read offline
Bernd Ocklin
Snr Director MySQL Cluster Development
About me
Bernd Ocklin
Product Owner MySQL NDB Cluster at Oracle
with NDB and MySQL since 2005
Massively linear scale
Sharded Distributed Datasets
Parallel Real-Time Performance.
Auto-partitioning, data distribution
and replication built-in.
Read- and Write Scale-Out
TBs on commodity hardware.
Always-On 99.9999% Availability
Designed for mission critical
systems. Masterless, shared-nothing
with no single point of failure.
Always Consistent
Transactional consistency across
distributed and partitioned dataset.
Out of the box straightforward
application programming.
Standalone or with MySQL
as a SQL front-end.
Ease of use
Open Source
Written in C++.
Shared Nothing
Written in C++. Can be used standalone
or with MySQL as a SQL front-end.
MySQL Cluster Industries
Telecom
Financials
Gaming & Massive Parallel Online Games
Why Cloud Native?
Speed
Fast introduction of
new services
Scaling
Fast scaling from
hundred of users to
millions
Efficient Operations
Automation
Lifecycle
Performance / Capacity
Improved capacity
Better resource
utilisation
Fit for kubernetes?
VMs or container?
VM Containers / K8
workload isolation ++ o / ++
performance + ++
IO o ++
operations - ++
maturity / community / best practices ++ +
footprint - +
cloud native principles o ++
*) e.g. katacontainers
But running databases in a container and kubernetes?
• Yes, you can run any database in a container. Period.
• Just a matter of workload to serve and requirements.
• Milage varies with database’s suitability.
Suitable databases and cloud native principles
Resilience
Losing parts of the
system should not
be a big deal.
It should
automatically
recover and heal it
self.
Shared-Nothing
Cloud-native
databases can
operate without
centralized
management or
any single point of
failure.
Scaling, sharding
Distributed data
Scaling out, not up
Sharding.
Distributed, cloud-
native databases
should present a the
same view of data
independent of
instance queried.
With the
consistency
guarantees of a
single-machine
system.
Standards
Cloud-native
databases should
also support query
standards.
Consistency
Cloud native databases
MySQL NDB classic RDMS InnoDB Cluster
Resilience
Shared-nothing
Consistent view of data
Scaling out, sharding
Standard query language
Self healing
Stateless?
• You should architect your system to be intentional about
when, and how, you store state
• Design components to be stateless wherever 

you can
• Not stateless but smart about state, 

state optimized!
Kubernetes
Analytics
Reporting
Orchestration Operation
Orchestration
& Automation
State”less”
Microservices
Data Layer
Platform 

Services
(Cloud)
Infrastructure
Highly Available
Object Store
Kubernetes Objects running a database
Container
Container
docker hub
. . .
containers:
- image: mysql/mysql-cluster:8.0.22
imagePullPolicy: IfNotPresent
name: ndb
command: ["/bin/bash"]
args:
- -ecx
- /usr/sbin/ndbd -c mgmd-0.ndb-svc.default.svc.cluster.local 
—initial --nodaemon -v
Kubernetes Objects running a database
Pod
Container
Container
docker hub
Workload Resources
Pod
Pod
Container
Container
Workload API
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: StatefulSet
...
spec:
...
serviceName: ndb-svc
template:
spec:
containers:
- image: mysql/mysql-cluster:8.0.22
...
volumeMounts:
- name: ndb-persistent-storage
mountPath: /var/lib/ndb
- name: config-volume
mountPath: /var/lib/ndb/config
....
Running MySQL Cluster in Kubernetes with StatefulSets
Pod
StatefulSet
Pod
Container
Container
• Stable, unique network identifiers.
• Stable, persistent storage.
• Ordered, graceful deployment and scaling.
• Ordered, automated rolling updates.
Headless Service providing network identity
Pod
Headless
Service
StatefulSet
Network
identity
Pod
Container
Container
apiVersion: v1
kind: Service
metadata:
name: ndb-svc
labels:
app: ndb
spec:
ports:
- port: 1186
selector:
app: ndb
clusterIP: None
ConfigMaps to “inject” configuration into Pods/Containers
Pod
Headless
Service
StatefulSet
Network
identity
ConfigMap
Pod
Container
Container
Config as volume
kind: ConfigMap
apiVersion: v1
metadata:
name: ndb-configmap
namespace: default
data:
config.ini: |
[ndbd default]
# NDB redundancy level
NoOfReplicas=3
....
Persistent
Volume Claim
Use Persistent Volumes for storage
Pod
Headless
Service
Persistent
Volume
StatefulSet
Network
identity
Persistent
Volume Claim
Persistent
Volume
ConfigMap
Pod
Container
Container
Config as volume
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: ndb-pv-claimp
labels:
app: ndb
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
NDB Architecture
“stateless”

Microservices
optional
SQL Layer
MySQL NDB Cluster
Partitioning- and distribution engine
MySQL NDB Cluster in Kubernetes
Pod
Sidecar container
Data Node container
Persistent
Volume Claim
Persistent
Volume
ConfigMap
Pod
Sidecar container
Management Node container
Config
Data- and trace files
MySQL NDB Cluster in Kubernetes
Deployment
Cluster
StatefulSet
NDB Cluster
Data Node
Data Node
Data Node
Data Node
Mgm Node
StatefulSet
Mgm Node
Pod
Pod
Pod
Pod
Pod
Pod
Demo - deploying manually
https://www.github.com/ocklin/ndb-k8-manually
Best practices
DNS “stability”
• Pods
• reschedule on other Kubernetes nodes
• change IP addresses
• consider DNS TTL, time to resolve new host address
• GRANT … TO 

‘username’@<IP-address>
• Use AllowUnresolvedHostnames=1
• Retry
!
Service Mesh Istio
• Envoy is a proxy
• connects to cluster will “look like” connects 

from localhost
• cluster expects connects from remote host
• use TcpBind_INADDR_ANY = 1
Sidecars
• Always use a most minimal maintenance container
• idle, low resource
• but allows parallel access to volumes 

and stored data
• easier debugging if things go wrong
Kubernetes is complex
• Many layers and teams responsible
• Lots of people or resources to blame if 

something goes wrong
• Observability is key!
PodDisruptionBudgets and Eviction API
• Eviction API considers pod disruption budgets
• e.g. used when draining kubernetes nodes
• makes sure that you do not accidentally 

shutdown all your nodes of the database
• kubectl delete ignores 

PodDisruptionBudgets!
PodAffinity and AntiAffinity
• All nodes have labels, make heavy use of labels!
• PodAffinity allows to prefer k8 nodes with labels to e.g.
• keep database nodes apart across racks or ADs
• avoid collocation of instances sharing 

same data
• prefer faster storage (e.g. SSD)
MySQL NDB Operator
Kubernetes Operators
• Declarative approach
• Manages services “like a human”
• Based on 

Custom Resource Definitions
Operator reconciliation driving towards desired state
K8
Object
Store
kube
controller
etcd
kube
scheduler
api server
container
Container
Runtime
image
Kublet
image
container
get
wanted state
get
actual state
take mitigation
actions
operator controllers workers
…
…
control plane
$ kubectl apply -f operator-crd.yaml
MySQL NDB Cluster in Kubernetes
Deployment
Kubernete
StatefulSet
NDB Cluster
Ndb operator
backup /
restore
controller
mysql
controll
NDB
controller
Data Node
Data Node
Data Node
Data Node
Mgm Node
StatefulSet
Mgm Node
CRD
Operator Demo
Ndb Custom Resource Definition
apiVersion: mysql.oracle.com/v1alpha1
kind: Ndb
metadata:
name: example-ndb
spec:
containerImage: mysql/mysql-cluster:8.0.22
nodecount: 2
redundancyLevel: 2
mysqld:
nodecount: 2
Thank You
Bernd Ocklin
Snr Director
MySQL Cluster Development

More Related Content

What's hot

Overview of some popular distributed databases
Overview of some popular distributed databasesOverview of some popular distributed databases
Overview of some popular distributed databasessagar chaturvedi
 
Nyc summit intro_to_cassandra
Nyc summit intro_to_cassandraNyc summit intro_to_cassandra
Nyc summit intro_to_cassandrazznate
 
Intro to cassandra
Intro to cassandraIntro to cassandra
Intro to cassandraAaron Ploetz
 
NewSQL overview, Feb 2015
NewSQL overview, Feb 2015NewSQL overview, Feb 2015
NewSQL overview, Feb 2015Ivan Glushkov
 
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag JambhekarC* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag JambhekarDataStax Academy
 
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
 
NewSQL Database Overview
NewSQL Database OverviewNewSQL Database Overview
NewSQL Database OverviewSteve Min
 
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous AvailabilityRamp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous AvailabilityPythian
 
mParticle's Journey to Scylla from Cassandra
mParticle's Journey to Scylla from CassandramParticle's Journey to Scylla from Cassandra
mParticle's Journey to Scylla from CassandraScyllaDB
 
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
 
MariaDB: Connect Storage Engine
MariaDB: Connect Storage EngineMariaDB: Connect Storage Engine
MariaDB: Connect Storage EngineKangaroot
 
Introduction to Cassandra Architecture
Introduction to Cassandra ArchitectureIntroduction to Cassandra Architecture
Introduction to Cassandra Architecturenickmbailey
 
Demystifying the Distributed Database Landscape
Demystifying the Distributed Database LandscapeDemystifying the Distributed Database Landscape
Demystifying the Distributed Database LandscapeScyllaDB
 
How to size up an Apache Cassandra cluster (Training)
How to size up an Apache Cassandra cluster (Training)How to size up an Apache Cassandra cluster (Training)
How to size up an Apache Cassandra cluster (Training)DataStax Academy
 
Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...
Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...
Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...DataStax
 
Scaling MySQL in Amazon Web Services
Scaling MySQL in Amazon Web ServicesScaling MySQL in Amazon Web Services
Scaling MySQL in Amazon Web ServicesLaine Campbell
 
Cassandra Summit 2014: Apache Cassandra Best Practices at Ebay
Cassandra Summit 2014: Apache Cassandra Best Practices at EbayCassandra Summit 2014: Apache Cassandra Best Practices at Ebay
Cassandra Summit 2014: Apache Cassandra Best Practices at EbayDataStax Academy
 

What's hot (20)

Overview of some popular distributed databases
Overview of some popular distributed databasesOverview of some popular distributed databases
Overview of some popular distributed databases
 
Nyc summit intro_to_cassandra
Nyc summit intro_to_cassandraNyc summit intro_to_cassandra
Nyc summit intro_to_cassandra
 
Intro to cassandra
Intro to cassandraIntro to cassandra
Intro to cassandra
 
NewSQL overview, Feb 2015
NewSQL overview, Feb 2015NewSQL overview, Feb 2015
NewSQL overview, Feb 2015
 
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag JambhekarC* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
C* Summit 2013: Cassandra at eBay Scale by Feng Qu and Anurag Jambhekar
 
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
 
NewSQL Database Overview
NewSQL Database OverviewNewSQL Database Overview
NewSQL Database Overview
 
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous AvailabilityRamp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability
Ramp-Tutorial for MYSQL Cluster - Scaling with Continuous Availability
 
mParticle's Journey to Scylla from Cassandra
mParticle's Journey to Scylla from CassandramParticle's Journey to Scylla from Cassandra
mParticle's Journey to Scylla from Cassandra
 
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
 
MariaDB: Connect Storage Engine
MariaDB: Connect Storage EngineMariaDB: Connect Storage Engine
MariaDB: Connect Storage Engine
 
BigData Developers MeetUp
BigData Developers MeetUpBigData Developers MeetUp
BigData Developers MeetUp
 
Introduction to Cassandra Architecture
Introduction to Cassandra ArchitectureIntroduction to Cassandra Architecture
Introduction to Cassandra Architecture
 
Demystifying the Distributed Database Landscape
Demystifying the Distributed Database LandscapeDemystifying the Distributed Database Landscape
Demystifying the Distributed Database Landscape
 
How to size up an Apache Cassandra cluster (Training)
How to size up an Apache Cassandra cluster (Training)How to size up an Apache Cassandra cluster (Training)
How to size up an Apache Cassandra cluster (Training)
 
Cassandra in e-commerce
Cassandra in e-commerceCassandra in e-commerce
Cassandra in e-commerce
 
Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...
Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...
Elassandra: Elasticsearch as a Cassandra Secondary Index (Rémi Trouville, Vin...
 
Scaling MySQL in Amazon Web Services
Scaling MySQL in Amazon Web ServicesScaling MySQL in Amazon Web Services
Scaling MySQL in Amazon Web Services
 
Cassandra Summit 2014: Apache Cassandra Best Practices at Ebay
Cassandra Summit 2014: Apache Cassandra Best Practices at EbayCassandra Summit 2014: Apache Cassandra Best Practices at Ebay
Cassandra Summit 2014: Apache Cassandra Best Practices at Ebay
 
Cassandra NoSQL Tutorial
Cassandra NoSQL TutorialCassandra NoSQL Tutorial
Cassandra NoSQL Tutorial
 

Similar to Run Cloud Native MySQL NDB Cluster in Kubernetes

Why Kubernetes as a container orchestrator is a right choice for running spar...
Why Kubernetes as a container orchestrator is a right choice for running spar...Why Kubernetes as a container orchestrator is a right choice for running spar...
Why Kubernetes as a container orchestrator is a right choice for running spar...DataWorks Summit
 
State of the Container Ecosystem
State of the Container EcosystemState of the Container Ecosystem
State of the Container EcosystemVinay Rao
 
Brk2051 sql server on linux and docker
Brk2051 sql server on linux and dockerBrk2051 sql server on linux and docker
Brk2051 sql server on linux and dockerBob Ward
 
DevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesDevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesRonny Trommer
 
SpringPeople - Introduction to Cloud Computing
SpringPeople - Introduction to Cloud ComputingSpringPeople - Introduction to Cloud Computing
SpringPeople - Introduction to Cloud ComputingSpringPeople
 
Scaling Security on 100s of Millions of Mobile Devices Using Apache Kafka® an...
Scaling Security on 100s of Millions of Mobile Devices Using Apache Kafka® an...Scaling Security on 100s of Millions of Mobile Devices Using Apache Kafka® an...
Scaling Security on 100s of Millions of Mobile Devices Using Apache Kafka® an...confluent
 
Why kubernetes for Serverless (FaaS)
Why kubernetes for Serverless (FaaS)Why kubernetes for Serverless (FaaS)
Why kubernetes for Serverless (FaaS)Krishna-Kumar
 
Kubernetes for Serverless - Serverless Summit 2017 - Krishna Kumar
Kubernetes for Serverless  - Serverless Summit 2017 - Krishna KumarKubernetes for Serverless  - Serverless Summit 2017 - Krishna Kumar
Kubernetes for Serverless - Serverless Summit 2017 - Krishna KumarCodeOps Technologies LLP
 
Data Lake and the rise of the microservices
Data Lake and the rise of the microservicesData Lake and the rise of the microservices
Data Lake and the rise of the microservicesBigstep
 
The impact of cloud NSBCon NY by Yves Goeleven
The impact of cloud NSBCon NY by Yves GoelevenThe impact of cloud NSBCon NY by Yves Goeleven
The impact of cloud NSBCon NY by Yves GoelevenParticular Software
 
Docker - Portable Deployment
Docker - Portable DeploymentDocker - Portable Deployment
Docker - Portable Deploymentjavaonfly
 
Cloud orchestration major tools comparision
Cloud orchestration major tools comparisionCloud orchestration major tools comparision
Cloud orchestration major tools comparisionRavi Kiran
 
OpenStack Days East -- MySQL Options in OpenStack
OpenStack Days East -- MySQL Options in OpenStackOpenStack Days East -- MySQL Options in OpenStack
OpenStack Days East -- MySQL Options in OpenStackMatt Lord
 
MySQL Options in OpenStack
MySQL Options in OpenStackMySQL Options in OpenStack
MySQL Options in OpenStackTesora
 
J1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. Nielsen
J1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. NielsenJ1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. Nielsen
J1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. NielsenMS Cloud Summit
 
Integration in the Age of DevOps
Integration in the Age of DevOpsIntegration in the Age of DevOps
Integration in the Age of DevOpsBrian Ashburn
 
MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15
MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15
MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15Dave Stokes
 
Percona Live 4/14/15: Leveraging open stack cinder for peak application perfo...
Percona Live 4/14/15: Leveraging open stack cinder for peak application perfo...Percona Live 4/14/15: Leveraging open stack cinder for peak application perfo...
Percona Live 4/14/15: Leveraging open stack cinder for peak application perfo...Tesora
 
PGConf.ASIA 2019 Bali - Building PostgreSQL as a Service with Kubernetes - Ta...
PGConf.ASIA 2019 Bali - Building PostgreSQL as a Service with Kubernetes - Ta...PGConf.ASIA 2019 Bali - Building PostgreSQL as a Service with Kubernetes - Ta...
PGConf.ASIA 2019 Bali - Building PostgreSQL as a Service with Kubernetes - Ta...Equnix Business Solutions
 

Similar to Run Cloud Native MySQL NDB Cluster in Kubernetes (20)

Why Kubernetes as a container orchestrator is a right choice for running spar...
Why Kubernetes as a container orchestrator is a right choice for running spar...Why Kubernetes as a container orchestrator is a right choice for running spar...
Why Kubernetes as a container orchestrator is a right choice for running spar...
 
State of the Container Ecosystem
State of the Container EcosystemState of the Container Ecosystem
State of the Container Ecosystem
 
Docker-Intro
Docker-IntroDocker-Intro
Docker-Intro
 
Brk2051 sql server on linux and docker
Brk2051 sql server on linux and dockerBrk2051 sql server on linux and docker
Brk2051 sql server on linux and docker
 
DevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to KubernetesDevJam 2019 - Introduction to Kubernetes
DevJam 2019 - Introduction to Kubernetes
 
SpringPeople - Introduction to Cloud Computing
SpringPeople - Introduction to Cloud ComputingSpringPeople - Introduction to Cloud Computing
SpringPeople - Introduction to Cloud Computing
 
Scaling Security on 100s of Millions of Mobile Devices Using Apache Kafka® an...
Scaling Security on 100s of Millions of Mobile Devices Using Apache Kafka® an...Scaling Security on 100s of Millions of Mobile Devices Using Apache Kafka® an...
Scaling Security on 100s of Millions of Mobile Devices Using Apache Kafka® an...
 
Why kubernetes for Serverless (FaaS)
Why kubernetes for Serverless (FaaS)Why kubernetes for Serverless (FaaS)
Why kubernetes for Serverless (FaaS)
 
Kubernetes for Serverless - Serverless Summit 2017 - Krishna Kumar
Kubernetes for Serverless  - Serverless Summit 2017 - Krishna KumarKubernetes for Serverless  - Serverless Summit 2017 - Krishna Kumar
Kubernetes for Serverless - Serverless Summit 2017 - Krishna Kumar
 
Data Lake and the rise of the microservices
Data Lake and the rise of the microservicesData Lake and the rise of the microservices
Data Lake and the rise of the microservices
 
The impact of cloud NSBCon NY by Yves Goeleven
The impact of cloud NSBCon NY by Yves GoelevenThe impact of cloud NSBCon NY by Yves Goeleven
The impact of cloud NSBCon NY by Yves Goeleven
 
Docker - Portable Deployment
Docker - Portable DeploymentDocker - Portable Deployment
Docker - Portable Deployment
 
Cloud orchestration major tools comparision
Cloud orchestration major tools comparisionCloud orchestration major tools comparision
Cloud orchestration major tools comparision
 
OpenStack Days East -- MySQL Options in OpenStack
OpenStack Days East -- MySQL Options in OpenStackOpenStack Days East -- MySQL Options in OpenStack
OpenStack Days East -- MySQL Options in OpenStack
 
MySQL Options in OpenStack
MySQL Options in OpenStackMySQL Options in OpenStack
MySQL Options in OpenStack
 
J1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. Nielsen
J1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. NielsenJ1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. Nielsen
J1 T1 3 - Azure Data Lake store & analytics 101 - Kenneth M. Nielsen
 
Integration in the Age of DevOps
Integration in the Age of DevOpsIntegration in the Age of DevOps
Integration in the Age of DevOps
 
MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15
MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15
MySQL for Oracle DBA -- Rocky Mountain Oracle User Group Training Days '15
 
Percona Live 4/14/15: Leveraging open stack cinder for peak application perfo...
Percona Live 4/14/15: Leveraging open stack cinder for peak application perfo...Percona Live 4/14/15: Leveraging open stack cinder for peak application perfo...
Percona Live 4/14/15: Leveraging open stack cinder for peak application perfo...
 
PGConf.ASIA 2019 Bali - Building PostgreSQL as a Service with Kubernetes - Ta...
PGConf.ASIA 2019 Bali - Building PostgreSQL as a Service with Kubernetes - Ta...PGConf.ASIA 2019 Bali - Building PostgreSQL as a Service with Kubernetes - Ta...
PGConf.ASIA 2019 Bali - Building PostgreSQL as a Service with Kubernetes - Ta...
 

Recently uploaded

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 

Recently uploaded (20)

Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 

Run Cloud Native MySQL NDB Cluster in Kubernetes

  • 1. Bernd Ocklin Snr Director MySQL Cluster Development
  • 2. About me Bernd Ocklin Product Owner MySQL NDB Cluster at Oracle with NDB and MySQL since 2005
  • 3. Massively linear scale Sharded Distributed Datasets Parallel Real-Time Performance. Auto-partitioning, data distribution and replication built-in. Read- and Write Scale-Out TBs on commodity hardware. Always-On 99.9999% Availability Designed for mission critical systems. Masterless, shared-nothing with no single point of failure. Always Consistent Transactional consistency across distributed and partitioned dataset. Out of the box straightforward application programming. Standalone or with MySQL as a SQL front-end. Ease of use Open Source Written in C++. Shared Nothing Written in C++. Can be used standalone or with MySQL as a SQL front-end.
  • 4. MySQL Cluster Industries Telecom Financials Gaming & Massive Parallel Online Games
  • 5. Why Cloud Native? Speed Fast introduction of new services Scaling Fast scaling from hundred of users to millions Efficient Operations Automation Lifecycle Performance / Capacity Improved capacity Better resource utilisation
  • 7. VMs or container? VM Containers / K8 workload isolation ++ o / ++ performance + ++ IO o ++ operations - ++ maturity / community / best practices ++ + footprint - + cloud native principles o ++ *) e.g. katacontainers
  • 8. But running databases in a container and kubernetes? • Yes, you can run any database in a container. Period. • Just a matter of workload to serve and requirements. • Milage varies with database’s suitability.
  • 9. Suitable databases and cloud native principles Resilience Losing parts of the system should not be a big deal. It should automatically recover and heal it self. Shared-Nothing Cloud-native databases can operate without centralized management or any single point of failure. Scaling, sharding Distributed data Scaling out, not up Sharding. Distributed, cloud- native databases should present a the same view of data independent of instance queried. With the consistency guarantees of a single-machine system. Standards Cloud-native databases should also support query standards. Consistency
  • 10. Cloud native databases MySQL NDB classic RDMS InnoDB Cluster Resilience Shared-nothing Consistent view of data Scaling out, sharding Standard query language Self healing
  • 11. Stateless? • You should architect your system to be intentional about when, and how, you store state • Design components to be stateless wherever 
 you can • Not stateless but smart about state, 
 state optimized!
  • 13. Analytics Reporting Orchestration Operation Orchestration & Automation State”less” Microservices Data Layer Platform 
 Services (Cloud) Infrastructure Highly Available Object Store
  • 14. Kubernetes Objects running a database Container Container docker hub . . . containers: - image: mysql/mysql-cluster:8.0.22 imagePullPolicy: IfNotPresent name: ndb command: ["/bin/bash"] args: - -ecx - /usr/sbin/ndbd -c mgmd-0.ndb-svc.default.svc.cluster.local —initial --nodaemon -v
  • 15. Kubernetes Objects running a database Pod Container Container docker hub
  • 16. Workload Resources Pod Pod Container Container Workload API apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2 kind: StatefulSet ... spec: ... serviceName: ndb-svc template: spec: containers: - image: mysql/mysql-cluster:8.0.22 ... volumeMounts: - name: ndb-persistent-storage mountPath: /var/lib/ndb - name: config-volume mountPath: /var/lib/ndb/config ....
  • 17. Running MySQL Cluster in Kubernetes with StatefulSets Pod StatefulSet Pod Container Container • Stable, unique network identifiers. • Stable, persistent storage. • Ordered, graceful deployment and scaling. • Ordered, automated rolling updates.
  • 18. Headless Service providing network identity Pod Headless Service StatefulSet Network identity Pod Container Container apiVersion: v1 kind: Service metadata: name: ndb-svc labels: app: ndb spec: ports: - port: 1186 selector: app: ndb clusterIP: None
  • 19. ConfigMaps to “inject” configuration into Pods/Containers Pod Headless Service StatefulSet Network identity ConfigMap Pod Container Container Config as volume kind: ConfigMap apiVersion: v1 metadata: name: ndb-configmap namespace: default data: config.ini: | [ndbd default] # NDB redundancy level NoOfReplicas=3 ....
  • 20. Persistent Volume Claim Use Persistent Volumes for storage Pod Headless Service Persistent Volume StatefulSet Network identity Persistent Volume Claim Persistent Volume ConfigMap Pod Container Container Config as volume apiVersion: v1 kind: PersistentVolumeClaim metadata: name: ndb-pv-claimp labels: app: ndb spec: accessModes: - ReadWriteOnce resources: requests: storage: 1Gi
  • 21. NDB Architecture “stateless”
 Microservices optional SQL Layer MySQL NDB Cluster Partitioning- and distribution engine
  • 22. MySQL NDB Cluster in Kubernetes Pod Sidecar container Data Node container Persistent Volume Claim Persistent Volume ConfigMap Pod Sidecar container Management Node container Config Data- and trace files
  • 23. MySQL NDB Cluster in Kubernetes Deployment Cluster StatefulSet NDB Cluster Data Node Data Node Data Node Data Node Mgm Node StatefulSet Mgm Node Pod Pod Pod Pod Pod Pod
  • 24. Demo - deploying manually https://www.github.com/ocklin/ndb-k8-manually
  • 26. DNS “stability” • Pods • reschedule on other Kubernetes nodes • change IP addresses • consider DNS TTL, time to resolve new host address • GRANT … TO 
 ‘username’@<IP-address> • Use AllowUnresolvedHostnames=1 • Retry !
  • 27. Service Mesh Istio • Envoy is a proxy • connects to cluster will “look like” connects 
 from localhost • cluster expects connects from remote host • use TcpBind_INADDR_ANY = 1
  • 28. Sidecars • Always use a most minimal maintenance container • idle, low resource • but allows parallel access to volumes 
 and stored data • easier debugging if things go wrong
  • 29. Kubernetes is complex • Many layers and teams responsible • Lots of people or resources to blame if 
 something goes wrong • Observability is key!
  • 30. PodDisruptionBudgets and Eviction API • Eviction API considers pod disruption budgets • e.g. used when draining kubernetes nodes • makes sure that you do not accidentally 
 shutdown all your nodes of the database • kubectl delete ignores 
 PodDisruptionBudgets!
  • 31. PodAffinity and AntiAffinity • All nodes have labels, make heavy use of labels! • PodAffinity allows to prefer k8 nodes with labels to e.g. • keep database nodes apart across racks or ADs • avoid collocation of instances sharing 
 same data • prefer faster storage (e.g. SSD)
  • 33. Kubernetes Operators • Declarative approach • Manages services “like a human” • Based on 
 Custom Resource Definitions
  • 34. Operator reconciliation driving towards desired state K8 Object Store kube controller etcd kube scheduler api server container Container Runtime image Kublet image container get wanted state get actual state take mitigation actions operator controllers workers … … control plane $ kubectl apply -f operator-crd.yaml
  • 35. MySQL NDB Cluster in Kubernetes Deployment Kubernete StatefulSet NDB Cluster Ndb operator backup / restore controller mysql controll NDB controller Data Node Data Node Data Node Data Node Mgm Node StatefulSet Mgm Node CRD
  • 37. Ndb Custom Resource Definition apiVersion: mysql.oracle.com/v1alpha1 kind: Ndb metadata: name: example-ndb spec: containerImage: mysql/mysql-cluster:8.0.22 nodecount: 2 redundancyLevel: 2 mysqld: nodecount: 2
  • 38. Thank You Bernd Ocklin Snr Director MySQL Cluster Development