SlideShare a Scribd company logo
Confidential 1
Your host & some
logistics
¤ I'm Jean-Jérôme from the
Severalnines Team and I'm your
host for today's webinar!
¤ Feel free to ask any questions
in the Questions section of this
application or via the Chat box.
¤ You can also contact me
directly via the chat box or via
email: jj@severalnines.com
during or after the webinar.
Copyright 2016
Severalnines AB
2
About Severalnines and
ClusterControl
Confidential 3
What we do
Manage Scale
MonitorDeploy
Copyright 2016
Severalnines AB
4
ClusterControl Automation &
Management
¤ Provisioning
¤ Deploy a cluster in minutes
¤ On-premises or in the cloud (AWS)
¤ Monitoring
¤ Systems view
¤ 1sec resolution
¤ DB / OS stats & performance
advisors
¤ Configurable dashboards
¤ Query Analyzer
¤ Real-time / historical
Management
Multi cluster/data-center
Automate repair/recovery
Database upgrades
Backups
Configuration management
Cloning
One-click scaling
Confidential 5
Supported Databases
Confidential 6
Customers
Confidential
Agenda
¤ #1: 101 Sanity Check
¤ #2: Operating System
¤ #3: Backup Strategies
¤ #4: Replication & Sync
¤ #5: Query Performance
¤ #6: Schema Changes
¤ #7: Security / Encryption
¤ #8: Reporting
¤ #9: Managing from disaster
¤ Q&A
7
Copyright Severalnines AB
Confidential
#1: 101 Sanity Check
Confidential
101 Sanity Check
¤ Ensure ALL tables are in the correct storage engine
¤ MySQL: InnoDB or XtraDB
¤ Innodb supports FULLTEXT indexes in MySQL 5.6
¤ MYISAM tables - don’t use
¤ Disabled/forbidden support in Percona XtraDB 5.7
ERROR 1105 (HY000): Percona-XtraDB-Cluster prohibits
use of LOCK TABLE/FLUSH TABLE <table> WITH READ LOCK
with pxc_strict_mode = ENFORCING
¤ Ensure ALL tables have a PRIMARY KEY
¤ If no PRIMARY KEY is defined: add one!
¤ Ensure you have NO unbound queries
¤ E.g UPDATE <table> SET x=x+1 (and there are many rows)
¤ Update/delete in smaller batches (e.g 1000 records).
¤ UPDATE <table> SET x=x+1 LIMIT 1000
Confidential
101 Sanity Check
¤ Ensure that the application can tolerate non-
sequential auto increments.
¤ Galera manages the autoincrements.
¤ Redirect deadlock prone update queries on hot
tables and rows to one of the Galera nodes:
¤ E.g UPDATE counter_tbl SET counter = counter +1;
¤ http://www.severalnines.com/blog/avoiding-deadlocks-
galera- set-haproxy-single-node-writes-and-multi-node-
reads
¤ Ensure your application does not use LOCK TABLES
¤ Use wsrep_sst_method=xtrabackup-v2
Confidential
101 Sanity (WAN replication)
¤  Galera
¤  Increase timeouts
wsrep_provider_options=”evs.keepalive_period=PT3S;		
			evs.inactive_check_period=PT10S;		
			evs.suspect_timeout=PT30S;		
			evs.inactive_timeout=PT1M;		
			evs.install_timeout=PT1M;		
			evs.send_window=1024;		
			evs.user_send_window=512”;		
¤  This will relax how fast a node will be evicted from the
cluster.
¤  Usually default values are good if networks with a ping
time of <10-15 ms
Confidential
#2: Operating System
Confidential
Operating System
¤ Swapping
¤ echo “1” > /proc/sys/vm/swappiness
¤ NUMA on Multi-socket
¤ Lead to contention and strange lock ups, but has been
mostly resolved nowadays
¤ Is it enabled:
¤  dmesg	|	grep	–i	numa	
¤ Grub boot option ”numa=off”
¤ … and other possibilities
¤ Filesystem
¤ Reduce writes by mounting with noatime	
¤  Check	/etc/mtab
Confidential
Operating System
¤ In virtualized environments it is easy to over-commit
resources on a single host.
¤ Keep track of the host hosting the VMs
¤ Is it heavily loaded?
¤ CPU Steal (check on the VMs)?
¤ Is it swapping?
¤ Be prepared to kill off slow nodes
Confidential
#3: Backup
Confidential
Backup
¤ Logical backups
¤  mysqldump	
	
