使用 PowerShell 实现 Azure Database for MariaDB 服务器存储的自动增长Auto grow storage in Azure Database for MariaDB server using PowerShell

本文介绍如何将 Azure Database for MariaDB 服务器存储配置为在不影响工作负荷的情况下增长。This article describes how you can configure an Azure Database for MariaDB server storage to grow without impacting the workload.

存储自动增长可防止服务器达到存储限制并变为只读。Storage auto grow prevents your server from reaching the storage limit and becoming read-only. 对于预配存储为 100 GB 或更低的服务器,当可用空间低于 10% 时,大小将增加 5 GB。For servers with 100 GB or less of provisioned storage, the size is increased by 5 GB when the free space is below 10%. 对于预配存储超过 100 GB 的服务器,当可用空间低于 10 GB 时,大小将增加 5%。For servers with more than 100 GB of provisioned storage, the size is increased by 5% when the free space is below 10 GB. 最大存储限制的应用方式遵循 Azure Database for MariaDB 定价层的存储部分内容中所指定的方式。Maximum storage limits apply as specified in the storage section of the Azure Database for MariaDB pricing tiers.

重要

请记住,存储只能增加,不能减少。Remember that storage can only be scaled up, not down.

先决条件Prerequisites

若要完成本操作指南,需要:To complete this how-to guide, you need:

重要

尽管 Az.MariaDb PowerShell 模块为预览版,但必须使用以下命令从 Az PowerShell 模块单独安装它:Install-Module -Name Az.MariaDb -AllowPrereleaseWhile the Az.MariaDb PowerShell module is in preview, you must install it separately from the Az PowerShell module using the following command: Install-Module -Name Az.MariaDb -AllowPrerelease.

如果选择在本地使用 PowerShell,请使用 Connect-AzAccount cmdlet 连接到 Azure 帐户。If you choose to use PowerShell locally, connect to your Azure account using the Connect-AzAccount cmdlet.

启用 MariaDB 服务器存储自动增长Enable MariaDB server storage auto grow

使用以下命令在现有服务器上启用服务器自动增长存储:Enable server auto grow storage on an existing server with the following command:

Update-AzMariaDbServer -Name mydemoserver -ResourceGroupName myresourcegroup -StorageAutogrow Enabled

使用以下命令创建新服务器时启用服务器自动增长存储:Enable server auto grow storage while creating a new server with the following command:

$Password = Read-Host -Prompt 'Please enter your password' -AsSecureString
New-AzMariaDbServer -Name mydemoserver -ResourceGroupName myresourcegroup -Sku GP_Gen5_2 -StorageAutogrow Enabled -Location chinaeast2 -AdministratorUsername myadmin -AdministratorLoginPassword $Password

后续步骤Next steps