+ All Categories
Home > Documents > Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle...

Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle...

Date post: 29-May-2020
Category:
Upload: others
View: 5 times
Download: 0 times
Share this document with a friend
52
MySQL Backup Best Practices and Case Study: .IE Continuous Restore Process Marcelo Altmann Senior Support Engineer - Percona Mick Begley Technical Service Manager - IE Domain Registry
Transcript
Page 1: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

MySQL Backup Best Practices and Case Study: .IE Continuous Restore Process

Marcelo AltmannSenior Support Engineer - Percona

Mick BegleyTechnical Service Manager - IE Domain Registry

Page 2: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Agenda

Page 3: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

3

Agenda

• Why we need backups for ?

• Types of backups

• Encryption

• Compression

• Where to store ?

• Restoration

• Validation

• Binlogs

• Retention period

Page 4: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Who is speaking ?

Page 5: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

5

Who is Speaking ?

• Marcelo Altmann- Senior Support Engineer @ Percona

• MySQL DBA @ IE Domain Registry

- Certifications• Oracle Certified Professional, MySQL 5.6 Database Administrator

• Oracle Certified Professional, MySQL 5.6 Developer

• Oracle Certified Professional, MySQL 5 Database Administrator

• Oracle Certified Professional, MySQL 5 Developer

• Oracle Certified Associate, MySQL 5.0/5.1/5.5

- Oracle ACE Associate

- blog.marceloaltmann.com

- @altmannmarcelo

Page 6: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

6

Who is Speaking ?

• Mick Begley- Technical Services Manager @ IE Domain Registry CLG

• Head of IT @ First Derivatives

• Service Integration Manager @ HP

- Certifications• IT and Psychology

• Qualified ITIL Service Manager

• PMI Certified Project Manager

Page 7: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Why we need backups for ?

Page 8: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

8

Why we need backups for ?

• Slave provisioning

• Build Staging / Dev environments

• Disaster recovery

- Data Corruption

- Malicious SQL

- Software Bugs

- Hardware failure

Page 9: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

9

Replication as backup ? Yes

• Master crashes

• Database physical file corruption

• Any physical hardware failure

- CPU

- RAM

- Disk

- Network card

Page 10: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

10

Replication as backup ? No

• Application Bug

• Database Hack

• Malicious SQL commands

Page 11: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Types of backups

Page 12: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

12

Types of backups - Logical

• Structure and data are saved as logical structure

• CREATE DATABASE / TABLE

• INSERT INTO

• Can easily be used for selective restore (Only one database/table)

• Good when physical file is fragmented / corrupted

• Taken while MySQL is running

• Slower than physical

• Tools: mysqldump, mydumper, mysqlpump

Page 13: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

13

Types of backups - Physical

• Raw copy of your databases and tables

• Can be used for selective restore (Only one database/table)

• Fast for either Dump and restore

• Can be taken while MySQL is running

• Bad for table corruption

• Tools: Percona XtraBackup, MySQL Enterprise Backup, snapshots, rsync, cp

Page 14: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

14

Types of backups - Differential or Incremental

• Differential

- Full copy of the database

- Each differential backup has all the changes since last full backup

• Monday: FULL

• Tuesday: Incremental since Monday

• Wednesday: Incremental since Monday

• Thursday: Incremental since Monday

Page 15: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

15

Types of backups - Differential or Incremental

• Incremental

- Full copy of the database

- Each incremental backup has all the changes since last backup

• Monday: FULL

• Tuesday: Incremental since Monday

• Wednesday: Incremental since Tuesday

• Thursday: Incremental since Wednesday

Page 16: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Am I done ?

Page 17: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

N O ! ! !

Page 18: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Encryption

Page 19: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

19

Encryption

• Keep your backups safe from unwanted access

• openssl

• Percona XtraBackup

• --encrypt=ALGORITHM

- AES128, AES192, AES256

• --encrypt-key=ENCRYPTION_KEY or --encrypt-key-file=KEYFILE

Page 20: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

20

Encryption

• Encrypt

- xtrabackup --backup --encrypt=AES256 \

--encrypt-key-file=/data/backups/keyfile --target-dir=/data/backups

• --encrypt-threads (used with --parallel )

• Decrypt

- xtrabackup --decrypt=AES256 \

--encrypt-key-file=/data/backups/keyfile --target-dir=/data/backups

