开发者学堂课程【玩转云上智能运维:ECS 数据备份新特性及最佳实践】学习笔记,与课程紧密联系,让用户快速学习知识。
课程地址:https://developer.aliyun.com/learning/course/118/detail/1975
ECS 数据备份新特性及最佳实践
目录
1.快照极速可用特性
特性演示
案例介绍
2.一致性快照组
案例介绍
3. 总结思考
1.快照极速可用特性
极速可用特性
——秒级,非一致性数据备份
(一) 特性:
快照秒级可用
云盘回滚性能 0 损失
ESSD 增值特性
全地域支持
典型场景:
DevOps
快速搭建测试环境
业务保护
关键配置变更保护
云盘回滚
核心业务无损回滚
特性演示:几秒钟复制出新磁盘
玩转 ECS 之数据保护,快照慢速可用特性演示
smapshot_with_36 id " ecs.create_snepshot_with_1a(client,"d-uf6ndmmty7]59L*****')
dtsk_id = ecs.create_disk_by_snspshot(client, snapshot_with_is_id)
ecs.ettach_d1sk(ctient, disk_1d,"1-uf63vsq8cu8qnc******')
ledef creete_snepshot_with_1s(client, disk_1d):
roquest Rpciequest("Ecs',‘2014-85-26','CreateSnapshot','acs')
request.add_query_paran("DiskId', disk_id)
request.add_query_paran('RegionId',*cn-shangha1-eu13-a31')
request.add_query_paran('Zoneld",'en-shanghsi-g']
request.edd_query_peran('Description','test_1a_ee1)
roquest.add_query_Paran('SnapsnotMano','test_ia_nano_eai')
request.add_query_paran('InstantAccess', True)
request.add_query_paran("InstantActessRetentionDays', 1)
request.add_query_paran('Retentioniays',3)
response = cllent.do_action_with_exception(request)
json_rosponse = json.londs(response】
snepshot_id = json_response.get('Snapshatiu')
print response
print snapshot_id
return snapshot_1o
(二) 案例:自建数据库,磁盘空间不够,怎么办?
解法一:纯人工
1.对要扩容的磁盘先打快照。(几分钟、几个小
时、几天不等)
2.通过控制台对磁盘做在线扩容。
3.登录 ECS 实例
4.找到相应的磁盘进行:扩展分区和文件系统的
各种命令的操作。
缺点:
耗时很久,1-2 小时
容易弄错
[root eoubost -1*
Eusk a 78
Welcome to fdisk (utii-Iinux 2.23.2)
Changee vill remain in menory ooly, until you deoide to vrite them.
Be cereful before using the write command,
Comnand (n for helpiD
Diek /dev/vdb:42.9 GB,42949672960 bytes,
3006000 eeotore
Unite - Bectora of 1 * 512 - 512 bytes
Sector elze (logleal/phyelenly: 512|
T/O Blze (mLnimun/optimaly: 512 bytes / 512 bytee
Diak Labal type: doa
Diek identitier: 0x9277b47D
Device Boot Stert End Blocke Ia Syetem
/dev/vdb1 2048 41943039 20970496 83 Zinox
Cemmand (n for help):@
Seleoted portitdon
Partitton 1 is deleted
Command (n for helpi:可
Disk /dev/ydb: 42.9 CB,42949672960 bytes,
Unite - seotors of 1 * 512- S12 bytee
Sector size (logieal/physicaly: S12 bytes /
I/0 site (minimum/optimaly: 522
bytes / S12 byter
Diek Label typei dos
Dick ideotifieri 0x9277b47b
Device Boot Start End Blocke Ia Syatem
Connand (n for helpi:网
The partition table has boon altered!
Calling Loctl() to re-read pertition table.
MArMTMG: Re-reading the partition table fafied with.
"The-kornet atin uses the ofd table. The now tnble whitb
the next raboot or after you run portprobe(a) or kpare
syncing dimka.
解法二:OOS 一键扩容——內幕解密
1.快照的极速可用特性。
2.云助手执行扩展分区的命令。
3.磁盘的序列号。
磁盘序列号:
DescribeDisks:返回 SerialNumber
GuestOS 运行命令获取:udevadm info
Odef creste_snapshot_with_ip(elient, disk_id):
request = RpcRequest("Ecs','2014-85-26','CreateSnapshot','ecs')
roquest.add_quary_paran('DiskId', disk 1o)
request.add_query_paran('RegianId','cn-shanghaf-eu13-a02')
request.add_query_paran('ZoneId','cn-shangha1-g')
Poquest.add_query_paran('Description','test_ia_anl')
request.edd_query_paran('Snepshotkane',"test_1a_nane_as?')
roquest.add_quary_Paran('InstantAccoss', Truo)
request.add_query_paran('InstantaccessRetentIonDsys', 1)
request.add_query_paran("RetentionDays',3)
response s client.do_action_with_exception(request)
js0n_response = jsen.Logds(response)
snapsnot_id = jton_rosponse.get('$napshotre'】
print response
[rootfecs-]" edevadn Snfo --query-all
c--nene-/dev/vda | grep ID_SERINL
Zi ID_SERIA-bpld4fob3efgbat1.…
return snapshot_id
2.一致性快照组
(一) 一致性快照
——崩溃—致性数据备份
特点:
多云盘 IO 写入一致性
ESSD 云盘增值特性
势力级别保护
功能免费
适用场景:
企业上云
实例级别整机保护
自建数据库
跨多云盘数据保护
SAP HANA
整机—致性保护
(二) 案例:自建数据库,多数据盘
优点:
1.日志和数据读写隔离
2.性能、稳定性提升
最佳实践之一:
ROS
3.最佳实践总结
案例:自建数据库,多数据盘,自动扩容磁盘
• ROS 搭建标准化环境
•云监控发现磁盘空间不足
•通过 OOS—键扩容磁盘空间
新特性总结
极速可用
OOS
云助手
磁盘序列号
非一致性备份
一致性快照
• ROS
•多盘
崩溃一致性备份