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

备注

将要查看的是 Azure Database for MySQL 的新服务。You are viewing the new service of Azure Database for MySQL. 若要查看经典 MySQL Database for Azure 的文档,请访问此页To view the documentation for classic MySQL Database for Azure, please visit this page.

本文介绍如何将 Azure Database for MySQL 服务器存储配置为在不影响工作负荷的情况下增长。This article describes how you can configure an Azure Database for MySQL 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 how-to guide:

  • 如果需要,请安装 Azure CLI 来运行 CLI 参考命令。If you prefer, install the Azure CLI to run CLI reference commands.
    • 如果使用的是本地安装,请通过 Azure CLI 使用 az login 命令登录。If you're using a local install, sign in with Azure CLI by using the az login command. 若要完成身份验证过程,请遵循终端中显示的步骤。To finish the authentication process, follow the steps displayed in your terminal. 有关其他登录选项,请参阅使用 Azure CLI 登录See Sign in with Azure CLI for additional sign-in options.
    • 出现提示时,请在首次使用时安装 Azure CLI 扩展。When you're prompted, install Azure CLI extensions on first use. 有关扩展详细信息,请参阅使用 Azure CLI 的扩展For more information about extensions, see Use extensions with 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.

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

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

az mysql 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 mysql 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 5.7

后续步骤Next steps

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