Page 21: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Compression

Page 22: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

22

Compression

• Save storage space

• Require less network when streaming

• Percona XtraBackup

- xtrabackup --backup --compress \

--parallel=4 --compress-threads=4 --target-dir=/data/compressed/

• zip / gzip / bzip

Page 23: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Where to store ?

Page 24: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

24

Where to store ?

• Where are you going to store your backups ?

Page 25: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

25

Where to store ?

• Where are you going to store your backups ?

- Same Server ?

Page 26: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

26

Where to store ?

• Where are you going to store your backups ?

- Same Server ?

Page 27: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

27

Where to store ?

• Where are you going to store your backups ?

- Same Server ?

- Same Data-Center?

Page 28: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

28

Where to store ?

• Where are you going to store your backups ?

- Same Server ?

- Same Data-Center?

Page 29: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

29

Where to store ?

• Where are you going to store your backups ?

- Same Server ?

- Same Data-Center?

- Same Region ?

Page 30: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

30

Where to store ?

• Where are you going to store your backups ?

- Same Server ?

- Same Data-Center?

- Same Region ?

Page 31: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

31

Where to store ?

• Where are you going to store your backups ?

- Same Server ?

- Same Data-Center?

- Same Region ?

• What type of disaster my data must survive ?

Page 32: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Attention ! ! !

Page 33: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

R E S T O R E ! ! !

Page 34: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

34

R E S T O R E ! ! !

• Most important thing when taking backups

• If you don’t test your backup, you simple don’t have a backup.

• Restore on a fresh server

• Keep track of restoration times

• Re-configure as a slave

• Test PITR

Page 35: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Validate your data

Page 36: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

36

Validate your data

• Run checksum on your data

• Ensures your backup has all the data and the data is consistent

• Pt-table-checksum / mysqldbcompare

Page 37: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Backup your binlogs

Page 38: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

38

Backup your binlogs

• Store a safe copy of your binlogs

• Allows you to do point-in-time recovery even if you lose your master

• Mysqlbinlog

- mysqlbinlog --read-from-remote-server --host=host_name --raw --stop-never binlog_file

• MaxScale Binlog Server

Page 39: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Retention period / audits

Page 40: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

40

Retention period / audits

• How far back in time you may need your data ?

• How are you going to store it?

• Be prepared to restore

Page 41: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

.ie Backup

Mick Begley IE Domain Registry [email protected]

Page 42: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Agenda• Who are we?• How is our backup setup?• Schedule• Restore times• Questions

Page 43: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Who are the IEDR ?● The IEDR is the registry for .ie Internet Domain names and maintains

the database of .ie registered Internet names.● Managing since 2000● Team of 20● Console, API application across Three Datacenters● 2016 stats (219,858 total registrations, 34,615 new reg, 89% renewal rate)● Today 231,826 Domains

Page 44: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

44

What is DNS?● Domain Name Servers (DNS) are the Internet's equivalent of a phone

book. They maintain a directory of domain names and translate them to Internet Protocol (IP) addresses.

● Makes it easier to move around the Internet (dont have to remember IP addresses)

● Database of high importance● Database pushes out zone file across the world● Over 70 nodes

Page 45: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

● Local slave and DR site backup slave● Stop replication to slave● Dump slave● Restart replication● Verify Dump, Compress Dump, Encrypt Dump● Send to Backup Server

How is our backup setup?

Page 46: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

● Reset DR site backup slave● Drop all DBs● Decrypt Dump from backup, unCompress, Restore Dump● Stop Server● Compress DataDirectory , Encrypt DataDirectory● Send to Backup Server

How is our backup setup?

Page 47: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,
Page 48: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Backup Schedule

● Backups run at times outside of zone pushes ● Backups run at times outside of system batch processing (NRP,

Invoicing)

Page 49: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Restore procedure

Page 50: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

50

Thank You Sponsors!

Page 51: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

51

SAVE THE DATE!

CALL FOR PAPERS OPENING SOON!www.perconalive.com

April 23-25, 2018Santa Clara Convention Center

Page 52: Continuous Restore Process and Case Study: .IE MySQL ... Backup Best Practices...• Oracle Certified Professional, MySQL 5.6 Database Administrator • Oracle Certified Professional,

Questions ?

Marcelo Altmann@altmannmarcelo

Mick Begley@mickarooney


Recommended