SlideShare une entreprise Scribd logo
1  sur  46
Télécharger pour lire hors ligne
Multi-Source Replication With
MySQL 5.7 @ Verisure
And How We Got There
 
1 / 46
Kristofer Grahn
kristofer.grahn@verisure.com
Kenny Gryp
kenny.gryp@percona.com
 
2 / 46
Table of Contents
Verisure
Data Warehouse
Tungsten Replicator
MySQL 5.7
Multi-Source Replication
Issues Encountered
Compatibility
 
3 / 46
Europe's most popular home alarm
Verisure
 
4 / 46
Verisure
Verisure is Europe's leading provider of professionally
monitored home alarms and services for the connected and
protected home and business.
We believe it's a human right to feel safe and secure.
We connect and protect what really matters, our service
brings peace of mind to families and small business owners.
Thanks to our strong focus on quality and service, our
customers are among the most satisfied in the industry.
https://www.verisure.com/our-offer.html
 
5 / 46
Verisure
Data Warehouse
 
6 / 46
Data Warehouse
Why the DataWarehouse setup ?
Troubleshooting tool for 3-line.
Not possible to have BI optimized DDL in Prod.
BI-teams in own deploy structure/schedule
Heavy data mining to follow up on :
Product quality
Gsm usage/costs
Stage for Upgrade
 
7 / 46
Data Warehouse
Getting started
First iteration was easy
Old prod hardware was kept as a Datawarehouse.
Then you add sharding
And things got a bit harder
Maybe we could use tungsten ?
 
8 / 46
Tungsten Replicator
Legacy
Operational Overhead
Direct Mode
Hardware Required
Replication Capacity
Bugs
 
9 / 46
Tungsten Replicator
Legacy
Initially: replicate a config database to shards
needed "temporarily" during migration to sharding
Extra tungsten instances added to replicate to DW
 
10 / 46
Tungsten Replicator
Legacy ... grew into...
 
11 / 46
Tungsten Replicator
... grew into...
 
12 / 46
Tungsten Replicator
Shard migration done
Down to one Tungsten per shard
 
13 / 46
Tungsten Replicator
Direct Mode
Due to legacy reasons, direct mode of tungsten is used.
Separate host was configured to serve as tungsten host:
~0.15ms round trip time to database as extra
THL requires disk space:
Replication LAG = lot of disk space.
Ended up with several shard clusters with tungsten
instances
 
14 / 46
Tungsten Replicator
Replication Capacity
Parallel (per schema) Replication was used:
heavier shards limit
Global Warming (Tungsten is very CPU Intensive)
 
15 / 46
Tungsten Replicator
Bugs
Issue 960 (fixed in Tungsten Replicator 3.0):
When using statement based replication with temporary
tables where a ROLLBACK of a commit is applied, the
replicator would fail to execute the rollback statement.
... and just commit the to be rollbacked transaction.
Before the fix, replication broke a lot and shards had
to be rebuilt regularly.
 
16 / 46
Tungsten Replicator
Operational Overhead
Hard for by Non-DBA's such as oncall staff
Hard ... even for DBA's
Custom Percona Toolkit Plugin For Tungsten Replicator:
https://github.com/grypyrg/percona-toolkit-plugin-
tungsten-replicator
$ pt-table-checksum -u checksum --no-check-binlog-format 
--recursion-method=dsn=D=p,t=dsns --plugin=pt-plugin-tungsten_replicator.pl
Created plugin from /vagrant/pt-plugin-tungsten_replicator.pl.
PLUGIN get_slave_lag: Using Tungsten Replicator to check replication lag
Tungsten Replicator status of host node3 is OFFLINE:NORMAL, waiting
Replica node3 is stopped. Waiting.*
Tungsten Replicator status of host node3 is OFFLINE:NORMAL, waiting
Replica lag is 119 seconds on node3. Waiting.
TS ERRORS DIFFS ROWS CHUNKS SKIPPED TIME TABLE
07-03T10:49:54 0 0 2097152 7 0 213.238 app.large_table
 
17 / 46
Move to
MySQL 5.7
 
18 / 46
Move to MySQL 5.7
Why?
MSR to replace Tungsten Replicator:
built-in solution, easy operationally
replication capacity: parallel replication
less infrastructure required
easier to train oncall staff
The start to validate and get experience with
MySQL/Percona Server 5.7
 
19 / 46
Move to MySQL 5.7
Native replication replaces Tungsten
 
20 / 46
Compare
        Before - After
 
21 / 46
MySQL 5.7
Data Warehouse Queries
Collect queries (slowlog)
Replay with pt-upgradeon 2 dw
 
