Azure PostgreSQL Flexible server - AZ command line to failover

subhash-DBA 135 Reputation points
2024-10-01T01:33:02.9333333+00:00

HI Team,

Ca someone advise me the Azure CLI commands to do below for Azure PostgreSQL Flexible server

  1. Planned failover
  2. Forced failover

I am not very sure with the following commands from here - https://learn.microsoft.com/en-us/cli/azure/postgres/flexible-server?view=azure-cli-latest#az-postgres-flexible-server-restart

The reason being, why a forced/planned failover require 'restart'? the "failover planned" and "failover forced " are part of the restart command. is it the right way to do it?

az postgres flexible-server restart --resource-group testGroup --name testserver --failover Planned

az postgres flexible-server restart --resource-group testGroup --name testserver --failover Forced

Azure Database for PostgreSQL
{count} votes

Accepted answer
  1. NIKHILA NETHIKUNTA 4,600 Reputation points Microsoft External Staff
    2024-10-01T05:05:59.8766667+00:00

    @subhash-DBA
    Thank you for the question and for using Microsoft Q&A platform.
    The commands you mentioned for planned and forced failover are indeed correct. In Azure PostgreSQL Flexible Server, failover operations are integrated into the restart command. This is because a failover involves switching the primary server to a standby server, which inherently requires a restart of the server to complete the process.

    Why Restart is Required:

    Planned Failover: This is used for maintenance or testing purposes and ensures minimal downtime by gracefully switching the primary server to the standby server.

    Forced Failover: This is used in emergency situations where the primary server is unresponsive. It forces the failover to the standby server, which might result in some data loss but ensures high availability.

    The restart command with the --failover option ensures that the failover process is handled correctly, maintaining the integrity and availability of your database.

    Hope this helps. Do let us know if you have any further queries.


    If this answers your query, do click Accept Answer and Yes for was this answer helpful. And, if you have any further query do let us know.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.