Skip to content

Commit 19e6231

Browse files
Merge pull request #270985 from nachoalonsoportillo/patch-47
Describe how to list read replicas via CLI and REST API
2 parents 41e12da + 6168c13 commit 19e6231

File tree

1 file changed

+104
-5
lines changed

1 file changed

+104
-5
lines changed

articles/postgresql/flexible-server/how-to-read-replicas-portal.md

Lines changed: 104 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Learn how to manage read replicas for Azure Database for PostgreSQL
44
author: AlicjaKucharczyk
55
ms.author: alkuchar
66
ms.reviewer: maghan
7-
ms.date: 01/17/2024
7+
ms.date: 04/02/2024
88
ms.service: postgresql
99
ms.subservice: flexible-server
1010
ms.custom: ignite-2023, devx-track-azurecli
@@ -337,10 +337,21 @@ az postgres flexible-server replica create \
337337

338338
Replace `<replica-name>`, `<resource-group>`, `<source-server-name>` and `<location>` with your specific values.
339339

340+
After the read replica is created, the properties of all servers which are replicas of a primary replica can be obtained by using the [`az postgres flexible-server replica create`](/cli/azure/postgres/flexible-server/replica#az-postgres-flexible-server-replica-list) command.
341+
342+
```azurecli-interactive
343+
az postgres flexible-server replica list \
344+
--name <source-server-name> \
345+
--resource-group <resource-group>
346+
```
347+
348+
Replace `<source-server-name>`, and `<resource-group>` with your specific values.
349+
350+
340351

341352
#### [REST API](#tab/restapi)
342353

343-
Initiate an `HTTP PUT` request by using the [create API](/rest/api/postgresql/flexibleserver/servers/create):
354+
Initiate an `HTTP PUT` request by using the [servers create API](/rest/api/postgresql/flexibleserver/servers/create):
344355

345356
```http
346357
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{replicaserverName}?api-version=2022-12-01
@@ -358,6 +369,94 @@ Here, you need to replace `{subscriptionId}`, `{resourceGroupName}`, and `{repli
358369
}
359370
```
360371

372+
After the read replica is created, the properties of all servers which are replicas of a primary replica can be obtained by initiating an `HTTP GET` request by using [replicas list by server API](/rest/api/postgresql/flexibleserver/replicas/list-by-server):
373+
374+
```http
375+
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{sourceserverName}/replicas?api-version=2022-12-01
376+
```
377+
378+
Here, you need to replace `{subscriptionId}`, `{resourceGroupName}`, and `{sourceserverName}` with your specific Azure subscription ID, the name of your resource group, and the name you assigned to your primary replica, respectively.
379+
380+
```json
381+
[
382+
{
383+
"administratorLogin": null,
384+
"administratorLoginPassword": null,
385+
"authConfig": null,
386+
"availabilityZone": null,
387+
"backup": {
388+
"backupRetentionDays": null,
389+
"earliestRestoreDate": "2023-11-23T12:55:33.3443218+00:00",
390+
"geoRedundantBackup": "Disabled"
391+
},
392+
"createMode": null,
393+
"dataEncryption": {
394+
"geoBackupEncryptionKeyStatus": null,
395+
"geoBackupKeyUri": null,
396+
"geoBackupUserAssignedIdentityId": null,
397+
"primaryEncryptionKeyStatus": null,
398+
"primaryKeyUri": null,
399+
"primaryUserAssignedIdentityId": null,
400+
"type": "SystemManaged"
401+
},
402+
"fullyQualifiedDomainName": null,
403+
"highAvailability": null,
404+
"id": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{replicaserverName}",
405+
"identity": null,
406+
"location": "eastus",
407+
"maintenanceWindow": {
408+
"customWindow": "Disabled",
409+
"dayOfWeek": 0,
410+
"startHour": 0,
411+
"startMinute": 0
412+
},
413+
"minorVersion": null,
414+
"name": "{replicaserverName}",
415+
"network": {
416+
"delegatedSubnetResourceId": null,
417+
"privateDnsZoneArmResourceId": null,
418+
"publicNetworkAccess": "Disabled"
419+
},
420+
"pointInTimeUtc": null,
421+
"privateEndpointConnections": null,
422+
"replica": {
423+
"capacity": null,
424+
"promoteMode": null,
425+
"promoteOption": null,
426+
"replicationState": "Active",
427+
"role": "AsyncReplica"
428+
},
429+
"replicaCapacity": null,
430+
"replicationRole": "AsyncReplica",
431+
"resourceGroup": "{resourceGroupName}",
432+
"sku": {
433+
"name": "",
434+
"tier": null
435+
},
436+
"sourceServerResourceId": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/flexibleServers/{serverName}",
437+
"state": "Ready",
438+
"storage": {
439+
"autoGrow": "Disabled",
440+
"iops": null,
441+
"storageSizeGb": 0,
442+
"throughput": null,
443+
"tier": null,
444+
"type": null
445+
},
446+
"systemData": {
447+
"createdAt": "2023-11-22T17:11:42.2461489Z",
448+
"createdBy": null,
449+
"createdByType": null,
450+
"lastModifiedAt": null,
451+
"lastModifiedBy": null,
452+
"lastModifiedByType": null
453+
},
454+
"tags": null,
455+
"type": "Microsoft.DBforPostgreSQL/flexibleServers",
456+
"version": null
457+
}
458+
]
459+
```
361460
---
362461

363462
- Set the replica server name.
@@ -675,7 +774,7 @@ Replace `<resource-group>`, `<source-server-name>` and `<location>` with your sp
675774

676775
#### [REST API](#tab/restapi)
677776

678-
You can create a secondary read replica by using the [create API](/rest/api/postgresql/flexibleserver/servers/create):
777+
You can create a secondary read replica by using the [servers create API](/rest/api/postgresql/flexibleserver/servers/create):
679778

680779
```http
681780
PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{replicaserverName}?api-version=2022-12-01
@@ -891,7 +990,7 @@ az postgres flexible-server delete \
891990
Replace `<resource-group>` and `<server-name>` with the name of your resource group name and the replica server name you wish to delete.
892991

893992
#### [REST API](#tab/restapi)
894-
To delete a primary or replica server, use the [delete API](/rest/api/postgresql/flexibleserver/servers/delete). If server has read replicas then read replicas should be deleted first before deleting the primary server.
993+
To delete a primary or replica server, use the [servers delete API](/rest/api/postgresql/flexibleserver/servers/delete). If server has read replicas then read replicas should be deleted first before deleting the primary server.
895994

896995
```http
897996
DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{replicaserverName}?api-version=2022-12-01
@@ -929,7 +1028,7 @@ az postgres flexible-server delete \
9291028
Replace `<resource-group>` and `<server-name>` with the name of your resource group name and the primary server name you wish to delete.
9301029

9311030
#### [REST API](#tab/restapi)
932-
To delete a primary or replica server, use the [delete API](/rest/api/postgresql/flexibleserver/servers/delete). If server has read replicas then read replicas should be deleted first before deleting the primary server.
1031+
To delete a primary or replica server, use the [servers delete API](/rest/api/postgresql/flexibleserver/servers/delete). If server has read replicas then read replicas should be deleted first before deleting the primary server.
9331032

9341033
```http
9351034
DELETE https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql/flexibleServers/{sourceserverName}?api-version=2022-12-01

0 commit comments

Comments
 (0)