¤ Physical backups
¤ Percona XtraBackup
¤ Full / incremental backups
¤ Streaming backups
¤ Parallelism, compression and encryption
¤ Filesystem snapshots
¤ S3 / Glacier or Swift can be used for offline/offsite
storage
Confidential
Backup
¤ Implement a Backup Policy
¤ Full backup every night
¤ Incremental every 4 hours
¤ Enable Binary Logging
¤ PITR recovery!
Confidential
#4: Replication and Sync
Confidential
Replication and Sync
¤ Galera: IST vs SST
¤ IST (Incremental State Transfer) is (mostly) quicker
¤ Uses gcache to retrieve incremental state
¤ Avoid SST (Snapshot State Transfer) over WAN
¤ SST is triggered if the IST can’t use the gcache
Confidential
Replication and Sync
¤ Galera SST
¤  Ensure you are using a non-blocking SST method
¤  wsrep_sst_method=xtrabackup-v2
¤  Use other more optimal ways to synk larger DBs, e.g.
Snapshots
¤  Or a recent backup stored on the node or a disk
attached.
Confidential
Replication and Sync
¤ Dimension the gcache, example to handle a
maintenance window of 6 hours:
¤  Writes to cluster per second: 1MB/s
¤  Maintenance window (seconds) = 6 hours *60*60 = 21600s
¤  gcache size = 1 MB/s x 21600 s = 21GB
¤  1.5x or 2x the value to have margins:
¤  gcache.size=42G
¤  wsrep_provider_options=‘gcache.size=42G’;
Confidential
#5: Query Performance
Confidential
Query Performance
¤ A number of things to watch out for:
¤ Badly written queries or missing indexes
¤ DDL locking many records
BEGIN; SELECT * FROM t1 FOR UPDATE; …
LOCK TABLES .. ; /* do something */ ;
UNLOCK TABLES;
¤ DDL updating/deleting many records in one chunk
¤ Update/delete “small” batches of 1000-10000
records. Do not update 100000 records.
¤ Deadlocks and deadlock prone code
¤ E.g running two mysqldumps at the same time
¤ Updating the very same record in a very hot table
from multiple threads on multiple hosts
¤ Use your favorite tool to detect the problems
Confidential
Query Performance
¤ When performance grinds to a halt you want to
know!
Confidential
Query Performance
¤ You want to be warned about any slow downs
Confidential
Query Performance
¤ If a deadlock happens, have something your devs
can look at
Confidential
Query Performance
¤ And see if there is any overflow of queries happening
Confidential
#6: Schema Changes
Confidential
Schema Changes
¤ Make a plan on how to deal with schema changes
¤ MySQL replication and Galera apply DDL changes
differently!
¤ Compatible or In-compatible schema change?
¤ Naturally you have a test cluster to make sure your
plan sticks.
Confidential
Schema Changes
¤ Online schema change tools for MySQL:
¤ Facebook OSC
¤ Percona OSC
¤ Github Gh-ost
Confidential
Schema Changes
¤  MySQL Galera
¤  TOI (Total Order Isolation) is the default
¤  Executed on all nodes at the same time
¤  Works fine for non-copying ALTER TABLEs, otherwise is
locking
¤  Only on TINY tables (1000 records)
¤  If it takes 1 sec your app will be blocked for 1 sec.
¤  RSU (Rolling Schema Update)
¤  DDL is not replicated, so only executed locally
¤  Changes must be compatible with queries
executed on the other nodes
¤  For each node do :
SET GLOBAL wsrep_OSU_method=RSU;
ALTER TABLE …
Confidential
#7: Security / Encryption
Confidential
Security / Encryption
¤ Enable SSL client-server encryption
¤ MySQL protocols can be sniffed
¤ Encrypt replication links using SSL
¤ WAN Connections
¤ MySQL Galera
Confidential
#8: Reporting
Confidential
Reporting
¤ Try to separate OLTP and OLAP if possible
¤ Run reports off an (async) slave/secondary or dedicated
node
¤ Remember: huge queries eat CPU, RAM and DISK.
¤ Galera is not faster than its slowest node.
¤ Watch out for reports with side effects
¤ Large updates writing back?
Confidential
#9: Protecting from Disasters
Confidential
Protecting from Disaster
¤ Eventually a disaster will happen
¤ Software bugs
¤ Network / router upgrades
¤ Availability Zone / DC down
¤ Schema / software / hardware upgrade going wrong
¤ Too many connections
¤ User Errors
Confidential
Protecting from Disasters (Galera)
¤ One way of protecting from cluster failures is to use
an asynchronous slave replicating from the Galera
cluster.
¤ If the cluster would fail, the asynchronous slave could
take over and handle the application workload until
the cluster error has been resolved.
Confidential
Protecting from Disasters
¤ Using GTIDs (available from MySQL 5.6 and MariaDB
10.1* onwards) allows for easy fail-over from MASTER1
to MASTER2:
¤  slave> CHANGE MASTER TO MASTER_HOST=’MASTER2’,
MASTER_AUTO_POSITION=1; START SLAVE;
*) - Yes, MariaDb 10.0 has GTID support also, but it is not integrated with Galera.
Confidential
Protecting from Disasters
¤ A common problem is overload situations, which can
originate from:
¤ DDOS
¤ Website is loading slow, user reload, creating more and
more connections
¤ Eventually the database server runs out of
connections (max_connections)
¤ Throttle connections with a load balancer!
¤ E.g HAProxy, ProxySQL, etc.
¤ Cache rarely changing data!
¤ Redis
¤ Memcached
Confidential
Protecting from Disasters
¤ Limit the # of backend
connections
¤ HAProxy will queue the
requests
Confidential
READY.FOR.PRODUCTION
Confidential
Q&A
Copyright Severalnines AB
43
Confidential
Thank You!
¤ ClusterControl
www.severalnines.com/product/clustercontrol
¤ ClusterControl – Getting Starte
www.severalnines.com/getting-started
¤ Polyglot Persistence meetups
http://goo.gl/64Ga5z
¤ Severalnines Blog
www.severalnines.com/blog
¤ Contact: info@severalnines.com
44

