使用 PowerShell 重启 Azure Database for PostgreSQL 服务器Restart Azure Database for PostgreSQL server using PowerShell

本主题介绍如何重启 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 during the operation.

如果服务处于繁忙状态,则会阻止重启服务器。The server restart is blocked if the service is busy. 例如,服务可能正在处理先前请求的操作(例如缩放 vCore)。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, you need:

重要

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

使用 Connect-AzAccount cmdlet 连接到 Azure 帐户。Connect to your Azure account using the Connect-AzAccount cmdlet.

重启服务器Restart the server

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

Restart-AzPostgreSqlServer -Name mydemoserver -ResourceGroupName myresourcegroup

后续步骤Next steps