22 / 46
MySQL 5.7
Data Warehouse Queries
few queries were reported slower:
sometimes prefers worse index
to be further investigated
table: alarms
partitions: p201401,p201603,p201604
type: range
key: alarm_insid_sid_time_ix
key_len: 13
rows: 165
Extra: Using index condition; Using where; Using temporary; Using filesort
table: alarms
partitions: p201401,p201603,p201604
type: range
key: alarm_insid_time_ix
key_len: 9
rows: 8089
Extra: Using index condition; Using where
 
23 / 46
MySQL 5.7
Multi Source Replication
 
24 / 46
Multi Source Replication
Syntax
Create user
GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.*
TO 'repluser05'@'192.168.204.10'
IDENTIFIED BY 'rFAQKARW8rLZ9b2Z';
Figure out where to start
cat xtrabackup_binlog_info
mysql-bin.203534 53973866
 
25 / 46
Multi Source Replication
Syntax
Requirements
SET GLOBAL master_info_repository = 'TABLE';
SET GLOBAL relay_log_info_repository = 'TABLE';
 
26 / 46
Multi Source Replication
Syntax
CHANGE MASTER TO MASTER_HOST='192.168.204.50',
MASTER_USER='repluser05',
MASTER_PASSWORD='rFAQKARW8rLZ9b2Z',
MASTER_LOG_FILE='mysql-bin.203534',
MASTER_LOG_POS=53973866
FOR CHANNEL 'host05';
SHOW SLAVE STATUS FOR CHANNEL 'host05'G
STOP SLAVE IO_THREAD FOR CHANNEL 'host05';
RESET SLAVE FOR CHANNEL 'host05';
 
27 / 46
Multi Source Replication
Loading the data
At first you setup replication before shards is used
But sooner or later a reload is needed.
Challenges
Physical backups can't be used to merge several
instances
TB sized databases and mysqldump, not efficient
load of data must be fast, or replication will never
catch up. (based on past experience with Tungsten)
Production is 5.6 and DW 5.7.
Partitioned tables not supported for IMPORT
TABLESPACE.
 
28 / 46
Multi Source Replication
Loading the data
Dump the data using xtrabackup
--export --prepare
Dump the schema using mysqldump
--no-data --triggers --routines
Restore the DDL
mysql < ddl.sql
Load the data
discard tablespace
cp
import tablespace
 
29 / 46
Multi Source Replication
Loading the data Tips and Tricks
5.5 -> 5.6
Tables with timestamps must be rebuilt to new format
Requires a extra machine to use for the rebuild.
Load
ALTER TABLE FORCE
Dump and start the Load
5.6 -> 5.7
Tables must be created with row_format=COMPACT
ALTER TABLE ROW_FORMAT=COMPACT
 
30 / 46
Multi Source Replication
Loading the data Tips and Tricks
5.6: Partitioned tables
Not supported, but
Import each partition as a separate table
Add to table using EXCHANGE PARTITION
Supported in 5.7, but no time to test yet...
 
31 / 46
Multi Source Replication
Skipping a Trx, non-GTID:
mysql> SET GLOBAL sql_slave_skip_counter=1;
mysql> START SLAVE;
ERROR 3086 (HY000): When sql_slave_skip_counter > 0, it is not allowed to
start more than one SQL thread by using 'START SLAVE [SQL_THREAD]'.
Value of sql_slave_skip_counter can only be used by one SQL thread at a time.
Please use 'START SLAVE [SQL_THREAD] FOR CHANNEL' to start the SQL thread
which will use the value of sql_slave_skip_counter.
mysql> START SLAVE FOR CHANNEL 'one';
 
32 / 46
Multi Source Replication
Replication Filters
Replication filters cannot be configured per channel:
http://bugs.mysql.com/bug.php?id=80843
 
33 / 46
Replication Capacity Improvements
Tungsten:
channels=5
parallel-queue.maxSize=75000
# cat shard.list
shard01=0
shard02=1
shard03=2
shard04=3
shard05=4
MySQL 5.7 Parallel Replication (per source):
slave_parallel_type=DATABASE
slave_parallel_workers=5
slave_pending_jobs_size_max=32M
 
34 / 46
Replication Capacity Improvements
 
35 / 46
Replication Capacity Improvements
 
36 / 46
Replication Capacity Improvements
New environment has lower replication capacity with
largest shards.
Waiting for slave-parallel-type=LOGICAL_CLOCK
Waiting on App to become ready for
binlog_format=ROW
Need more in depth analysis of the collected statistics
 
37 / 46
MySQL 5.7
Issues Encountered
 
38 / 46
seconds_behind_masterbug
https://bugs.mysql.com/bug.php?id=66921
https://bugs.mysql.com/bug.php?id=80084 (still open)
 
