Upload
mariadb
View
456
Download
0
Embed Size (px)
Citation preview
● Nexus of Open Source Database Innovation
● Broad Community Adoption Linux distros, leading web companies
● Innovative products enhance MariaDB.
● Enterprise Subscriptions documentation, optimized binaries, patches, bug fixes, included upgrades, 24/7 support, certain legal protections, customer portal.
● Core MySQL founding team, including Monty Widenius and David Axmark - over 400 years cumulative MySQL Experience.
● Proven Open Source and Cloud management team
● Unusual to debut as a leader!
● Strengths:○ Functionality○ Value○ Community○ Partners
MariaDB received one of the three highest scores for value for money, as it did for suitability of pricing method. It also received one of the highest scores for "no problems encountered."
-- Gartner
© MariaDB
Topics for Today
● Things to Consider● Terms● Types of Backups● Principles and Strategies● Backup Tools● Q & A
© MariaDB
Things to Consider - The Data
● What is the nature of the data?○ Does it compress well?
● How much data do you have?○ Will it grow?
● Is the data itself sensitive?
● Is the data regulated?
© MariaDB
Things to Consider - The Users
● What is the data worth to your organization?
● What internal groups own the data?
● How is the data used?
● Is the data customer facing or used internally?
© MariaDB
Things to Consider - Bad Things
● What would happen if the data was permanently lost?○ Could it be re-created easily?○ Are there legal ramifications?
● How long can the data be unavailable?○ How many minutes or hours or days?○ What would each cost the organization?
● What are the expectations of the organization?○ Unrealistic assumptions?
© MariaDB
Some Backup Terms
Consistency - A backup is consistent if it accurately contains all the data from a specific point in time.
Cold Backup - A backup performed with MariaDB / MySQL stopped
Warm Backup - A backup performed with the database running that significantly affects performance (locks for example)
© MariaDB
Some Backup Terms
Hot Backup - A backup performed with the database running that does not significantly affect performance.
Logical Backup - A text based backup that includes data and commands to recreate the schema and restore the data
Physical Backup - A physical copy of the database files
© MariaDB
Logical Backups
● Produce text files with SQL statements that can be replayed to rebuild database
● Allows backup of databases or specific tables - schema or only data
● A SQL dump is independent of storage engine, and can be restored to a different storage engine, or used for migration
© MariaDB
Logical Backups
● Process can be slow and requires Locks.
● Use a local drive, not across network
● Multiple options exist:mysqldumpSELECT INTO OUTFILE
© MariaDB
Making Physical Backups
● Produces a binary copy of data
● Faster than dumping to SQL text file
● Recovered only to the same storage engine
● Not useful for migrations
● In the event of file corruption, errors remain unseen and affect the backup too
© MariaDB
Making Physical Backups
● Multiple options
○ Copy manually data directory (stopping mysqld necessary)
○ LVM on Linux for volume snapshot
○ (Data complete and consistent, but still trigger InnoDB recovery after restore)
○ InnoDB Hot Backup tool, or XtraBackup
© MariaDB
Recovery with Logical Backups
● Recovery is a simple with logical backups○ $ cat backup.sql | mysql○ mysql> source backup.sql
● They can also be relatively slow
● mysqldump generates UTF8 Text Files
© MariaDB
Recovery with Physical Backups
● Stop the server● Replace the data with the backup data● Start the server and let InnoDB perform recovery● Tip: You can perform this on another system,
make a new copy of the recovered data directory○ This saves time should you need to use it to
recover in an emergency
© MariaDB
Recovery with Binary Logs
● Restore databases with backup dump file, and use the binary logsto execute remaining SQL statements to a specific point
● Get a list of binary log files and then determine current log file:○ SHOW BINARY LOGS;○ SHOW MASTER STATUS;
● Use mysqlbinlog to convert binary log and pipe to mysql client:○ mysqlbinlog binlog.000005 binlog.000006 | mysql -u root -p
© MariaDB
Point-in-Time Recovery
● Give a stop time to mysqlbinlog to recover until then (e.g., Noon):○ mysqlbinlog --stop-datetime=`2013-11-03 11:59:59 ́ \○ /var/log/mysql/bin.000006 | mysql -u root -p
● Give a start time to mysqlbinlog to recover from then:○ mysqlbinlog --start-datetime=`2013-11-03 12:01:00 ́ \○ /var/log/mysql/bin.000006 | mysql -u root -p
© MariaDB
Point-in-Time Recovery - Event Positions
● Determine event position numbers (log_pos):○ mysqlbinlog --start-datetime=`2013-11-03 11:55:00 ́ \○ --stop-datetime=`2013-11-03 12:05:00 ́ \○ /var/log/mysql/bin.000001 > /tmp/mysql_restore.sql
● Restore dump file, then run mysqlbinlog until stop position andResume from a start position:○ mysqlbinlog --stop-position=342839 /var/log/mysql/bin.
0000006 \○ | mysql -u root -p○ mysqlbinlog --start-position=342841 /var/l
© MariaDB
Point-in-Time Recovery - Event Positions
● The mysqldump option –master-data is very important
● Using –master-data=2 stores the binlog file and offset in the backup as a comment
© MariaDB
Replication as a Backup Method● Use MySQL replication to copy data to slave (close
to real time, but technically asynchronous)
● Recovery can be as fast and simple○ Switch traffic to slave, restore master, switch
traffic back to master○ Alternatively, replay binary logs with
mysqlbinlog tool
● Allows other methods to be executed on slave without increasing load on master
● Allows the use of other replication features
© MariaDB
Backup Principles
● Even with HA in place, you still need backups○ For example, HA can’t stop user errors
● Consider both nightly snapshots and real-time backup○ Daily snapshots (mysqldump, InnoDB Hot Backup,
LVM) and real-time backups (Replication)
● Store backups in multiple locations○ On-site for fast access; Off-site for security
© MariaDB
Backup Principles
● Include both data and config files in your backup○ Copy data, logs, and configuration Files○ Synchronize binary logs with backup files!
● Test Backup and Recovery○ Note how long recovery takes
© MariaDB
Backup Tools
The table below shows a comparison of the common backup toolsavailable for MySQL and MariaDB.
© MariaDB
Tools - mysqldump
● Creates Logical Backups
● Is included with MariaDB and MySQL
● Very useful in doing partial backups and selective restores
● Is technically a warm backup when run in default way
© MariaDB
Tools - mysqldump
● Creates locks during backup
● Simple to use
● Single threaded○ SLOW to create backup
○ SLOW to restore
© MariaDB
Tools - mydumper
● Creates logical backups● A faster alternative to mysqldump as it uses multiple
threads● Uses companion application myloader to restore● Creates files per table which makes restores
multithreaded● Almost no locking with InnoDB ● Uses compression● Created by Domas Mituzas
© MariaDB
Tools - XtraBackup
● Fast BackUp Process● Transactions Processed during BackUp Process, a warm
backup if not hot● Low Drain on System Resources● Back-Up Files Verified Automatically● Faster Restore Process● Incremental Backup● Streaming Backup
© MariaDB
Tools - LVM Snapshots
Logical Volume Manager (LVM) is a block device subsystem included with Linux that sits between the file system and the physical disk. Among other things, it provides the ability to quickly take snapshots of a disk volume.
The steps to create a backup are:1. Flush the logs and lock the tables “FLUSH TABLES WITH READ
LOCK”2. Create the snapshot3. Unlock the tables “UNLOCK TABLES”4. Mount the snapshot volume and back it up or make a copy5. Delete the snapshot (there is a performance penalty while it
exists)
© MariaDB
Tools - LVM Snapshots
mylvmbackup is a scripted solution that automates much of this process.
It was created by Lenz Grimmer and can find it here:http://www.lenzg.net/mylvmbackup/
© MariaDB
MariaDB & MySQL Remote DBA Subscription
The MariaDB & MySQL Remote DBA Subscription is a yearly subscription and it includes:
● Monitoring and Backup tools● Integration with our 24x7 support● The Remote DBA services pack includes the following services:● Initial setup and tuning of monitoring servers● Initial health check to ensure best practices and minimise downtime● Backup install● Backup verification● Continuous 24x7 monitoring● Regular health checks● Proactive tuning and maintenance● Consistency, latency and state checks for replicated environments● Support response to monitoring alerts and other issues● 30 min SLA for severe (S1) issues
https://mariadb.com/about/contact