The
postgresql.conffile for environments running AlloyDB Omni on a VM.The database cluster manifest for environments running AlloyDB Omni on a Kubernetes cluster.
Update a parameter in containerized AlloyDB Omni
In an AlloyDB Omni running on a VM, you can update a parameter by editing the postgresql.conf file as follows:
Locate the
postgresql.confconfiguration file for your installation of AlloyDB Omni.Use a text editor to add or update a database flag in
postgresql.conf.For example, to enforce password expiration, set the following flag in the
postgresql.conffile:password.enforce_expiration = ONAfter your database flags are added or edited, reload the
postgresql.conffile for the changes to take effect. For example, if you installed AlloyDB Omni using Docker, run the following to restart your Docker instance and reloadpostgresql.conf:docker restart CONTAINER-NAME
For more information, see Setting parameters in PostgreSQL documentation.
Update a parameter in AlloyDB Omni on a Kubernetes cluster
You can configure database parameters using the parameters field in the primarySpec section of your database cluster manifest:
spec:
primarySpec:
parameters:
"PARAMETER_NAME": "PARAMETER_VALUE"
...
Replace the following:
PARAMETER_NAME: the name of the parameter—for example,autovacuum.PARAMETER_VALUE: the value of the parameter—for example,off.
Some parameters require you to restart your cluster for the changes to take effect. You can obtain a list of parameters that require a restart from pg_catalog.pg_settings. Any parameter with pg_catalog.pg_settings.context = 'postmaster' requires a restart.
To update database parameters, run the following command:
kubectl patch dbclusters.alloydbomni.dbadmin.goog dbcluster-sample -p '{"spec":{"primarySpec":{"parameters": {"PARAMETER_NAME": "PARAMETER_VALUE"}}}}' --type=mergeParameter settings are located in the status part of the currentParameters field.
To view database parameters, run the following:
kubectl get dbclusters.alloydbomni.dbadmin.goog dbcluster-sample -o jsonpath={.status.primary.currentParameters}The output looks similar to the following:
{"autovacuum":"off","max_connections":"3000"}
If AlloyDB Omni cannot apply the parameters that you request in the database cluster manifest, then the values for the currentParameters field can differ from the values in the parameters field of your manifest. For example, you apply a non-existent parameter or you set a string value to an integer parameter.