39 / 46
Crash: innodb_open_files>
open_files_limit
http://bugs.mysql.com/bug.php?id=78981
Fixed in 5.6.30, 5.7.12, 5.8.0
| Variable_name | Value |
+-------------------+-------+
| innodb_open_files | 16384 |
| open_files_limit | 8510 |
2015-10-27 10:20:33 5535 [ERROR] InnoDB: Trying to do i/o to a tablespace which
2015-10-27 10:20:33 7fa725a05700 InnoDB: Error: trying to access tablespace 11015
InnoDB: but the tablespace does not exist or is just being dropped.
2015-10-27 10:20:33 7fa725a05700 InnoDB: Operating system error number 24 in a fi
InnoDB: Error number 24 means 'Too many open files'.
InnoDB: Some operating system error numbers are described at
...
2015-10-27 10:20:33 7fa725a05700 InnoDB: Assertion failure in thread
140355867531008 in file buf0buf.cc line 2740
InnoDB: We intentionally generate a memory trap.
 
40 / 46
Crash: Upgrade from 5.6 to 5.7 MSR
Replication channels are getting same name in MSR
after upgrade, can also Crash MySQL
https://bugs.mysql.com/bug.php?id=80302 -- Open :(
mysql> show slave statusG
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 127.0.0.1
Master_Port: 11204
[..]
Channel_Name: master1
Master_TLS_Version:
*************************** 2. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 127.0.0.1
Master_Port: 13358
[..]
Channel_Name: master1
Master_TLS_Version:
2 rows in set (0.00 sec)
 
41 / 46
MySQL 5.7 Multi Source
Compatibility
 
42 / 46
Percona Toolkit
Percona Toolkit is missing MSR support.
Slave Lag: pt-heartbeat:
https://github.com/grypyrg/percona-toolkit-plugin-
heartbeat
 
43 / 46
InnoTop Multi Source Support
Written by Johan Nilsson (Verisure)
Soon to be merged:
https://github.com/innotop/innotop/pull/129
[RO] Replication Status (? for help) 127.0.0.1, 3m, 1.93 QPS, 5/1/0 con/run/cac th
________________________________ Slave SQL Status ______________________________
Channel Master Master UUID On? TimeLag Catchup RPos Last
one localhost d7e93be0-0452-08002774c31b Yes 00:00 0.00 327
two localhost 5b9d58e4-0452-08002774c31b Yes 00:00 0.00 4
________________________________ Slave I/O Status _______________________________
Channel Master Master UUID On? File RSize Pos
two localhost 5b9d58e4-0472-08002774c31b No 57-co.bin.000003 154
one localhost d7e93be0-04b2-08002774c31b Yes 57-co.bin.000003 545
____________________________________________ Master Status _______________________
File Position Binlog Cache Executed GTID Set Server UUID
57-community-bin.000003 154 0.00% N/A b40426f3-045
 
44 / 46
Monitoring Tools
Our favorite things
Mytop
innotop
Patch for channels
Ichinga/Nagios
Mrtg
Some Mysql metrics that are important for us.
Grafana/Graphite/Collect
 
45 / 46
Kristofer Grahn
kristofer.grahn@verisure.com
Kenny Gryp
kenny.gryp@percona.com
Multi-Source Replication With
MySQL 5.7 @ Verisure
And How We Got There (Almost :-)
Questions?
 
46 / 46

Contenu connexe

Tendances

Webinar Slides: Migrating to Galera Cluster
Webinar Slides: Migrating to Galera ClusterWebinar Slides: Migrating to Galera Cluster
Webinar Slides: Migrating to Galera Cluster
Severalnines
 
Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...
Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...
Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...
Severalnines
 
A26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
A26 MariaDB : The New&Implemented MySQL Branch by Colin CharlesA26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
A26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
Insight Technology, Inc.
 

Tendances (20)

MySQL Group Replicatio in a nutshell - MySQL InnoDB Cluster
MySQL Group Replicatio  in a nutshell - MySQL InnoDB ClusterMySQL Group Replicatio  in a nutshell - MySQL InnoDB Cluster
MySQL Group Replicatio in a nutshell - MySQL InnoDB Cluster
 
MySQL Connectors 8.0.19 & DNS SRV
MySQL Connectors 8.0.19 & DNS SRVMySQL Connectors 8.0.19 & DNS SRV
MySQL Connectors 8.0.19 & DNS SRV
 
MySQL Database Architectures - 2020-10
MySQL Database Architectures -  2020-10MySQL Database Architectures -  2020-10
MySQL Database Architectures - 2020-10
 
Webinar Slides: Migrating to Galera Cluster
Webinar Slides: Migrating to Galera ClusterWebinar Slides: Migrating to Galera Cluster
Webinar Slides: Migrating to Galera Cluster
 
MySQL Replication Performance Tuning for Fun and Profit!
MySQL Replication Performance Tuning for Fun and Profit!MySQL Replication Performance Tuning for Fun and Profit!
MySQL Replication Performance Tuning for Fun and Profit!
 
