Nota:
El acceso a esta página requiere autorización. Puede intentar iniciar sesión o cambiar directorios.
El acceso a esta página requiere autorización. Puede intentar cambiar los directorios.
若要扩展可用存储,Azure 虚拟机规模集支持具有附加数据磁盘的 VM 实例。 可以在创建规模集时附加数据磁盘,也可以将数据磁盘附加到现有规模集。
在规模集中创建和管理磁盘
有关如何创建包含附加数据磁盘的规模集、准备和格式化或添加和删除数据磁盘的详细信息,请参阅以下教程之一:
本文的其余部分概述了具体的用例,例如需要数据磁盘的 Service Fabric 群集,或者将包含内容的现有数据磁盘附加到规模集。
使用附加的数据磁盘创建 Service Fabric 群集
在 Azure 中运行的 Service Fabric 群集中的每种 节点类型 都由虚拟机规模集支持。 使用Azure 资源管理器模板,可以将数据磁盘附加到构成服务Fabric群集的规模集。 可以使用 存在的模板作为起点。 在模板中,在 storageProfile 部分包括 dataDisks,在 Microsoft.Compute/virtualMachineScaleSets 资源中,并部署模板。 以下示例附加一个 128 GB 的数据磁盘:
"dataDisks": [
{
"diskSizeGB": 128,
"lun": 0,
"createOption": "Empty"
}
]
可以在部署群集时自动对数据磁盘执行分区、格式化和装载操作。 向 extensionProfile 的 virtualMachineProfile 的规模集添加自定义脚本扩展。
若要在Windows群集中自动准备数据磁盘,请添加以下内容:
{
"name": "customScript",
"properties": {
"publisher": "Microsoft.Compute",
"type": "CustomScriptExtension",
"typeHandlerVersion": "1.8",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"https://raw.githubusercontent.com/Azure-Samples/compute-automation-configurations/master/prepare_vm_disks.ps1"
],
"commandToExecute": "powershell -ExecutionPolicy Unrestricted -File prepare_vm_disks.ps1"
}
}
}
若要自动准备 Linux 群集中的数据磁盘,请添加以下代码:
{
"name": "lapextension",
"properties": {
"publisher": "Microsoft.Azure.Extensions",
"type": "CustomScript",
"typeHandlerVersion": "2.0",
"autoUpgradeMinorVersion": true,
"settings": {
"fileUris": [
"https://raw.githubusercontent.com/Azure-Samples/compute-automation-configurations/master/prepare_vm_disks.sh"
],
"commandToExecute": "bash prepare_vm_disks.sh"
}
}
}
将预先填充的数据磁盘添加到现有规模集
规模集模型中指定的数据磁盘始终为空。 然而,您可以将现有的数据磁盘附加到规模集中的特定 VM。 如果您希望将数据分发到规模集中的所有 VM,可以复制您的数据磁盘并将其附加到规模集中的每个 VM,或者创建一个包含数据的自定义映像,并从这个自定义映像预配规模集,还可以使用 Azure 文件存储 或类似的数据存储产品。
其他注释
API 版本 2016-04-30-preview 或更高版本的 Microsoft.Compute API 支持 Azure 托管磁盘和扩展集中附加的数据磁盘。
Azure规模集中附加数据磁盘的门户支持受到限制。 根据要求,可以使用Azure模板、CLI、PowerShell、SDK 和 REST API 来管理附加磁盘。