More Related Content

What's hot (20)

PDF
Using and Benchmarking Galera in different architectures (PLUK 2012)
Henrik Ingo
 
PDF
MariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Corporation
 
PDF
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Severalnines
 
PDF
Webinar Slides: Migrating to Galera Cluster
Severalnines
 
PDF
High Availability with Galera Cluster - SkySQL Road Show 2013 in Berlin
MariaDB Corporation
 
PDF
Introduction to Galera
Henrik Ingo
 
ODP
MySQL HA with PaceMaker
Kris Buytaert
 
PPTX
Maria DB Galera Cluster for High Availability
OSSCube
 
PDF
Repair & Recovery for your MySQL, MariaDB & MongoDB / TokuMX Clusters - Webin...
Severalnines
 
ODP
Plmce2k15 15 tips galera cluster
Frederic Descamps
 
PDF
Reducing Risk When Upgrading MySQL
Kenny Gryp
 
PDF
Galera 3.0 Webinar Slides: Galera Monitoring & Management
Severalnines
 
PPT
Galera Cluster Best Practices for DBA's and DevOps Part 1
Codership Oy - Creators of Galera Cluster
 
PPTX
MySQL Multi Master Replication
Moshe Kaplan
 
PDF
Galera Cluster 3.0 Features
Codership Oy - Creators of Galera Cluster
 
PDF
Introduction to Galera Cluster
Codership Oy - Creators of Galera Cluster
 
PDF
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
Kenny Gryp
 
PDF
Scaling with sync_replication using Galera and EC2
Marco Tusa
 
PDF
Best practices for MySQL High Availability
Colin Charles
 
PPT
Galera webinar migration to galera cluster from my sql async replication
Codership Oy - Creators of Galera Cluster
 
Using and Benchmarking Galera in different architectures (PLUK 2012)
Henrik Ingo
 
MariaDB Galera Cluster - Simple, Transparent, Highly Available
MariaDB Corporation
 
Webinar slides: Introducing Galera 3.0 - Now supporting MySQL 5.6
Severalnines
 
Webinar Slides: Migrating to Galera Cluster
Severalnines
 
High Availability with Galera Cluster - SkySQL Road Show 2013 in Berlin
MariaDB Corporation
 
Introduction to Galera
Henrik Ingo
 
MySQL HA with PaceMaker
Kris Buytaert
 
Maria DB Galera Cluster for High Availability
OSSCube
 
Repair & Recovery for your MySQL, MariaDB & MongoDB / TokuMX Clusters - Webin...
Severalnines
 
Plmce2k15 15 tips galera cluster
Frederic Descamps
 