MySQL High Availability with Group Replication
MySQL High Availability with Group ReplicationMySQL High Availability with Group Replication
MySQL High Availability with Group Replication
 
Advanced Percona XtraDB Cluster in a nutshell... la suite
Advanced Percona XtraDB Cluster in a nutshell... la suiteAdvanced Percona XtraDB Cluster in a nutshell... la suite
Advanced Percona XtraDB Cluster in a nutshell... la suite
 
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
MySQL Database Architectures - MySQL InnoDB ClusterSet 2021-11
 
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & ClusterMySQL Database Architectures - InnoDB ReplicaSet & Cluster
MySQL Database Architectures - InnoDB ReplicaSet & Cluster
 
Fine-tuning Group Replication for Performance
Fine-tuning Group Replication for PerformanceFine-tuning Group Replication for Performance
Fine-tuning Group Replication for Performance
 
Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...
Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...
Webinar slides: ClusterControl 1.4: The MySQL Replication & MongoDB Edition -...
 
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best PracticesMySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
MySQL InnoDB Cluster - New Features in 8.0 Releases - Best Practices
 
Webinar slides: Top 9 Tips for building a stable MySQL Replication environment
Webinar slides: Top 9 Tips for building a stable MySQL Replication environmentWebinar slides: Top 9 Tips for building a stable MySQL Replication environment
Webinar slides: Top 9 Tips for building a stable MySQL Replication environment
 
Why MySQL Replication Fails, and How to Get it Back
Why MySQL Replication Fails, and How to Get it BackWhy MySQL Replication Fails, and How to Get it Back
Why MySQL Replication Fails, and How to Get it Back
 
Webinar Slides : Migrating to MySQL, MariaDB Galera and/or Percona XtraDB Clu...
Webinar Slides : Migrating to MySQL, MariaDB Galera and/or Percona XtraDB Clu...Webinar Slides : Migrating to MySQL, MariaDB Galera and/or Percona XtraDB Clu...
Webinar Slides : Migrating to MySQL, MariaDB Galera and/or Percona XtraDB Clu...
 
MySQL InnoDB Cluster / ReplicaSet - Tutorial
MySQL InnoDB Cluster / ReplicaSet - TutorialMySQL InnoDB Cluster / ReplicaSet - Tutorial
MySQL InnoDB Cluster / ReplicaSet - Tutorial
 
Easy MySQL Replication Setup and Troubleshooting
Easy MySQL Replication Setup and TroubleshootingEasy MySQL Replication Setup and Troubleshooting
Easy MySQL Replication Setup and Troubleshooting
 
Intro ProxySQL
Intro ProxySQLIntro ProxySQL
Intro ProxySQL
 
MySQL Group Replication - an Overview
MySQL Group Replication - an OverviewMySQL Group Replication - an Overview
MySQL Group Replication - an Overview
 
A26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
A26 MariaDB : The New&Implemented MySQL Branch by Colin CharlesA26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
A26 MariaDB : The New&Implemented MySQL Branch by Colin Charles
 

En vedette

MHA (MySQL High Availability): Getting started & moving past quirks
MHA (MySQL High Availability): Getting started & moving past quirksMHA (MySQL High Availability): Getting started & moving past quirks
MHA (MySQL High Availability): Getting started & moving past quirks
Colin Charles
 
Capturing, Analyzing and Optimizing MySQL
Capturing, Analyzing and Optimizing MySQLCapturing, Analyzing and Optimizing MySQL
Capturing, Analyzing and Optimizing MySQL
Ronald Bradford
 
Reducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLReducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQL
Kenny Gryp
 

En vedette (20)

Successful Scalability Principles - Part 1
Successful Scalability Principles - Part 1Successful Scalability Principles - Part 1
Successful Scalability Principles - Part 1
 
The nightmare of locking, blocking and isolation levels!
The nightmare of locking, blocking and isolation levels!The nightmare of locking, blocking and isolation levels!
The nightmare of locking, blocking and isolation levels!
 
10x Performance Improvements - A Case Study
10x Performance Improvements - A Case Study10x Performance Improvements - A Case Study
10x Performance Improvements - A Case Study
 
MySQL - checklist для новичка в Highload
MySQL - checklist для новичка в HighloadMySQL - checklist для новичка в Highload
MySQL - checklist для новичка в Highload
 
Mysql展示功能与源码对应
Mysql展示功能与源码对应Mysql展示功能与源码对应
Mysql展示功能与源码对应
 
MySQL High Availability Deep Dive
MySQL High Availability Deep DiveMySQL High Availability Deep Dive
MySQL High Availability Deep Dive
 
