You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- more descriptive steps for BLOB rbac
- added fixes for HA
- updated values for performance
- reworked codeblocks for ease of copy/paste
- fixed outputs to match text and desired state
Copy file name to clipboardExpand all lines: articles/aks/create-postgresql-ha.md
+10-1Lines changed: 10 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -141,13 +141,22 @@ The CNPG operator automatically generates a service account called *postgres* th
141
141
--auth-mode login
142
142
```
143
143
144
+
Example output:
145
+
146
+
```output
147
+
{
148
+
"created": true
149
+
}
150
+
```
151
+
144
152
> [!NOTE]
145
-
> If you encounter the error message: `The request may be blocked by network rules of storage account. Please check network rule set using 'az storage account show -n accountname --query networkRuleSet'. If you want to change the default action to apply when no rule matches, please use 'az storage account update'`. Please verify user permissions for Azure Blob Storage and, if**necessary**, elevate your role to `Storage Blob Data Owner` using the commands provided below.
153
+
> If you encounter the error message: `The request may be blocked by network rules of storage account. Please check network rule set using 'az storage account show -n accountname --query networkRuleSet'. If you want to change the default action to apply when no rule matches, please use 'az storage account update'`. Please verify user permissions for Azure Blob Storage and, if**necessary**, elevate your role to `Storage Blob Data Owner` using the commands provided below and after retry the [`az storage container create`][az-storage-container-create] command.
146
154
147
155
```bash
148
156
az role assignment list --scope $STORAGE_ACCOUNT_PRIMARY_RESOURCE_ID --output table
149
157
150
158
export USER_ID=$(az ad signed-in-user show --query id --output tsv)
159
+
151
160
export STORAGE_ACCOUNT_PRIMARY_RESOURCE_ID=$(az storage account show \
@@ -142,8 +142,14 @@ The following table outlines the key properties set in the YAML deployment manif
142
142
azure.workload.identity/use: "true"
143
143
144
144
instances: 3
145
+
startDelay: 30
146
+
stopDelay: 30
145
147
minSyncReplicas: 1
146
148
maxSyncReplicas: 1
149
+
replicationSlots:
150
+
highAvailability:
151
+
enabled: true
152
+
updateInterval: 30
147
153
148
154
topologySpreadConstraints:
149
155
- maxSkew: 1
@@ -159,11 +165,11 @@ The following table outlines the key properties set in the YAML deployment manif
159
165
160
166
resources:
161
167
requests:
162
-
memory: '2Gi'
163
-
cpu: 1.5
168
+
memory: '8Gi'
169
+
cpu: 2
164
170
limits:
165
-
memory: '2Gi'
166
-
cpu: 1.5
171
+
memory: '8Gi'
172
+
cpu: 2
167
173
168
174
bootstrap:
169
175
initdb:
@@ -196,15 +202,25 @@ The following table outlines the key properties set in the YAML deployment manif
196
202
monitoring:
197
203
enablePodMonitor: true
198
204
199
-
replicationSlots:
200
-
highAvailability:
201
-
enabled: true
202
-
203
205
postgresql:
204
206
parameters:
205
-
shared_buffers: "256MB"
206
-
effective_cache_size: "512MB"
207
-
# max_worker_processes: 64
207
+
archive_timeout: '5min'
208
+
auto_explain.log_min_duration: '10s'
209
+
checkpoint_completion_target: '0.9'
210
+
checkpoint_timeout: '15min'
211
+
shared_buffers: '256MB'
212
+
effective_cache_size: '512MB'
213
+
pg_stat_statements.max: '1000'
214
+
pg_stat_statements.track: 'all'
215
+
max_connections: '400'
216
+
max_prepared_transactions: '400'
217
+
max_parallel_workers: '32'
218
+
max_parallel_maintenance_workers: '8'
219
+
max_parallel_workers_per_gather: '8'
220
+
max_replication_slots: '32'
221
+
max_worker_processes: '32'
222
+
wal_keep_size: '512MB'
223
+
max_wal_size: '1GB'
208
224
pg_hba:
209
225
- host all all all scram-sha-256
210
226
@@ -228,7 +244,7 @@ The following table outlines the key properties set in the YAML deployment manif
228
244
1. Validate that the primary PostgreSQL cluster was successfully created using the [`kubectl get`][kubectl-get] command. The CNPG Cluster CRD specified three instances, which can be validated by viewing running pods once each instance is brought up and joined for replication. Be patient as it can take some time for all three instances to come online and join the cluster.
229
245
230
246
```bash
231
-
kubectl get pods --context $AKS_PRIMARY_CLUSTER_NAME --namespace $PG_NAMESPACE
247
+
kubectl get pods --context $AKS_PRIMARY_CLUSTER_NAME --namespace $PG_NAMESPACE -l cnpg.io/cluster=$PG_PRIMARY_CLUSTER_NAME
232
248
```
233
249
234
250
Example output
@@ -292,7 +308,7 @@ Verify that the pod monitor is created (note the difference in the group name).
292
308
kubectl --namespace $PG_NAMESPACE \
293
309
--context $AKS_PRIMARY_CLUSTER_NAME \
294
310
get podmonitors.azmonitoring.coreos.com \
295
-
$PG_PRIMARY_CLUSTER_NAME \
311
+
-l cnpg.io/cluster=$PG_PRIMARY_CLUSTER_NAME \
296
312
-o yaml
297
313
```
298
314
@@ -361,7 +377,9 @@ In this section, you create a table and insert some data into the app database t
@@ -403,17 +448,20 @@ In this section, you create a table and insert some data into the app database t
403
448
1. Validate that the PostgreSQL cluster can access the Azure storage account specified in the CNPG Cluster CRD and that `Working WAL archiving` reports as `OK` using the following command:
404
449
405
450
```bash
406
-
kubectl cnpg status $PG_PRIMARY_CLUSTER_NAME 1 --context $AKS_PRIMARY_CLUSTER_NAME --namespace $PG_NAMESPACE
451
+
kubectl cnpg status $PG_PRIMARY_CLUSTER_NAME 1 \
452
+
--context $AKS_PRIMARY_CLUSTER_NAME \
453
+
--namespace $PG_NAMESPACE
407
454
```
408
455
409
456
Example output
410
457
411
458
```output
412
459
Continuous Backup status
413
460
First Point of Recoverability: Not Available
414
-
Working WAL archiving: FAILING
461
+
Working WAL archiving: OK
415
462
WALs waiting to be archived: 0
416
-
Last Archived WAL: 000000010000000000000009 @ 2024-06-05T13:39:23.597668Z
463
+
Last Archived WAL: 00000001000000000000000A @ 2024-07-09T17:18:13.982859Z
464
+
Last Failed WAL: -
417
465
```
418
466
419
467
1. Deploy an on-demand backup to Azure Storage, which uses the AKS workload identity integration, using the YAML file with the [`kubectl apply`][kubectl-apply] command.
@@ -436,7 +484,9 @@ In this section, you create a table and insert some data into the app database t
436
484
1. Validate the status of the on-demand backup using the [`kubectl describe`][kubectl-describe] command.
1. You can now delete the federated identity credential using the [`az identity federated-credential delete`][az-identity-federated-credential-delete] command.
@@ -645,7 +712,10 @@ You also retrieve the following endpoints from the Cluster IP service:
645
712
1. Get the Cluster IP service details using the [`kubectl get`][kubectl-get] command.
646
713
647
714
```bash
648
-
kubectl get services --context $AKS_PRIMARY_CLUSTER_NAME --namespace $PG_NAMESPACE -l cnpg.io/cluster=$PG_PRIMARY_CLUSTER_NAME
715
+
kubectl get services \
716
+
--context $AKS_PRIMARY_CLUSTER_NAME \
717
+
--namespace $PG_NAMESPACE \
718
+
-l cnpg.io/cluster=$PG_PRIMARY_CLUSTER_NAME
649
719
```
650
720
651
721
Example output
@@ -767,19 +837,27 @@ Remember that the primary read-write endpoint maps to TCP port 5432 and the read
0 commit comments