mysql&high&availability&solutions&•framework for python scripts to manage your...

24
MySQL High Availability solutions Bjorn Naessens

Upload: others

Post on 11-Mar-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

MySQL  High  Availability  solutions  Bjorn Naessens

Page 2: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

  Certificates   MySQL 5.6 OCP   Oracle Linux 5/6   Oracle VM 2.x/3.X   Oracle Database 12c

  Blog : http://bjornnaessens.wordpress.com   Twitter : @Bjornnaessens   Email : [email protected]

About  Me  

04/06/15 2

Page 3: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

  Non-shared storage Solutions Mysql Replication

  DRBD Mysql Cluster

  Shared storage solutions   OS Clustering ( Clusterware )

Virtualisation ( OVM )

Types  of  HA  Solutions  

04/06/15 3

Page 4: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

MySQL  Replication  

04/06/15 4

Page 5: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

04/06/15 5

Page 6: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

•  GTID •  GTID_mode •  Enforce_gtid_consistency

•  Sync_binlog •  Flushes binlog to disk after every transaction •  5% overhead •  Loss-less automatic recovery

MySQL  Replication  –  important  parameters  

04/06/15 6

Page 7: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

•  Async & semi-sync , Sync not possible •  Phantom Reads with semi-sync

•  Session only continues when slave sends ACK, but commit already happened

•  No write scale-out •  GTID has some restrictions •  No automatic failover out of the box •  No automatic client redirection •  Performance overhead

MySQL  Replication  –  keep  in  mind    

04/06/15 7

Page 8: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

•  Semi-sync •  Loss-less •  Possible to wait for more than 1 slave

•  Higher throughput •  Apply in parallel •  Less overhead on semi-sync

•  Performance schema tables for slave monitoring

MySQL  Replication  –  new  in  5.7  

04/06/15 8

Page 9: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

•  Multi-source replication

MySQL  Replication  –  Labs  

04/06/15 9

Page 10: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

•  Group Replication •  Multi-master •  No failover needed •  No single point of failure •  Scale-out write and/or reads

MySQL  Replication  –  Labs  

04/06/15 10

Page 11: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

•  Mysql utilities •  Mysqlrplcheck •  Mysqlrpladmin •  Mysqlrplsync •  Mysqlfailover

•  Mysql Enterprise Monitor

•  Performance •  Status check of all masters and slaves •  Alerting

•  Demo

MySQL  Replication  –  Monitoring  

04/06/15 11

Page 12: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

DRBD  

04/06/15 12

Page 13: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

•  only linux 6.2+ and innodb •  more complex to setup and manage

•  Corosync + pacemaker setup •  Split-brain resolving

•  Higher performance overhead •  No delay •  No filtered replication •  No read scale-out •  sync!

DRBD  –  vs  replication  

04/06/15 13

Page 14: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

MySQL  Cluster    

04/06/15 14

Page 15: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

MySQL  Cluster  -­‐  sharding  

04/06/15 15

Page 16: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

•  Highest level of Availability ( 99,999% uptime ) •  All operations are online ( upgrades, schema changes, … )

•  Write-scaleable •  NDB storage engine ( In-memory ) •  Auto Sharding •  Multi-master •  Sync •  No single point of failure

MySQL  Cluster    

04/06/15 16

Page 17: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

•  Replication between multiple clusters •  Active-Active

•  Update anywhere •  Conflict detection ( auto-resolution in 7.4 )

MySQL  Cluster  -­‐  Geo-­‐replication  

04/06/15 17

Page 18: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

•  Many restrictions on application design •  Some joins need to be adjusted to be able to work cross data-nodes •  Full table scans are inherently slow

•  Does the database fit in memory •  Do you need fulltext search

•  Eval Guide •  http://www.mysql.com/why-mysql/white-papers/mysql-cluster-

evaluation-guide/

MySQL  Cluster  –  is  it  for  me?    

04/06/15 18

Page 19: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

Mysql  Fabric  

04/06/15 19

Page 20: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

•  Framework for python scripts to manage your MySQL 5.6+ environment

•  Automates failover in a HA group •  Single point of connection for the application •  Mysql Fabric itself a single point of failure •  Connectors need to be aware of the mysql fabric

•  Python, Java, PHP, .net, C(labs)

•  No GUI, only CLI at this time. •  Can scale out writes by sharding between HA groups

•  Application determines shard key

Mysql  Fabric  

04/06/15 20

Page 21: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

Bringing  it  all  together  

04/06/15 21

Page 22: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

How  to  decide  

04/06/15 22

•  Shared / non-shared Storage

•  OS •  Storage engines •  Data-loss •  Application level Fail-over •  Uptime requirements •  Scaleout possibilities

Page 23: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

Don’t  Forget  

04/06/15 23

•  HA is not Database only!

Page 24: MySQL&High&Availability&solutions&•Framework for python scripts to manage your MySQL 5.6+ environment • Automates failover in a HA group • Single point of connection for the

  MySQL Replication Whitepaper: http://www.mysql.com/why-mysql/white-papers/mysql-replication-introduction

  Oracle Linux and DRBD for MySQL Enterprise Edition Whitepaper: http://www.mysql.com/why-mysql/white-papers/mysql_wp_drbd.php

  MySQL Cluster Whitepaper: http://mysql.com/why-mysql/white-papers/mysql_wp_scaling_web_databases.php

  MySQL Fabric - A Guide to Managing MySQL High Availability and Scaling Out white paper

http://www.mysql.com/why-mysql/white-papers/mysql-fabric-product-guide/

  MySQL High Availability Documentation: http://dev.mysql.com/doc/refman/5.6/en/ha-overview

Sources  

04/06/15 24