MHA (MySQL High Availability): Getting started & moving past quirks
MHA (MySQL High Availability): Getting started & moving past quirksMHA (MySQL High Availability): Getting started & moving past quirks
MHA (MySQL High Availability): Getting started & moving past quirks
 
Why MySQL High Availability Matters
Why MySQL High Availability MattersWhy MySQL High Availability Matters
Why MySQL High Availability Matters
 
Lessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting ReplicationLessons Learned: Troubleshooting Replication
Lessons Learned: Troubleshooting Replication
 
Capturing, Analyzing and Optimizing MySQL
Capturing, Analyzing and Optimizing MySQLCapturing, Analyzing and Optimizing MySQL
Capturing, Analyzing and Optimizing MySQL
 
High Availability Using MySQL Group Replication
High Availability Using MySQL Group ReplicationHigh Availability Using MySQL Group Replication
High Availability Using MySQL Group Replication
 
Reducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQLReducing Risk When Upgrading MySQL
Reducing Risk When Upgrading MySQL
 
Explain
ExplainExplain
Explain
 
Mysql参数-GDB
Mysql参数-GDBMysql参数-GDB
Mysql参数-GDB
 
MySQL Server Defaults
MySQL Server DefaultsMySQL Server Defaults
MySQL Server Defaults
 
MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017
MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017
MySQL InnoDB Cluster and MySQL Group Replication @HKOSC 2017
 
MySQL 5.7: Focus on InnoDB
MySQL 5.7: Focus on InnoDBMySQL 5.7: Focus on InnoDB
MySQL 5.7: Focus on InnoDB
 
2010丹臣的思考
2010丹臣的思考2010丹臣的思考
2010丹臣的思考
 
淘宝数据库架构演进历程
淘宝数据库架构演进历程淘宝数据库架构演进历程
淘宝数据库架构演进历程
 
Requirements the Last Bottleneck
Requirements the Last BottleneckRequirements the Last Bottleneck
Requirements the Last Bottleneck
 

Similaire à Multi Source Replication With MySQL 5.7 @ Verisure

Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
Sean Hull
 

Similaire à Multi Source Replication With MySQL 5.7 @ Verisure (20)

Percona XtraDB 集群文档
Percona XtraDB 集群文档Percona XtraDB 集群文档
Percona XtraDB 集群文档
 
Speed up R with parallel programming in the Cloud
Speed up R with parallel programming in the CloudSpeed up R with parallel programming in the Cloud
Speed up R with parallel programming in the Cloud
 
MySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated EnvironmentMySQL Scalability and Reliability for Replicated Environment
MySQL Scalability and Reliability for Replicated Environment
 
Testing Delphix: easy data virtualization
Testing Delphix: easy data virtualizationTesting Delphix: easy data virtualization
Testing Delphix: easy data virtualization
 
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
 
Meb Backup & Recovery Performance
Meb Backup & Recovery PerformanceMeb Backup & Recovery Performance
Meb Backup & Recovery Performance
 
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
Disaster Recovery with MySQL InnoDB ClusterSet - What is it and how do I use it?
 
MySQL Replication
MySQL ReplicationMySQL Replication
MySQL Replication
 
MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017MySQL 101 PHPTek 2017
MySQL 101 PHPTek 2017
 
Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009Oreilly Webcast Jan 09, 2009
Oreilly Webcast Jan 09, 2009
 
gDBClone - Database Clone “onecommand Automation Tool”
gDBClone - Database Clone “onecommand Automation Tool”gDBClone - Database Clone “onecommand Automation Tool”
gDBClone - Database Clone “onecommand Automation Tool”
 
MySQL Performance Metrics that Matter
MySQL Performance Metrics that MatterMySQL Performance Metrics that Matter
MySQL Performance Metrics that Matter
 
Oracle Exadata Exam Dump
Oracle Exadata Exam DumpOracle Exadata Exam Dump
Oracle Exadata Exam Dump
 
Set Up & Operate Open Source Oracle Replication
Set Up & Operate Open Source Oracle ReplicationSet Up & Operate Open Source Oracle Replication
Set Up & Operate Open Source Oracle Replication
 
Galera Cluster 4 presentation at Percona Live Austin 2019
Galera Cluster 4 presentation at Percona Live Austin 2019 Galera Cluster 4 presentation at Percona Live Austin 2019
Galera Cluster 4 presentation at Percona Live Austin 2019
 
Orcl siebel-sun-s282213-oow2006
Orcl siebel-sun-s282213-oow2006Orcl siebel-sun-s282213-oow2006
Orcl siebel-sun-s282213-oow2006
 
PoC: Using a Group Communication System to improve MySQL Replication HA
PoC: Using a Group Communication System to improve MySQL Replication HAPoC: Using a Group Communication System to improve MySQL Replication HA
PoC: Using a Group Communication System to improve MySQL Replication HA
 