Reducing Risk When Upgrading MySQL
Kenny Gryp
 
Galera 3.0 Webinar Slides: Galera Monitoring & Management
Severalnines
 
Galera Cluster Best Practices for DBA's and DevOps Part 1
Codership Oy - Creators of Galera Cluster
 
MySQL Multi Master Replication
Moshe Kaplan
 
Galera Cluster 3.0 Features
Codership Oy - Creators of Galera Cluster
 
Introduction to Galera Cluster
Codership Oy - Creators of Galera Cluster
 
Percona XtraDB Cluster vs Galera Cluster vs MySQL Group Replication
Kenny Gryp
 
Scaling with sync_replication using Galera and EC2
Marco Tusa
 
Best practices for MySQL High Availability
Colin Charles
 
Galera webinar migration to galera cluster from my sql async replication
Codership Oy - Creators of Galera Cluster
 

Viewers also liked (6)

PDF
Webinar slides: MySQL Query Tuning Trilogy: Working with optimizer and SQL tu...
Severalnines
 
PDF
Zero Downtime Schema Changes - Galera Cluster - Best Practices
Severalnines
 
PDF
How To Set Up SQL Load Balancing with HAProxy - Slides
Severalnines
 
PDF
The History of DevOps (and what you need to do about it)
dev2ops
 
PDF
Advanced Percona XtraDB Cluster in a nutshell... la suite
Kenny Gryp
 
PDF
10+ Deploys Per Day: Dev and Ops Cooperation at Flickr
John Allspaw
 
Webinar slides: MySQL Query Tuning Trilogy: Working with optimizer and SQL tu...
Severalnines
 
Zero Downtime Schema Changes - Galera Cluster - Best Practices
Severalnines
 
How To Set Up SQL Load Balancing with HAProxy - Slides
Severalnines
 
The History of DevOps (and what you need to do about it)
dev2ops
 
Advanced Percona XtraDB Cluster in a nutshell... la suite
Kenny Gryp
 
10+ Deploys Per Day: Dev and Ops Cooperation at Flickr
John Allspaw
 
Ad

Similar to Webinar slides: 9 DevOps Tips for Going in Production with Galera Cluster for MySQL / MariaDB (20)

PDF
Slides: Introducing the new ClusterControl 1.2.9 - with live demo
Severalnines
 
PPTX
Migrating to XtraDB Cluster
percona2013
 
PDF
Introducing the Severalnines MySQL© Replication Blueprint
Severalnines
 
PPTX
Migrating to XtraDB Cluster
percona2013
 
PPTX
Infrastructure review - Shining a light on the Black Box
Miklos Szel
 
PPTX
How (not) to kill your MySQL infrastructure
Miklos Szel
 
PDF
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
Dave Stokes
 
PDF
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
Dave Stokes
 
PDF
MySQL 8.0 Operational Changes
Dave Stokes
 
PDF
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
Dave Stokes
 
PDF
Buytaert kris my_sql-pacemaker
kuchinskaya
 
PDF
OSDC 2016 - Tuning Linux for your Database by Colin Charles
NETWAYS
 
PDF
Slides: Introducing the new ClusterControl 1.2.10 for MySQL, MongoDB and Post...
Severalnines
 
PDF
PhpTek Ten Things to do to make your MySQL servers Happier and Healthier
Dave Stokes
 
PDF
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
Kenny Gryp
 
PDF
The Peoper Care and Feeding of a MySQL Server for Busy Linux Admin
Dave Stokes
 
PDF
Scaling MySQL -- Swanseacon.co.uk
Dave Stokes
 
PDF
Evolution of DBA in the Cloud Era
Mydbops
 
PDF
Securing your database servers from external attacks
Alkin Tezuysal
 
PDF
2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxy
Bo-Yi Wu
 
Slides: Introducing the new ClusterControl 1.2.9 - with live demo
Severalnines
 
Migrating to XtraDB Cluster
percona2013
 
Introducing the Severalnines MySQL© Replication Blueprint
Severalnines
 
Migrating to XtraDB Cluster
percona2013
 
Infrastructure review - Shining a light on the Black Box
Miklos Szel
 
How (not) to kill your MySQL infrastructure
Miklos Szel
 
The Proper Care and Feeding of a MySQL Database for Busy Linux Admins -- SCaL...
Dave Stokes
 
Proper Care and Feeding of a MySQL Database for Busy Linux Administrators
Dave Stokes
 
