1 / 32

数据库高可用架构

数据库高可用架构. Jacky @ Alibaba www.HelloDBA.net. 问题与挑战. 集中式数据库成为系统瓶颈 数据库依赖高端硬件设备 小型机和高端存储 硬件可用性要求高 Scale up 数据库如何线性扩展(Scale out) 利用廉价设备搭建高可用数据库集群. CAP原理. Consistency:一致性 Availability:可用性 Partition tolerance:分区容错性 三者不可兼得 传统数据库(CA) ACID  原子性,一致性,隔离性,持久性 NoSQL产品(AP) BASE

aiko-perez
Download Presentation

数据库高可用架构

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 数据库高可用架构 Jacky @ Alibaba www.HelloDBA.net

  2. 问题与挑战 • 集中式数据库成为系统瓶颈 • 数据库依赖高端硬件设备 • 小型机和高端存储 • 硬件可用性要求高 • Scale up • 数据库如何线性扩展(Scale out) • 利用廉价设备搭建高可用数据库集群

  3. CAP原理 • Consistency:一致性 • Availability:可用性 • Partition tolerance:分区容错性 • 三者不可兼得 • 传统数据库(CA) • ACID  • 原子性,一致性,隔离性,持久性 • NoSQL产品(AP) • BASE • 基本可用,软状态,最终一致

  4. Hardware HA • Active/Standby • High Availability • Bad Scalability • IBM hacmp • HP serviceguard

  5. Oracle Data Guard • Primary服务,Standby只读(11g) • 异步传送方式,可能导致数据丢失 • 失败切换需要人工干预 • 廉价的容灾方案

  6. Oracle RAC 架构 • Shared Disk • Oracle Clusterware • High Availability • Scale out • Load Balance  • TAF

  7. Oracle RAC 特点 • 应用透明 • 廉价的高可用方案 • 扩展能力有限 • 共享存储的扩展能力 • 节点间通信成本 • DSS类型应用分析 • 可扩展特性 • 充分利用节点计算能力 • 降低节点间通信成本 • OLTP类型应用分析 • 高可用特性 • 应用透明切换(TAF)

  8. Oracle ASM

  9. Oracle ASM 特点 • 具备整合多个存储设备的能力,解决存储的扩展问题 • 自动负载均衡,支持RAID 10 • ASM替换裸设备 • ACFS替换OCFS • 所有的数据都可以放在ASM中 • ASM是免费的

  10. MySQL Replication • Master + Slave(单向复制) • Master + Master(双向复制) • Dual master + heartbeat (HA) • Slave可读写,比Oracle DG更灵活

  11. MySQL Cluster 架构 • Shared Nothing • High Availability • Scale out 

  12. MySQL cluster 特点 • 完全分布式架构 • 高可用  • 可扩展 • 存储节点,处理节点和管理节点 • 内存存储引擎NDB • 自动数据hash分布 • 数据自动冗余,防止单点故障 • 性能不理想 • 数据同步写多节点 • 数据按照PK Hash分布 • UK需要根据PK访问两次 • Join需要将数据读取至mysqld处理

  13. 技术发展趋势 • 硬件 • Intel CPU vs IBM Power • CPU多核化 • Flash Cache / SSD • PC server RAS特性增强 • Reliability, Availability and Serviceability • 软件 • 虚拟化 • 分布式 • 云计算

  14. Oracle Exadata

  15. Oracle Exadata

  16. Oracle Exadata

  17. Oracle Exadata 特性 • 功能 • Smart Scan • Smart Flash Cache • Storage Index • Hybrid Columnar Compressed • 特点 • 廉价设备组成的BOX • RAC整合计算能力 • ASM整合存储能力 • Infiniband高速互联网络 • Flash cache作为二级Cache • 同时支持DSS和OLTP应用 • 缺点:贵

  18. 读写分离架构-MySQL复制

  19. 读写分离架构-Oracle Active Standby

  20. 读写分离架构-DB+Memcache

  21. Facebook MySQL+Memcache架构

  22. 读写分离架构分析 • 适合Read Intensive应用 • 数据库复制存在延迟 • 一致性的问题  • Read-your-writes consistency   • Session consistency • 数据库单机容量成为瓶颈,Sharding? • Memcache crash = Disaster ?! • 分布式Memcached集群 • Consisitent hash

  23. Consistent hash

  24. Consistent hash

  25. Sharding架构 • BASE思想的产物 • 具备线性扩展能力 • 弱化关系型处理 • DB = KV Store • 分布式Hash算法 • Hash(key) mod n • Virtual Partition Hash

  26. Virtual Partition Hash策略 • 根据mod计算hash分布的缺陷 • 节点变化时,所有数据需要重新分布 • Virtual Partition hash策略 • 虚拟分区策略,预分区 • 物理节点包含多个虚拟分区 • 增加节点时,只需移动部分虚拟分区 • 每个节点都有备用节点 • 可根据压力状况灵活配置 • Consistent hash策略的简化

  27. Virtual Partition Hash策略

  28. Virtual Partition Hash策略

  29. 分布式数据库 • 分布式数据库Proxy • 应用透明 • Query Parse • Query Route • Results Merge • Load Balance   • 故障探测 • Failover

  30. 数据库同步技术 • 为什么需要数据库同步 • 构建多站点架构 • 数据库复制无法满足需要 • 商业产品 • Quest Shareplex • Oracle Goldengate 

  31. 我们的解决方案 • 触发器方案 • 日志解析 • Oracle redo log • MySQL binlog • 数据打包传输 • 数据库,文件,图片 • 应用模型 • 并行应用模型 • 如何保持事务一致 • 我们可以做到更好 • 解析SQL • 灵活定义业务逻辑 • 提升处理能力

  32. 技术趋势 • 去I/O/E • MySQL Sharding架构 • DB + Memcached架构 • FlashCache/SSD作为DB二级Cache • MySQL Cluster • 数据同步,多站点架构 • 廉价高可用数据库集群 • Key-Value Store

More Related