Powervc upgrade from_1.3.0.2_to_1.3.2.0
Powervc upgrade from_1.3.0.2_to_1.3.2.0Powervc upgrade from_1.3.0.2_to_1.3.2.0
Powervc upgrade from_1.3.0.2_to_1.3.2.0
 
Architecting cloud
Architecting cloudArchitecting cloud
Architecting cloud
 
Testing Persistent Storage Performance in Kubernetes with Sherlock
Testing Persistent Storage Performance in Kubernetes with SherlockTesting Persistent Storage Performance in Kubernetes with Sherlock
Testing Persistent Storage Performance in Kubernetes with Sherlock
 

Dernier

+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
Health
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
vexqp
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
nirzagarg
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
nirzagarg
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
gajnagarg
 
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
HyderabadDolls
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
gajnagarg
 

Dernier (20)

+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
 
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
Nirala Nagar / Cheap Call Girls In Lucknow Phone No 9548273370 Elite Escort S...
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
Charbagh + Female Escorts Service in Lucknow | Starting ₹,5K To @25k with A/C...
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
5CL-ADBA,5cladba, Chinese supplier, safety is guaranteed
 
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
TrafficWave Generator Will Instantly drive targeted and engaging traffic back...
 
Digital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham WareDigital Transformation Playbook by Graham Ware
Digital Transformation Playbook by Graham Ware
 
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
Gulbai Tekra * Cheap Call Girls In Ahmedabad Phone No 8005736733 Elite Escort...
 
7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt7. Epi of Chronic respiratory diseases.ppt
7. Epi of Chronic respiratory diseases.ppt
 
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Purnia [ 7014168258 ] Call Me For Genuine Models We...
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
 
Dubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls DubaiDubai Call Girls Peeing O525547819 Call Girls Dubai
Dubai Call Girls Peeing O525547819 Call Girls Dubai
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
 
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
Sealdah % High Class Call Girls Kolkata - 450+ Call Girl Cash Payment 8005736...
 
Ranking and Scoring Exercises for Research
Ranking and Scoring Exercises for ResearchRanking and Scoring Exercises for Research
Ranking and Scoring Exercises for Research
 
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With OrangePredicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
Predicting HDB Resale Prices - Conducting Linear Regression Analysis With Orange
 
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
Top profile Call Girls In Indore [ 7014168258 ] Call Me For Genuine Models We...
 