MySQL 8.0 Operational Changes
Dave Stokes
 
Linuxfest Northwest Proper Care and Feeding Of a MySQL for Busy Linux Admins
Dave Stokes
 
Buytaert kris my_sql-pacemaker
kuchinskaya
 
OSDC 2016 - Tuning Linux for your Database by Colin Charles
NETWAYS
 
Slides: Introducing the new ClusterControl 1.2.10 for MySQL, MongoDB and Post...
Severalnines
 
PhpTek Ten Things to do to make your MySQL servers Happier and Healthier
Dave Stokes
 
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
Kenny Gryp
 
The Peoper Care and Feeding of a MySQL Server for Busy Linux Admin
Dave Stokes
 
Scaling MySQL -- Swanseacon.co.uk
Dave Stokes
 
Evolution of DBA in the Cloud Era
Mydbops
 
Securing your database servers from external attacks
Alkin Tezuysal
 
2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxy
Bo-Yi Wu
 
Ad

More from Severalnines (20)

PDF
The Long Term Cost of Managed DBaaS vs Sovereign DBaaS
Severalnines
 
PPTX
Sovereign DBaaS_ A Practical Vision for Self-Implementation of DBaaS.pptx
Severalnines
 
PDF
PostgreSQL on AWS Aurora/Azure Cosmos VS EC2/Azure VMs
Severalnines
 
PDF
Localhost Conference 2024_ Building a Flexible and Scalable Database Strategy...
Severalnines
 
PDF
SREDAY London 2024 | Cloud Native Technologies: The Building Blocks of Modern...
Severalnines
 
PDF
Building a Sovereign DBaaS on K8s OpenInfra Summit Asia 2024.pdf
Severalnines
 
PDF
S-DBaaS Community Call | Introduction to Sovereign DBaaS: The why, what and how
Severalnines
 
PDF
WEBINAR SLIDES: CCX for Cloud Service Providers
Severalnines
 
PPTX
LIVE DEMO: CCX for CSPs, a drop-in DBaaS solution
Severalnines
 
PDF
Kubernetes at Scale: Going Multi-Cluster with Istio
Severalnines
 
PDF
DIY DBaaS: A guide to building your own full-featured DBaaS
Severalnines
 
PDF
Cloud's future runs through Sovereign DBaaS
Severalnines
 
PPTX
Tips to drive maria db cluster performance for nextcloud
Severalnines
 
PPTX
Working with the Moodle Database: The Basics
Severalnines
 
PPTX
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
Severalnines
 
PDF
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
Severalnines
 
PDF
Webinar slides: How to Migrate from Oracle DB to MariaDB
Severalnines
 
PDF
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Severalnines
 
PDF
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Severalnines
 
PDF
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Severalnines
 
The Long Term Cost of Managed DBaaS vs Sovereign DBaaS
Severalnines
 
Sovereign DBaaS_ A Practical Vision for Self-Implementation of DBaaS.pptx
Severalnines
 
PostgreSQL on AWS Aurora/Azure Cosmos VS EC2/Azure VMs
Severalnines
 
Localhost Conference 2024_ Building a Flexible and Scalable Database Strategy...
Severalnines
 
SREDAY London 2024 | Cloud Native Technologies: The Building Blocks of Modern...
Severalnines
 
Building a Sovereign DBaaS on K8s OpenInfra Summit Asia 2024.pdf
Severalnines
 
S-DBaaS Community Call | Introduction to Sovereign DBaaS: The why, what and how
Severalnines
 
WEBINAR SLIDES: CCX for Cloud Service Providers
Severalnines
 
LIVE DEMO: CCX for CSPs, a drop-in DBaaS solution
Severalnines
 
Kubernetes at Scale: Going Multi-Cluster with Istio
Severalnines
 
DIY DBaaS: A guide to building your own full-featured DBaaS
Severalnines
 
Cloud's future runs through Sovereign DBaaS
Severalnines
 
Tips to drive maria db cluster performance for nextcloud
Severalnines
 
Working with the Moodle Database: The Basics
Severalnines
 
SysAdmin Working from Home? Tips to Automate MySQL, MariaDB, Postgres & MongoDB
Severalnines
 
(slides) Polyglot persistence: utilizing open source databases as a Swiss poc...
Severalnines
 
Webinar slides: How to Migrate from Oracle DB to MariaDB
Severalnines
 
Webinar slides: How to Automate & Manage PostgreSQL with ClusterControl
Severalnines
 
