Upload
others
View
21
Download
0
Embed Size (px)
Citation preview
<Insert Picture Here>
MySQL 備份,高可用及高扩展解决方案MySQL复制和集群
杜修文Oracle MySQL Principle Sales [email protected]
Backup and Restore
Backup Strategies Comparison
● Method 1:● Full Backups
● Longest Backup Times● Largest Storage Space ● Save space with compression
● Easy to Recover● Fastest Restore Times
● Method 2: ● Full + Incremental
Backup
● Shortest Backup Time● Reduced Storage Requirements
Requires 1X production storage for copy
● Finer-grained Recovery ● Slower Restore Times● First Restore Full Backup ● Then Restore Incrementals
● Method 3: ● Full + Incremental +
Log Backup
● Added Storage RequirementsRequires more than 1X production storage for copy
● Finest-grained Recovery ● Slowest Restore Times● First Restore Full Backup ● Then Restore Incrementals● Then Apply Logs
● Method 4: ● Offload Backups Slave● Replication
● Used with 1 of the above● Frees Master for more workload● Requires 1X production hardware and
storage for standby database
● Fast failover to standby● Backups are last resort, in
event of double site failure or need to perform PITR
MySQL Backup Type: Comparisonmysqldump LVM Snapshots MySQL Replication MySQL Enterprise
Backup
Full Backup ✔ ✔ ✔ ✔
Incremental Backups ✔ ✔
Partial Backups ✔ ✔
Compression Support ✔
Allows updates ✔ ✔
Point in Time - Consistent✔ ✔ ✔
Backup Speed Poor Good Very Good Very Good
Recovery Speed Poor Good Very Good Very good
Partial Restore ✔ ✔
Corruption Detection ✔ ✔
Meets Regulatory Archive Req.
✔ ✔
Supports DDL ✔ ✔
MySQL Enterprise Backup
Media Manager(like Oracle Secure Backup)
Database
Quickly Accessible Disk Storage
Tape Archive
Intrinsic knowledge of database file formats
●Block Validation●Tablespace/Data file recovery
●Unused Block Compression
●Consistent Recovery●File Compression
• MySQL Enterprise Backup CLI• MySQL Enterprise Monitor• Oracle Secure Backup
MySQL Enterprise Backup: Terms
●mysqlbackup : backup executable which includes InnoDB, MyISAM and other MySQL Data. mysqlbackup is a compatible replacement for the innobackup post 3.5.1 and includes additional features and capabilites
●ibbackup: finer grained raw innodb backup executable for innodb files alone
●binlog: contains database changes – eg DDL and DML
●LSN: Log Sequence Number – the unique monotonically increasing id for each change in the binlog
●ibdata: system tablespace files
●.ibd: single table space file
mysqlbackup – Usage Syntax $ mysqlbackup [--sleep=MS] [--compress[=LEVEL]] [--include=REGEXP]
[--user=WORD][--password=WORD] [--port=PORT] [--socket=SOCKET] [--no-timestamp] [--ibbackup=IBBACKUP-BINARY] [--slave-info] [--backup-and-apply-log] [--databases=LIST] [--exec-when-locked="utility arg1 arg2 ..."] [--incremental --lsn=LSN] [--only-known-file-types]
● MY.CNF BACKUP-ROOT-DIR$ mysqlbackup --apply-log [--use-memory=MB] [--uncompress]
● [--ibbackup=IBBACKUP-BINARY] MY.CNF BACKUP-DIR$ mysqlbackup --apply-log --incremental [--use-memory=MB] [--uncompress]
[--ibbackup=IBBACKUP-BINARY]● INCREMENTAL-BACKUP-MY.CNF FULL-BACKUP-MY.CNF$ mysqlbackup --copy-back MY.CNF BACKUP-DIR
mysqlbackup (innobackup) Examples
●Full Backupmysqlbackup --user=dba --password=xyz --compress /etc/my.cnf /backups
● Incremental BackupThe backup only contains changed data
mysqlbackup --incremental --lsn 2261747124 /etc/my.cnf /incr-backup
●PartialThe backup contains tables in test database that match the .ib.* regular expression.
mysqlbackup --include 'test\.ib.*' /etc/my.cnf /backups
How mysqlbackup Works
Hot BackupFiles
Hot BackupFiles
MySQL Database Files
MySQL Database Files
InnoDBTables & Indexes
ibbackupibbackup
mysqlbackupmysqlbackup
SQL
MySQLCommand-line Client
SQL:“FLUSH TABLESWITH READ LOCK”
MySQLServerMySQLServerFlush, Lock
Exec’s
SQL
MyISAMTables & Indexes,.frm, & .mrg files
MySQL 高可用和集群
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 11编号
EXTREME WRITE SCALABILITY
ROCK SOLID RELIABILITY
驱动新的需求
RAPID SERVICE INNOVATION
REAL TIME USER EXPERIENCE
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 12编号
EXTREME WRITE SCALABILITY REAL TIME USER EXPERIENCE
ROCK SOLID RELIABILITY ELIMNATE BARRIERS TO ENTRY
不妥协
事务完整性 OLTP + 实时分析,标淮和技术组成
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 13编号
Copyright 2011 Oracle Corporation 13
MySQL数据库高可用
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 14编号
MySQL
Cluster
MySQL
Cluster
MySQL
Server
Application /
Web / Web AP
• MySQL ReplicationAsynchronous replication
• MySQL+DRBD (for Linux)Shared Nothing Active/Passive
Application /
Web / Web AP
Application /
Web / Web AP
Shared disk
• Shared Disk Based Active/Passive
Application /
Web / Web AP
• MySQL ClusterShared Nothing Active/Active
MySQL
Server
MySQL
Server
MySQL
Server
MySQL
Server
MySQL
Server
Asynchronous
Replication
Synchronous
Replication
Fail Over on failure
Fail Over on failure
Load Balancing
Synchronous
Replication
Load Balancing
MySQL的高可用方案
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 15编号
高可用和扩充性MySQL 复制
●在资讯中心之内和之间横向扩充
●自我疗愈和不受失败影响●支援多种架构
– Master/Slave, Cascading, Circular
●预设是非同步,半同步是另一种选项
●复制工具以快速推进资●支持监看和最佳实践
Relay Log
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 16编号
MySQL集群架构
MySQL Cluster Data Nodes
Clients
Application Layer
Management
Data Layer
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 17编号
SQL Node
(MySQL)
• Standard SQL Interface• Scale-out for Performance• Enables Replication
• High Performance• C, C++ & Java, LDAP, HTTP API• Developer’s Guide
• Data Storage (Memory/Disk)• Automatic & User-Defined Partitioning• Local & Global Checkpoints• Scale-out or scale-up for Capacity & Redundancy• Scale dynamically with on-line add node
• Administration and Configuration• Arbitration• Use Two for Redundancy
NDB API
(Application)
Data Node
(NDB Storage Engine)
Management
Node
MySQL Cluster的组成
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 18编号
MySQL集群架构工作能量扩展
MySQL Cluster Data Nodes
Application Layer
ManagementManagement
Clients
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 19编号
MySQL集群架构无单点固障
MySQL Cluster Data Nodes
Application Layer
ManagementManagement
Clients
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 20编号
Cluster 1
Synchronousreplication
Cluster 2
InnoDB InnoDB InnoDB
Asynchronousreplication
复制的弹性
• Synchronous replication within a Cluster node group for HA
• Bi-Direction asynchronous replication to remote Cluster for geographic redundancy
• Asynchronous replication to non-Cluster databases for specialised activities such as report generation
• Mix and match replication types
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 21编号
多数据中心的可用性跨域复制
•容灾和据本地化•跨数据中心复制整个集群
• Fully active/active• No passive resources
•一个集群分在数个数据中心• Synchronous replication
& auto-failover between sites
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 22编号
排定的在线维护
Scale
Upgrade
Backup
Evolve
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 23编号
MySQL集群 : SQL和 NoSQL彈性
Mix&
Match
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 24编号
NoSQL C++ API, flexaSynch benchmark
30 x Intel E5-2600 Intel Servers, 2 socket, 64GB
ACID Transactions, with Synchronous Replication
0
2
4
6
8
10
12
毎分鐘達 12億次更新操作
MySQL Cluster Data Nodes
Millions of UPDATEs per Second
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 25编号
MySQL集群 : Auto-Installer
快速电配置自动发现 ,工作负荷优化
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 26编号
Oracle Premier Lifetime Support
Oracle Product Certifications/IntegrationsMySQL Enterprise
Security
MySQL Enterprise Scalability
MySQL Cluster Manager
MySQL Enterprise Monitor/Query Analyzer
MySQL Workbench
MySQL Enterprise Audit
MySQL Enterprise Backup
最高等级的性能 ,安全和可用度
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 27编号
Self-HealingAutomated Management HA Operations
●Start / Stop node or whole cluster●On-Line Scaling●On-Line Reconfiguration●On-Line Upgrades●On-Line Backup & Restore
● Node monitoring● Auto-recovery
extended to SQL + mgmt nodes
● Cluster-wide configuration consistency
● Persistent configurations
● HA Agents
强化开发者运行的灵活性 , 减少停机时间
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 28编号
Cluster Manager如何帮助 ?
Results• Reduces complexity
• Reduces risks of downtime
• Automated best practices
例如 :自 MySQL Cluster 7.0 升级到 7.3
• 1 x preliminary check of cluster state• 8 x ssh commands per server• 8 x per-process stop commands• 4 x scp of configuration files (2 x mgmd & 2 x
mysqld)• 8 x per-process start commands• 8 x checks for started and re-joined processes• 8 x process completion verifications• 1 x verify completion of the whole cluster. • Excludes manual editing of each configuration
file.
Total: 46 commands - 2.5 hours of attended
operation
Before MySQL Cluster Manager With MySQL Cluster Manager upgrade cluster --package=7.3 mycluster;
Total: 1 Command - Unattended Operation
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 29编号
• Web-based, global view of MySQL Cluster (on-premise and Cloud deployments)
• Automated, rules-based monitoring and alerts (SMTP, SNMP enabled)
• Query capture, monitoring, analysis and tuning, correlated with Monitor graphs
• Real-time monitoring of data nodes
• Integrated with Oracle Support
MySQL企业监控
A Virtual MySQL DevOps + Admin!
Copyright © 2014, Oracle and/or its affiliates. All rights reserved. | 30编号
• 直接来自源头• 最大的MySQL专业队伍• 有MySQL 开发团队做后盾• 提供向上相容的热修复• MySQL维护发行• MySQL 以 29种语言支持• 24/7/365 • 不限支持的次数• 知识库• MySQL 顾问谘询服务
Oracle对 MySQL的优质服务依靠专家取得独特的效益
"The MySQL support service has been essential in helping us with troubleshooting and providing recommendations for the production cluster, Thanks." -- Carlos Morales – Playfulplay.com
Only From Oracle