使用 Azure CLI 重启 Azure Database for PostgreSQL - 单一服务器Restart Azure Database for PostgreSQL - Single Server using the Azure CLI

本主题介绍如何重启 Azure Database for PostgreSQL 服务器。This topic describes how you can restart an Azure Database for PostgreSQL server. 出于维护原因,可能需要重启服务器,这会在服务器执行操作时导致短暂中断。You may need to restart your server for maintenance reasons, which causes a short outage as the server performs the operation.

如果服务处于繁忙状态,则会阻止重启服务器。The server restart will be blocked if the service is busy. 例如,服务可以处理缩放 vCores 等先前请求的操作。For example, the service may be processing a previously requested operation such as scaling vCores.

备注

完成重启所需的时间取决于 PostgreSQL 恢复过程。The time required to complete a restart depends on the PostgreSQL recovery process. 若要减少重启时间,建议在重启之前尽量减少服务器上发生的活动量。To decrease the restart time, we recommend you minimize the amount of activity occurring on the server prior to the restart. 你可能还需要增加检查点频率。You may also want to increase the checkpoint frequency. 还可以调整与检查点相关的参数值,包括 max_wal_sizeYou can also tune checkpoint related parameter values including max_wal_size. 还建议在重启服务器之前运行 CHECKPOINT 命令。It is also recommended to run CHECKPOINT command prior to restarting the server.

先决条件Prerequisites

若要完成本操作说明指南:To complete this how-to 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.

重启服务器Restart the server

使用以下命令重启服务器:Restart the server with the following command:

az postgres server restart --name mydemoserver --resource-group myresourcegroup

后续步骤Next steps

了解如何在 Azure Database for PostgreSQL 中设置参数Learn about how to set parameters in Azure Database for PostgreSQL