Webinar slides: How to Manage Replication Failover Processes for MySQL, Maria...
Severalnines
 
Webinar slides: Backup Management for MySQL, MariaDB, PostgreSQL & MongoDB wi...
Severalnines
 

Recently uploaded (20)

PPTX
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
PDF
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
PPTX
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
PPTX
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
PPTX
Orchestrating things in Angular application
Peter Abraham
 
PPTX
internet básico presentacion es una red global
70965857
 
PPTX
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
PPTX
PM200.pptxghjgfhjghjghjghjghjghjghjghjghjghj
breadpaan921
 
PPTX
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
PDF
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 
PPTX
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
PDF
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
PDF
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
DOCX
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
PDF
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
PPTX
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
PPTX
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
PPTX
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
PDF
The Internet - By the numbers, presented at npNOG 11
APNIC
 
PPTX
原版西班牙莱昂大学毕业证(León毕业证书)如何办理
Taqyea
 
Presentation3gsgsgsgsdfgadgsfgfgsfgagsfgsfgzfdgsdgs.pptx
SUB03
 
Azure_DevOps introduction for CI/CD and Agile
henrymails
 
Lec15_Mutability Immutability-converted.pptx
khanjahanzaib1
 
法国巴黎第二大学本科毕业证{Paris 2学费发票Paris 2成绩单}办理方法
Taqyea
 
Orchestrating things in Angular application
Peter Abraham
 
internet básico presentacion es una red global
70965857
 
L1A Season 1 Guide made by A hegy Eng Grammar fixed
toszolder91
 
PM200.pptxghjgfhjghjghjghjghjghjghjghjghjghj
breadpaan921
 
L1A Season 1 ENGLISH made by A hegy fixed
toszolder91
 
BRKACI-1003 ACI Brownfield Migration - Real World Experiences and Best Practi...
fcesargonca
 
一比一原版(SUNY-Albany毕业证)纽约州立大学奥尔巴尼分校毕业证如何办理
Taqyea
 
Cleaning up your RPKI invalids, presented at PacNOG 35
APNIC
 
𝐁𝐔𝐊𝐓𝐈 𝐊𝐄𝐌𝐄𝐍𝐀𝐍𝐆𝐀𝐍 𝐊𝐈𝐏𝐄𝐑𝟒𝐃 𝐇𝐀𝐑𝐈 𝐈𝐍𝐈 𝟐𝟎𝟐𝟓
hokimamad0
 
Custom vs. Off-the-Shelf Banking Software
KristenCarter35
 
AI_MOD_1.pdf artificial intelligence notes
shreyarrce
 
Optimization_Techniques_ML_Presentation.pptx
farispalayi
 
04 Output 1 Instruments & Tools (3).pptx
GEDYIONGebre
 
Softuni - Psychology of entrepreneurship
Kalin Karakehayov
 
The Internet - By the numbers, presented at npNOG 11
APNIC
 
原版西班牙莱昂大学毕业证(León毕业证书)如何办理
Taqyea
 

