Upload
severalnines-ab
View
3.510
Download
4
Tags:
Embed Size (px)
DESCRIPTION
Galera is slowly but surely establishing itself as a credible replacement for traditional MySQL master-slave architectures. The benefits are clear - a true multi-master InnoDB setup with built-in fail-over, potentially across data centers. But how do you migrate? Does the schema or application change? What are the limitations? Can migration be done online, without service interruption? What are the potential risks, and how to address those? AGENDA Application use cases for Galera Schema design Events and Triggers Query design Migrating the schema Loading initial data into the cluster Limitations Performing Online Migration to Galera Operational management checklist Belts and suspenders: Plan B Demo
Citation preview
Migrating to MySQL, MariaDB Galera, and/or Percona XtraDB Cluster
March 2014
Johan Andersson
Severalnines AB
Mobile +46 73 073 60 99
Online Migration
! Existing MySQL Server ! E.g Master – Slave setup
! Single server
! Tired of slave lag and data loss?
! Easy scaling w/o read/write splits?
! Feasibility - Data set, queries, suits Galera
2
Copyright 2014 Severalnines AB
Online Migration
3
Copyright 2014 Severalnines AB
Master – Slave
RW R
Galera Cluster m1 s1 gm1 gm2 gm3
Setup with http://www.severalnines.com/galera-configurator
Existing setup (examples based on 5.5)
Online Migration
! On s1: ! Enable
log-bin=binlog log-slave-updates=1
! GRANT REPLICATION_SLAVE ON *.* TO ‘repl’@’gm1’ IDENTIFIED BY ‘repl’
! Dump schema and data into two separate files. ! Easier to convert the
schema ! Best: convert schema
already on slave
Copyright 2014 Severalnines AB
4
Master – Slave
RW R
m1 s1
Online Migration
! On gm1:
! Load in converted schema
! Load in data
! CHANGE MASTER TO MASTER_HOST=‘s1’, MASTER_USER=‘repl’, MASTER_PASSWORD=‘repl’;
! START SLAVE;
Copyright 2014 Severalnines AB
5
Galera Cluster
gm1 gm2 gm3
Online Migration
6
Copyright 2014 Severalnines AB
Master – Slave Galera Cluster
RW R
R/W
Online Migration
7
Copyright 2014 Severalnines AB
Master – Slave Galera Cluster
RW R
90% R/W 10% Reads
Cut Off
8
Copyright 2014 Severalnines AB
Master – Slave Galera Cluster
RW R
R/W
Demo Time!
! Setting up Replication from Master to Galera Cluster (acting as a slave cluster). ! Master – Percona Server 5.5
! Slave - 3 Node Galera Cluster – PXC 5.6
9
Copyright 2014 Severalnines AB
Master Galera Cluster
Operational Checklist
! Are queues building up?
! Slow queries? Tune queries in the Query Monitor.
! Are backups working?
! Reporting queries?
! Latency issue?
! Do you have random node restarts and failures? Time to upgrade.
! Did you test new code before putting in production?
You worst enemy is the network administrator!
10
Copyright 2014 Severalnines AB
Belt and Suspenders
! Apply your backup procedures as normal ! mysqldump –single-transaction ! s9s_backup, front-end to xtrabackup
http://johanandersson.blogspot.se/2012/10/hotbackup-of-galera-cluster-for-mysql.html
! http://www.severalnines.com/blog/full-restore-mysql-galera-cluster-backup
! You may still want to have an async slave connected to the cluster ! Reporting ! Disaster Recovery ! http://www.severalnines.com/blog/asynchronous-replication-galera-cluster-
mysql-server-gtid’
! Point in time recovery ! http://www.severalnines.com/blog/point-time-recovery-galera-cluster
11
Copyright 2014 Severalnines AB
Q & A
12
Copyright 2014 Severalnines AB
Thank you.
13
Copyright 2014 Severalnines AB
For further questions please contact John-Jerome Schmidt: [email protected]