Multi Source Replication With MySQL 5.7 @ Verisure

  • 1. Multi-Source Replication With MySQL 5.7 @ Verisure And How We Got There   1 / 46
  • 3. Table of Contents Verisure Data Warehouse Tungsten Replicator MySQL 5.7 Multi-Source Replication Issues Encountered Compatibility   3 / 46
  • 4. Europe's most popular home alarm Verisure   4 / 46
  • 5. Verisure Verisure is Europe's leading provider of professionally monitored home alarms and services for the connected and protected home and business. We believe it's a human right to feel safe and secure. We connect and protect what really matters, our service brings peace of mind to families and small business owners. Thanks to our strong focus on quality and service, our customers are among the most satisfied in the industry. https://www.verisure.com/our-offer.html   5 / 46
  • 7. Data Warehouse Why the DataWarehouse setup ? Troubleshooting tool for 3-line. Not possible to have BI optimized DDL in Prod. BI-teams in own deploy structure/schedule Heavy data mining to follow up on : Product quality Gsm usage/costs Stage for Upgrade   7 / 46
  • 8. Data Warehouse Getting started First iteration was easy Old prod hardware was kept as a Datawarehouse. Then you add sharding And things got a bit harder Maybe we could use tungsten ?   8 / 46
  • 9. Tungsten Replicator Legacy Operational Overhead Direct Mode Hardware Required Replication Capacity Bugs   9 / 46
  • 10. Tungsten Replicator Legacy Initially: replicate a config database to shards needed "temporarily" during migration to sharding Extra tungsten instances added to replicate to DW   10 / 46
  • 11. Tungsten Replicator Legacy ... grew into...   11 / 46
  • 12. Tungsten Replicator ... grew into...   12 / 46
  • 13. Tungsten Replicator Shard migration done Down to one Tungsten per shard   13 / 46
  • 14. Tungsten Replicator Direct Mode Due to legacy reasons, direct mode of tungsten is used. Separate host was configured to serve as tungsten host: ~0.15ms round trip time to database as extra THL requires disk space: Replication LAG = lot of disk space. Ended up with several shard clusters with tungsten instances   14 / 46
  • 15. Tungsten Replicator Replication Capacity Parallel (per schema) Replication was used: heavier shards limit Global Warming (Tungsten is very CPU Intensive)   15 / 46
  • 16. Tungsten Replicator Bugs Issue 960 (fixed in Tungsten Replicator 3.0): When using statement based replication with temporary tables where a ROLLBACK of a commit is applied, the replicator would fail to execute the rollback statement. ... and just commit the to be rollbacked transaction. Before the fix, replication broke a lot and shards had to be rebuilt regularly.   16 / 46
  • 17. Tungsten Replicator Operational Overhead Hard for by Non-DBA's such as oncall staff Hard ... even for DBA's Custom Percona Toolkit Plugin For Tungsten Replicator: https://github.com/grypyrg/percona-toolkit-plugin- tungsten-replicator $ pt-table-checksum -u checksum --no-check-binlog-format --recursion-method=dsn=D=p,t=dsns --plugin=pt-plugin-tungsten_replicator.pl Created plugin from /vagrant/pt-plugin-tungsten_replicator.pl. PLUGIN get_slave_lag: Using Tungsten Replicator to check replication lag Tungsten Replicator status of host node3 is OFFLINE:NORMAL, waiting Replica node3 is stopped. Waiting.* Tungsten Replicator status of host node3 is OFFLINE:NORMAL, waiting Replica lag is 119 seconds on node3. Waiting. TS ERRORS DIFFS ROWS CHUNKS SKIPPED TIME TABLE 07-03T10:49:54 0 0 2097152 7 0 213.238 app.large_table   17 / 46
  • 19. Move to MySQL 5.7 Why? MSR to replace Tungsten Replicator: built-in solution, easy operationally replication capacity: parallel replication less infrastructure required easier to train oncall staff The start to validate and get experience with MySQL/Percona Server 5.7   19 / 46
  • 20. Move to MySQL 5.7 Native replication replaces Tungsten   20 / 46
  • 22. MySQL 5.7 Data Warehouse Queries Collect queries (slowlog) Replay with pt-upgradeon 2 dw   22 / 46
  • 23. MySQL 5.7 Data Warehouse Queries few queries were reported slower: sometimes prefers worse index to be further investigated table: alarms partitions: p201401,p201603,p201604 type: range key: alarm_insid_sid_time_ix key_len: 13 rows: 165 Extra: Using index condition; Using where; Using temporary; Using filesort table: alarms partitions: p201401,p201603,p201604 type: range key: alarm_insid_time_ix key_len: 9 rows: 8089 Extra: Using index condition; Using where   23 / 46
  • 25. Multi Source Replication Syntax Create user GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'repluser05'@'192.168.204.10' IDENTIFIED BY 'rFAQKARW8rLZ9b2Z'; Figure out where to start cat xtrabackup_binlog_info mysql-bin.203534 53973866   25 / 46
  • 26. Multi Source Replication Syntax Requirements SET GLOBAL master_info_repository = 'TABLE'; SET GLOBAL relay_log_info_repository = 'TABLE';   26 / 46
  • 27. Multi Source Replication Syntax CHANGE MASTER TO MASTER_HOST='192.168.204.50', MASTER_USER='repluser05', MASTER_PASSWORD='rFAQKARW8rLZ9b2Z', MASTER_LOG_FILE='mysql-bin.203534', MASTER_LOG_POS=53973866 FOR CHANNEL 'host05'; SHOW SLAVE STATUS FOR CHANNEL 'host05'G STOP SLAVE IO_THREAD FOR CHANNEL 'host05'; RESET SLAVE FOR CHANNEL 'host05';   27 / 46
  • 28. Multi Source Replication Loading the data At first you setup replication before shards is used But sooner or later a reload is needed. Challenges Physical backups can't be used to merge several instances TB sized databases and mysqldump, not efficient load of data must be fast, or replication will never catch up. (based on past experience with Tungsten) Production is 5.6 and DW 5.7. Partitioned tables not supported for IMPORT TABLESPACE.   28 / 46
  • 29. Multi Source Replication Loading the data Dump the data using xtrabackup --export --prepare Dump the schema using mysqldump --no-data --triggers --routines Restore the DDL mysql < ddl.sql Load the data discard tablespace cp import tablespace   29 / 46
  • 30. Multi Source Replication Loading the data Tips and Tricks 5.5 -> 5.6 Tables with timestamps must be rebuilt to new format Requires a extra machine to use for the rebuild. Load ALTER TABLE FORCE Dump and start the Load 5.6 -> 5.7 Tables must be created with row_format=COMPACT ALTER TABLE ROW_FORMAT=COMPACT   30 / 46
  • 31. Multi Source Replication Loading the data Tips and Tricks 5.6: Partitioned tables Not supported, but Import each partition as a separate table Add to table using EXCHANGE PARTITION Supported in 5.7, but no time to test yet...   31 / 46
  • 32. Multi Source Replication Skipping a Trx, non-GTID: mysql> SET GLOBAL sql_slave_skip_counter=1; mysql> START SLAVE; ERROR 3086 (HY000): When sql_slave_skip_counter > 0, it is not allowed to start more than one SQL thread by using 'START SLAVE [SQL_THREAD]'. Value of sql_slave_skip_counter can only be used by one SQL thread at a time. Please use 'START SLAVE [SQL_THREAD] FOR CHANNEL' to start the SQL thread which will use the value of sql_slave_skip_counter. mysql> START SLAVE FOR CHANNEL 'one';   32 / 46
  • 33. Multi Source Replication Replication Filters Replication filters cannot be configured per channel: http://bugs.mysql.com/bug.php?id=80843   33 / 46
  • 34. Replication Capacity Improvements Tungsten: channels=5 parallel-queue.maxSize=75000 # cat shard.list shard01=0 shard02=1 shard03=2 shard04=3 shard05=4 MySQL 5.7 Parallel Replication (per source): slave_parallel_type=DATABASE slave_parallel_workers=5 slave_pending_jobs_size_max=32M   34 / 46
  • 37. Replication Capacity Improvements New environment has lower replication capacity with largest shards. Waiting for slave-parallel-type=LOGICAL_CLOCK Waiting on App to become ready for binlog_format=ROW Need more in depth analysis of the collected statistics   37 / 46
  • 40. Crash: innodb_open_files> open_files_limit http://bugs.mysql.com/bug.php?id=78981 Fixed in 5.6.30, 5.7.12, 5.8.0 | Variable_name | Value | +-------------------+-------+ | innodb_open_files | 16384 | | open_files_limit | 8510 | 2015-10-27 10:20:33 5535 [ERROR] InnoDB: Trying to do i/o to a tablespace which 2015-10-27 10:20:33 7fa725a05700 InnoDB: Error: trying to access tablespace 11015 InnoDB: but the tablespace does not exist or is just being dropped. 2015-10-27 10:20:33 7fa725a05700 InnoDB: Operating system error number 24 in a fi InnoDB: Error number 24 means 'Too many open files'. InnoDB: Some operating system error numbers are described at ... 2015-10-27 10:20:33 7fa725a05700 InnoDB: Assertion failure in thread 140355867531008 in file buf0buf.cc line 2740 InnoDB: We intentionally generate a memory trap.   40 / 46
  • 41. Crash: Upgrade from 5.6 to 5.7 MSR Replication channels are getting same name in MSR after upgrade, can also Crash MySQL https://bugs.mysql.com/bug.php?id=80302 -- Open :( mysql> show slave statusG *************************** 1. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 127.0.0.1 Master_Port: 11204 [..] Channel_Name: master1 Master_TLS_Version: *************************** 2. row *************************** Slave_IO_State: Waiting for master to send event Master_Host: 127.0.0.1 Master_Port: 13358 [..] Channel_Name: master1 Master_TLS_Version: 2 rows in set (0.00 sec)   41 / 46
  • 42. MySQL 5.7 Multi Source Compatibility   42 / 46
  • 43. Percona Toolkit Percona Toolkit is missing MSR support. Slave Lag: pt-heartbeat: https://github.com/grypyrg/percona-toolkit-plugin- heartbeat   43 / 46
  • 44. InnoTop Multi Source Support Written by Johan Nilsson (Verisure) Soon to be merged: https://github.com/innotop/innotop/pull/129 [RO] Replication Status (? for help) 127.0.0.1, 3m, 1.93 QPS, 5/1/0 con/run/cac th ________________________________ Slave SQL Status ______________________________ Channel Master Master UUID On? TimeLag Catchup RPos Last one localhost d7e93be0-0452-08002774c31b Yes 00:00 0.00 327 two localhost 5b9d58e4-0452-08002774c31b Yes 00:00 0.00 4 ________________________________ Slave I/O Status _______________________________ Channel Master Master UUID On? File RSize Pos two localhost 5b9d58e4-0472-08002774c31b No 57-co.bin.000003 154 one localhost d7e93be0-04b2-08002774c31b Yes 57-co.bin.000003 545 ____________________________________________ Master Status _______________________ File Position Binlog Cache Executed GTID Set Server UUID 57-community-bin.000003 154 0.00% N/A b40426f3-045   44 / 46
  • 45. Monitoring Tools Our favorite things Mytop innotop Patch for channels Ichinga/Nagios Mrtg Some Mysql metrics that are important for us. Grafana/Graphite/Collect   45 / 46
  • 46. Kristofer Grahn kristofer.grahn@verisure.com Kenny Gryp kenny.gryp@percona.com Multi-Source Replication With MySQL 5.7 @ Verisure And How We Got There (Almost :-) Questions?   46 / 46