Webinar slides: 9 DevOps Tips for Going in Production with Galera Cluster for MySQL / MariaDB

  • 1. Confidential 1 Your host & some logistics ¤ I'm Jean-Jérôme from the Severalnines Team and I'm your host for today's webinar! ¤ Feel free to ask any questions in the Questions section of this application or via the Chat box. ¤ You can also contact me directly via the chat box or via email: [email protected] during or after the webinar.
  • 2. Copyright 2016 Severalnines AB 2 About Severalnines and ClusterControl
  • 3. Confidential 3 What we do Manage Scale MonitorDeploy
  • 4. Copyright 2016 Severalnines AB 4 ClusterControl Automation & Management ¤ Provisioning ¤ Deploy a cluster in minutes ¤ On-premises or in the cloud (AWS) ¤ Monitoring ¤ Systems view ¤ 1sec resolution ¤ DB / OS stats & performance advisors ¤ Configurable dashboards ¤ Query Analyzer ¤ Real-time / historical Management Multi cluster/data-center Automate repair/recovery Database upgrades Backups Configuration management Cloning One-click scaling
  • 7. Confidential Agenda ¤ #1: 101 Sanity Check ¤ #2: Operating System ¤ #3: Backup Strategies ¤ #4: Replication & Sync ¤ #5: Query Performance ¤ #6: Schema Changes ¤ #7: Security / Encryption ¤ #8: Reporting ¤ #9: Managing from disaster ¤ Q&A 7 Copyright Severalnines AB
  • 9. Confidential 101 Sanity Check ¤ Ensure ALL tables are in the correct storage engine ¤ MySQL: InnoDB or XtraDB ¤ Innodb supports FULLTEXT indexes in MySQL 5.6 ¤ MYISAM tables - don’t use ¤ Disabled/forbidden support in Percona XtraDB 5.7 ERROR 1105 (HY000): Percona-XtraDB-Cluster prohibits use of LOCK TABLE/FLUSH TABLE <table> WITH READ LOCK with pxc_strict_mode = ENFORCING ¤ Ensure ALL tables have a PRIMARY KEY ¤ If no PRIMARY KEY is defined: add one! ¤ Ensure you have NO unbound queries ¤ E.g UPDATE <table> SET x=x+1 (and there are many rows) ¤ Update/delete in smaller batches (e.g 1000 records). ¤ UPDATE <table> SET x=x+1 LIMIT 1000
  • 10. Confidential 101 Sanity Check ¤ Ensure that the application can tolerate non- sequential auto increments. ¤ Galera manages the autoincrements. ¤ Redirect deadlock prone update queries on hot tables and rows to one of the Galera nodes: ¤ E.g UPDATE counter_tbl SET counter = counter +1; ¤ http://www.severalnines.com/blog/avoiding-deadlocks- galera- set-haproxy-single-node-writes-and-multi-node- reads ¤ Ensure your application does not use LOCK TABLES ¤ Use wsrep_sst_method=xtrabackup-v2
  • 11. Confidential 101 Sanity (WAN replication) ¤  Galera ¤  Increase timeouts wsrep_provider_options=”evs.keepalive_period=PT3S; evs.inactive_check_period=PT10S; evs.suspect_timeout=PT30S; evs.inactive_timeout=PT1M; evs.install_timeout=PT1M; evs.send_window=1024; evs.user_send_window=512”; ¤  This will relax how fast a node will be evicted from the cluster. ¤  Usually default values are good if networks with a ping time of <10-15 ms
  • 13. Confidential Operating System ¤ Swapping ¤ echo “1” > /proc/sys/vm/swappiness ¤ NUMA on Multi-socket ¤ Lead to contention and strange lock ups, but has been mostly resolved nowadays ¤ Is it enabled: ¤  dmesg | grep –i numa ¤ Grub boot option ”numa=off” ¤ … and other possibilities ¤ Filesystem ¤ Reduce writes by mounting with noatime ¤  Check /etc/mtab
  • 14. Confidential Operating System ¤ In virtualized environments it is easy to over-commit resources on a single host. ¤ Keep track of the host hosting the VMs ¤ Is it heavily loaded? ¤ CPU Steal (check on the VMs)? ¤ Is it swapping? ¤ Be prepared to kill off slow nodes
  • 16. Confidential Backup ¤ Logical backups ¤  mysqldump ¤ Physical backups ¤ Percona XtraBackup ¤ Full / incremental backups ¤ Streaming backups ¤ Parallelism, compression and encryption ¤ Filesystem snapshots ¤ S3 / Glacier or Swift can be used for offline/offsite storage
  • 17. Confidential Backup ¤ Implement a Backup Policy ¤ Full backup every night ¤ Incremental every 4 hours ¤ Enable Binary Logging ¤ PITR recovery!
  • 19. Confidential Replication and Sync ¤ Galera: IST vs SST ¤ IST (Incremental State Transfer) is (mostly) quicker ¤ Uses gcache to retrieve incremental state ¤ Avoid SST (Snapshot State Transfer) over WAN ¤ SST is triggered if the IST can’t use the gcache
  • 20. Confidential Replication and Sync ¤ Galera SST ¤  Ensure you are using a non-blocking SST method ¤  wsrep_sst_method=xtrabackup-v2 ¤  Use other more optimal ways to synk larger DBs, e.g. Snapshots ¤  Or a recent backup stored on the node or a disk attached.
  • 21. Confidential Replication and Sync ¤ Dimension the gcache, example to handle a maintenance window of 6 hours: ¤  Writes to cluster per second: 1MB/s ¤  Maintenance window (seconds) = 6 hours *60*60 = 21600s ¤  gcache size = 1 MB/s x 21600 s = 21GB ¤  1.5x or 2x the value to have margins: ¤  gcache.size=42G ¤  wsrep_provider_options=‘gcache.size=42G’;
  • 23. Confidential Query Performance ¤ A number of things to watch out for: ¤ Badly written queries or missing indexes ¤ DDL locking many records BEGIN; SELECT * FROM t1 FOR UPDATE; … LOCK TABLES .. ; /* do something */ ; UNLOCK TABLES; ¤ DDL updating/deleting many records in one chunk ¤ Update/delete “small” batches of 1000-10000 records. Do not update 100000 records. ¤ Deadlocks and deadlock prone code ¤ E.g running two mysqldumps at the same time ¤ Updating the very same record in a very hot table from multiple threads on multiple hosts ¤ Use your favorite tool to detect the problems
  • 24. Confidential Query Performance ¤ When performance grinds to a halt you want to know!
  • 25. Confidential Query Performance ¤ You want to be warned about any slow downs
  • 26. Confidential Query Performance ¤ If a deadlock happens, have something your devs can look at
  • 27. Confidential Query Performance ¤ And see if there is any overflow of queries happening
  • 29. Confidential Schema Changes ¤ Make a plan on how to deal with schema changes ¤ MySQL replication and Galera apply DDL changes differently! ¤ Compatible or In-compatible schema change? ¤ Naturally you have a test cluster to make sure your plan sticks.
  • 30. Confidential Schema Changes ¤ Online schema change tools for MySQL: ¤ Facebook OSC ¤ Percona OSC ¤ Github Gh-ost
  • 31. Confidential Schema Changes ¤  MySQL Galera ¤  TOI (Total Order Isolation) is the default ¤  Executed on all nodes at the same time ¤  Works fine for non-copying ALTER TABLEs, otherwise is locking ¤  Only on TINY tables (1000 records) ¤  If it takes 1 sec your app will be blocked for 1 sec. ¤  RSU (Rolling Schema Update) ¤  DDL is not replicated, so only executed locally ¤  Changes must be compatible with queries executed on the other nodes ¤  For each node do : SET GLOBAL wsrep_OSU_method=RSU; ALTER TABLE …
  • 33. Confidential Security / Encryption ¤ Enable SSL client-server encryption ¤ MySQL protocols can be sniffed ¤ Encrypt replication links using SSL ¤ WAN Connections ¤ MySQL Galera
  • 35. Confidential Reporting ¤ Try to separate OLTP and OLAP if possible ¤ Run reports off an (async) slave/secondary or dedicated node ¤ Remember: huge queries eat CPU, RAM and DISK. ¤ Galera is not faster than its slowest node. ¤ Watch out for reports with side effects ¤ Large updates writing back?
  • 37. Confidential Protecting from Disaster ¤ Eventually a disaster will happen ¤ Software bugs ¤ Network / router upgrades ¤ Availability Zone / DC down ¤ Schema / software / hardware upgrade going wrong ¤ Too many connections ¤ User Errors
  • 38. Confidential Protecting from Disasters (Galera) ¤ One way of protecting from cluster failures is to use an asynchronous slave replicating from the Galera cluster. ¤ If the cluster would fail, the asynchronous slave could take over and handle the application workload until the cluster error has been resolved.
  • 39. Confidential Protecting from Disasters ¤ Using GTIDs (available from MySQL 5.6 and MariaDB 10.1* onwards) allows for easy fail-over from MASTER1 to MASTER2: ¤  slave> CHANGE MASTER TO MASTER_HOST=’MASTER2’, MASTER_AUTO_POSITION=1; START SLAVE; *) - Yes, MariaDb 10.0 has GTID support also, but it is not integrated with Galera.
  • 40. Confidential Protecting from Disasters ¤ A common problem is overload situations, which can originate from: ¤ DDOS ¤ Website is loading slow, user reload, creating more and more connections ¤ Eventually the database server runs out of connections (max_connections) ¤ Throttle connections with a load balancer! ¤ E.g HAProxy, ProxySQL, etc. ¤ Cache rarely changing data! ¤ Redis ¤ Memcached
  • 41. Confidential Protecting from Disasters ¤ Limit the # of backend connections ¤ HAProxy will queue the requests
  • 44. Confidential Thank You! ¤ ClusterControl www.severalnines.com/product/clustercontrol ¤ ClusterControl – Getting Starte www.severalnines.com/getting-started ¤ Polyglot Persistence meetups http://goo.gl/64Ga5z ¤ Severalnines Blog www.severalnines.com/blog ¤ Contact: [email protected] 44