Share via


az postgres server replica

Manage read replicas.

Commands

Name Description Type Status
az postgres server replica create

Create a read replica for a server.

Core GA
az postgres server replica list

List all read replicas for a given server.

Core GA
az postgres server replica stop

Stop replication to a read replica and make it a read/write server.

Core GA

az postgres server replica create

Create a read replica for a server.

az postgres server replica create --name
                                  --resource-group
                                  --source-server
                                  [--location]
                                  [--no-wait]
                                  [--sku-name]

Examples

Create a read replica 'testreplsvr' for 'testsvr'.

az postgres server replica create -n testreplsvr -g testgroup -s testsvr

Create a read replica 'testreplsvr' for 'testsvr2', where 'testreplsvr' is in a different resource group.

az postgres server replica create -n testreplsvr -g testgroup \
    -s "/subscriptions/${SubID}/resourceGroups/${ResourceGroup}/providers/Microsoft.DBforPostgreSQL/servers/testsvr2"

Required Parameters

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--source-server -s

The name or resource ID of the master server to the create replica for.

Optional Parameters

--location -l

Location. Values from: az account list-locations. If not provided, the create replica will be in the same location as the master server.

--no-wait

Do not wait for the long-running operation to finish.

Default value: False
--sku-name

The name of the sku. Follows the convention {pricing tier}{compute generation}{vCores} in shorthand. Examples: B_Gen5_1, GP_Gen5_4, MO_Gen5_16.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres server replica list

List all read replicas for a given server.

az postgres server replica list [--ids]
                                [--resource-group]
                                [--server-name]
                                [--subscription]

Examples

List all read replicas for master server 'testsvr'.

az postgres server replica list -g testgroup -s testsvr

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--server-name -s

Name of the master server.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.

az postgres server replica stop

Stop replication to a read replica and make it a read/write server.

az postgres server replica stop [--ids]
                                [--name]
                                [--resource-group]
                                [--subscription]
                                [--yes]

Examples

Stop replication to 'testreplsvr' and make it a read/write server.

az postgres server replica stop -g testgroup -n testreplsvr

Optional Parameters

--ids

One or more resource IDs (space-delimited). It should be a complete resource ID containing all information of 'Resource Id' arguments. You should provide either --ids or other 'Resource Id' arguments.

--name -n

Name of the server. The name can contain only lowercase letters, numbers, and the hyphen (-) character. Minimum 3 characters and maximum 63 characters.

--resource-group -g

Name of resource group. You can configure the default group using az configure --defaults group=<name>.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--yes -y

Do not prompt for confirmation.

Default value: False
Global Parameters
--debug

Increase logging verbosity to show all debug logs.

--help -h

Show this help message and exit.

--only-show-errors

Only show errors, suppressing warnings.

--output -o

Output format.

Accepted values: json, jsonc, none, table, tsv, yaml, yamlc
Default value: json
--query

JMESPath query string. See http://jmespath.org/ for more information and examples.

--subscription

Name or ID of subscription. You can configure the default subscription using az account set -s NAME_OR_ID.

--verbose

Increase logging verbosity. Use --debug for full debug logs.