使用 Azure CLI 自动增长 Azure Database for MariaDB 存储Auto-grow Azure Database for MariaDB storage using the Azure CLI

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

达到存储限制的服务器将设置为只读。The server reaching the storage limit, is set to read-only. 如果启用了存储自动增长,则对于预配的存储大小小于 100 GB 的服务器,可用存储空间一旦小于 1 GB 或预配存储的 10%(以这二者中的较大值为准),预配的存储大小就会立即增加 5 GB。If storage auto grow is enabled then for servers with less than 100 GB provisioned storage, the provisioned storage size is increased by 5 GB as soon as the free storage is below the greater of 1 GB or 10% of the provisioned storage. 对于预配的存储大小大于 100 GB 的服务器,可用存储空间小于预配的存储大小的 5% 时,预配的存储大小就会增加 5%。For servers with more than 100 GB of provisioned storage, the provisioned storage size is increased by 5% when the free storage space is below 5% of the provisioned storage size. 此处所指定的最大存储限制适用。Maximum storage limits as specified here apply.

必备条件Prerequisites

若要完成本指南:To complete this guide:

  • 如果需要,请安装 Azure CLI 来运行 CLI 参考命令。If you prefer, install the Azure CLI to run CLI reference commands.

    • 如果使用的是本地安装,请使用 az login 命令登录到 Azure CLI。If you're using a local installation, sign in to the Azure CLI by using the az login command. 若要完成身份验证过程,请遵循终端中显示的步骤。To finish the authentication process, follow the steps displayed in your terminal. 有关其他登录选项,请参阅登录 Azure CLIFor additional sign-in options, see Sign in with the Azure CLI.

    • 出现提示时,请在首次使用时安装 Azure CLI 扩展。When you're prompted, install Azure CLI extensions on first use. 有关扩展详细信息,请参阅使用 Azure CLI 的扩展For more information about extensions, see Use extensions with the Azure CLI.

    • 运行 az version 以查找安装的版本和依赖库。Run az version to find the version and dependent libraries that are installed. 若要升级到最新版本,请运行 az upgradeTo upgrade to the latest version, run az upgrade.

  • 本文需要 Azure CLI 版本 2.0 或更高版本。This article requires version 2.0 or later of the Azure CLI.

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

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

az mariadb server update --name mydemoserver --resource-group myresourcegroup --auto-grow Enabled

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

az mariadb server create --resource-group myresourcegroup --name mydemoserver  --auto-grow Enabled --location chinaeast2 --admin-user myadmin --admin-password <server_admin_password> --sku-name GP_Gen5_2 --version 10.3

后续步骤Next steps

了解如何基于指标创建警报Learn about how to create alerts on metrics.