只选对的不选贵的 如何选择数据库... · 利用vpc 实现集群隔离、静态/传...
TRANSCRIPT
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
只选对的不选贵的 -如何选择数据库
刘冰冰,AWS 数据库解决方案架构师
分 会 场 四 : 数 据 库
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
目录
AWS 数据库服务及应用场景综述
AWS 关系数据库服务
AWS 非关系数据库服务
AWS 数据库迁移服务
总结
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
现代应用程序的特点互联网级规模与事务数量
用户数量:超过 100 万
数据量:TB–PB–EB
位置:全球
性能:毫秒-微秒
请求率:百万
访问:Web、移动、物联网、设备
扩展:纵向、横向
经济性:按使用量付费
开发者访问:即时 API 访问社交媒体约车平台 流媒体 约会
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
常见数据类型与用例
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
常见数据类型与用例
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Airbnb 利用 AWS 数据库支持互联网级规模云应用程序
用户搜索历史:Amazon DynamoDB• 海量数据
• 需要快速查找以实现个性化搜索
关系数据:Amazon RDS• 参照完整性• 主事务数据库
会话状态:Amazon ElastiCache• 利用内存内存储支持亚毫秒级站点渲染
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Aurora
专为云环境打造的MySQL 与 PostgreSQL 兼容型关系数据库
提供与商业级数据库相当的性能与可用性,但成本仅为其十分之一
性能与可扩展性
可用性与持久性
高安全性 完全托管
吞吐量为标准 MySQL 的五倍,标准 PostgreSQL 的三倍;可横向扩展至 15 套读取副本
具有容错能力的自我修复存储;跨三个可用区建立六套数据副本;持
续备份至 Amazon S3
网络隔离、静态/传输数据加密、合规性与保障
计划
Amazon RDS 托管:无需服务器配置、软件补丁安装、设置、
配置或备份
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Aurora —高性能横向扩展,每秒支持数百万次读取
跨越三个可用区建立 15 套读取副本
读取副本发生故障时进行无缝恢复
新读取副本自动规模伸缩
可用区 1
读取性能横向扩展
可用区 2 可用区 3
应用程序
读取副本 1 读取副本 2主节点
共享分布式存储卷
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Aurora 全球数据库灾难恢复速度更快,数据局部性更强
高吞吐量:每秒高达 20 万次写入
低复制延迟:跨区域延迟小于 1 秒
快速恢复:在区域不可用后的 1 分钟内恢复
支持多辅助区域
支持就地转换为全球数据库
俄勒冈
M R R
存储R R
存储
俄亥俄R R
存储
R R
存储
北弗吉尼亚
爱尔兰
(辅助区域)
(辅助区域)
(辅助区域)
(主区域)
入站副本
入站副本
入站副本
出站副本
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Aurora、Athena以及QuickSight中的机器学习将机器学习技术引入数据库、分析与商务智能
将机器学习整合进数据库、分析与商务智能
与Amazon SageMaker & Comprehend相集成
利用标准 SQL 语句实现机器学习预测
无需任何机器学习专业知识
减少从模型中获取预测结果的时长Comprehend自然语言处理
Amazon
SageMaker机器学习
Aurora数据库
Athena 交互式分析
QuickSight商务智能
SQL
从何处选择
NEW
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
面临的挑战:
•九州通 B2B 系统的业务特点是读多写少,读写比例在 8:2 到 7:3 之间,经常会出现波
峰波谷落差较大的情况。
•自建 MySQL 方式下,主库与从库之间的数据复制延时经常会超过 1 秒,读写分离效果
不好,主库压力居高不下。
获得的收益:
•整体数据库性能提升了 5 倍,TCO 降低了 50%。实现了跨可用区部署、负载均衡/自
动故障转移,精细监控/按需自动伸缩等。
•高效平衡性能和成本。借助 Amazon Aurora Auto Scaling 功能,实现只读副本按需伸
缩,满足业务需求的同时节省服务器成本。
•有效降低主库工作负载压力。主从节点间的延时保持在 20 毫秒左右,可以把更多查询
操作放在从库执行。
九州通医药集团股份有限公司是一家以西药、中药、器械为主要经营产品,以医疗机构、批发企业、零售药店为主要客户对象,并为客户提供信息、物流等各项增值服务的大型企业集团,2019 年销售收入预计突破 1000 亿元。公司是中国医药商业领域具有全国性网络的少数几家企业之一,连续多年位居中国医药商业企业前列,领跑中国民营医药商业企业。其中,线上B2B 业务每年以 30% 以上的速度增长。
”
“
Amazon Aurora 客户案例 –九州通
https://aws.amazon.com/cn/solutions/case-studies/jointown/
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Aurora 客户案例 –九州通
九州通数据库访问流量示意图
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon RDS兼容多种流行数据库的托管关系数据库服务
易于管理
无需基础设施配置
无需软件安装与补丁修复
内置监控机制
性能与可扩展性
一项API调用或数次点击即可完成规模伸缩
多套读取副本,进一步提升吞吐量
自动实现跨可用区数据复制
自动备份、快照保存与故障转移
可用性与持久性 安全与合规
静态与传输数据加密
网络隔离与资源级权限管理
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon RDS Proxy (Preview)
• 全托管数据库代理以实现应用规模扩展
• 无服务器,无需管理任何基础设施
• 自动规模扩展
• 凭证保存在 AWS Secrets Manager 或 Identity Access Management (IAM) 当中
• 代理具备高可用性
• 按使用量付费
客户端应用程序连接池
无缝化故障转移
强化安全
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon ElastiCache
极高性能
内存内数据存储及缓存利用经过优化的堆栈提供亚毫秒级响应能力
高可用性与可靠性
多可用区自动故障转移利用 VPC 实现集群隔离、静态/传输数据加密以及HIPAA 合规
安全与强化
利用副本实现读取扩展;通过分片实现写入与内存扩展;扩展过程不
影响正常业务
易于扩展
托管型内存内数据存储服务
利用 Redis 或 Memcached 为实时应用带来亚毫秒级响应能力
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
实时应用要求低延迟与高并发性
游戏排行榜
聊天应用
缓存
会话存储 机器学习
实时分析 流媒体
消息队列
地理定位
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
缓存与会话存储
挑战应用需要将延迟保持在微秒级别,且每秒应支持数百万个请求
解决方案利用 Redis 或 Memcached 作为缓存,将频繁使用的数据保存在内存内
用例数据库查询缓存、持久会话缓存、全网页缓存、会话存储、消息队列
更佳性能——微秒级速度
良好的成本效益
高吞吐量——约 5000 万 RPS
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
排行榜
挑战排行榜要求低延迟与高并发数据存储作为支持,借此实时处理不断变化的分数并更新排名结果
解决方案利用 Redis 作为内存内数据存储方案,您可以利用它提供的排序集及排名列表等数据结构保证元素的唯一性,同时以微秒级延迟持续更新按分数排序的最终列表
应用游戏排行榜、销售排行榜、客户排行榜
填充排行榜
> zadd leaderboard 556 Andy
> zadd leaderboard 819 Barry
> zadd leaderboard 105 Carl
> zadd leaderboard 1312 Derek
查询排行榜
> zrevrange leaderboard 0 -1
1) "Derek"
2) "Barry"
3) "Andy"
4) "Carl"
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
地理定位应用
挑战需要利用低延迟且高并发型数据存储,实时处理快速移动的位置数据
解决方案选择 Redis 作为内存内数据存储方案,利用其专用数据结构,包括排序集、位置数据编码/解码以及适用于特定位置的索引、搜索与排序 API
应用约车平台、约会、社交媒体、游戏、电子商务
> GEORADIUS restaurants 47.6062 122.3321 10 mi
1) "Starbucks"
2) "McDonalds"
3) "The Best Burger Place"
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon ElastiCache for Redis 中的全球数据存储
快速、可靠、安全的完全托管式跨区域数据复制
主集群在一个区域,从集群在其它区域
跨区域数据复制延迟通常小于 1 秒
为全球化应用提供低延迟的快速本地数据读取
更快的跨区域灾难恢复
把从集群提升为主集群的时间通常小于1分钟
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon DynamoDB立足任意规模提供快速灵活的 NoSQL 数据库服务
规模化性能
以近乎无限的吞吐量构建应用程序
在任意规模下支持一致的个位数毫秒响应速度
加密全部数据
与 AWS Identity and Access
Management 相集成
整体安全性为全球用户及应用提供
全球数据库支持
跨多个区域复制表,借此保证本地数据的快速访问
无服务器
无需硬件配置、软件补丁安装或升级
自动实现纵向或横向规模扩展
持续备份
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
数据模型示例
CART
CartId: 1,Version: 3
CART_ITEM
ItemId:2, Qty: 1,
CartId: 1
关系数据库
CART
CartID:2,
Version: 3,
Items: [
{ID: 2, Qty: 1},
{ID: 5, Qty: 2}]
非关系数据库
规模化架构:多表 非规模化架构:聚合为单一表
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
示例
AWS
Lambda
Amazon
DynamoDBAmazon API
Gateway
Amazon
DynamoDB
Streams
Lambda
Amazon
S3
Amazon
ES
Amazon
Athena
DynamoDB
查询端在线事务处理(OLTP)端
无服务器应用
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon DynamoDB全局表 (Global Tables)
• 用于构建高性能的,全球分布的应用系统
• 对本区域的表的低延迟读取需求
• 多区域冗余
• 配置简单,无需应用程序多次写
全托管的,多主,多区域的数据库
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon DocumentDB (具备MongoDB 兼容性)快速、可扩展且可用性高的 MongoDB 兼容数据库服务
高安全性
利用 Amazon VPC 实现网络隔离
通过 KMS 加密静态数据
数据库审计
利用 TLS 加密传输数据
吞吐量可达现有MongoDB
托管服务的 2 倍
读取容量扩展至每秒数百万次请求
分布式、容错性自我修复存储
规模化性能高可用性
设计可用性达 99.99%
跨三个可用区复制六套数据副本
自动故障转移
MongoDB 兼容性
Apache 2.0 开源MongoDB 3.6 API
使用现有MongoDB 驱动程序与工具
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
为什么选择文档数据库?
非规范化数据模型 规范化数据模型
{
'name': 'Bat City Gelato',
'price': '$',
'rating': 5.0,
'review_count': 46,
'categories': ['gelato', 'ice cream'],
'location':
{
'address': '6301 W Parmer Ln',
'city': 'Austin',
'country': 'US',
'state': 'TX',
'zip_code': '78729'}
}
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
为什么选择文档数据库?
JSON 数据 运营与分析类工作负载
即席查询能力 灵活的索引机制
可快速迭代的灵活模式
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
客户用例
产品目录 内容管理金融科技
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Neptune
全托管图数据库
跨三个可用区提供六套数据副本,具备完整的
备份与还原能力
可靠性 易用性
利用 Gremlin 与 SPARQL 轻松建立强大的查询功能
Gremlin
SPARQL
可存储数十亿条关系
实现毫秒级查询延迟
快速与规模化开放
支持 Apache TinkerPop
与 W3C RDF 图模型
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Neptune 高级架构
从 S3 处批量加载
数据库管理
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
图用例// 为用户提供产品推荐
// 识别共同好友并提供推荐
gremlin> g.V().has('name','mary').as(‘start’).both('knows').both('knows’).where(neq(‘start’)).dedup().by('name').properties('name')
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Amazon Quantum Ledger Database (QLDB)
全托管分类账数据库跟踪并验证一切改变应用程序数据的历史记录
不可变
保留一份完整的数据变更顺序记录,且不可删除或修改;
您可以随时查询并分析完整的历史记录
加密验证
利用加密技术为数据历史记录生成安全的输出文件
易于使用
易于使用,帮助您利用熟知的数据库功能(例如SQL API)
查询数据
执行的事务量为普通区块链框架分类账的2 到 3 倍
高可扩展性
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
AWS Database Migration Service
将数据库迁移至 AWS 在数据库之间迁移
近零停机时间数据复制迁移
在本地设施与 AWS 之间迁移
模式自动转换
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
截至目前,利用 DMS 迁移完成的数据库已超过 20 万套2019 年一年的数据库迁移量,超过 2016 年至 2018 年的总和
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
客户渴望选择全托管服务
关系数据库
Aurora RDS EMR
Hadoop与Spark
Elasticsearch Service
运营分析
Managed Streaming for Kafka
实时分析
DynamoDB DocumentDB ElastiCacheManaged Cassandra
Service
非关系数据库
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
服务与对应使用场景说明场景 解决方案
Existing 现有应用程序
• MySQL Amazon Aurora, RDS for MySQL
• PostgreSQL Amazon Aurora, RDS for PostgreSQL
• MariaDB Amazon Aurora, RDS for MariaDB
• Oracle 利用 AWS SCT 检测复杂性因素 Amazon Aurora, RDS for Oracle
• SQL Server 利用 AWS SCT 检测复杂性因素 Amazon Aurora, RDS for SQL Server
• MongoDB Amazon DocumentDB
• Cassandra Amazon Managed Apache Cassandra Service
新的应用程序• 如果不需要关系类功能 Amazon DynamoDB
• 如果需要关系类功能 Amazon Aurora
内存内存储/缓存 • Amazon ElastiCache
时序数据 • Amazon Timestream
跟踪各应用程序变更、加密可验证性。具备中央可信权威 • Amazon Quantum Ledger Database (QLDB)
不具备中央可信权威 • Amazon Managed Blockchain
数据仓库与商务智能 • Amazon Redshift, Amazon Redshift Spectrum, and Amazon QuickSight
在 AWS 或本地设施中即席分析数据 • Amazon Athena and Amazon QuickSight
Apache Spark, Hadoop, HBase
(在海量数据中查询少部分内容)• Amazon EMR
日志分析、运营监控与搜索 • Amazon Elasticsearch Service
实时分析 • Amazon Kinesis and Amazon Managed Streaming for Kafka
© 2020, Amazon Web Services, Inc. or its affiliates. All rights reserved.
我们希望您在这里找到感兴趣的内容!
也请帮助我们完成投票打分和反馈问卷。
欲获取关于 AWS 的更多信息和技术内容,可以通过以下方式找到我们:
感谢参加 AWS INNOVATE 2020 在线技术大会
微信订阅号:AWS 云计算(awschina)
新浪微博:https://www.weibo.com/amazonaws/
视频中心:http://aws.amazon.bokecc.com/
更多线上活动 :https://aws.amazon.com/cn/about-aws/events/webinar/
微信服务号:AWS Builder 俱乐部(amazonaws)
抖音:亚马逊云计算(抖音号:266052872)
博客:https://aws.amazon.com/cn/blogs/china/
AWS 中国账户注册
AWS 全球账户注册