Configure database parameters

Select a documentation version:

This page describes how to configure database parameters using the AlloyDB Omni RPM orchestrator.

Database parameters, also known as Grand Unified Configuration (GUC) parameters, let you tune the performance and behavior of your AlloyDB Omni database cluster. For more information, see Setting parameters in the PostgreSQL documentation.

Before you begin

Before you configure database parameters, make sure that you have:

  1. Installed the AlloyDB Omni orchestrator.
  2. Provisioned and created your AlloyDB Omni cluster.

Configure database parameters

To configure database parameters, you use the parameters field within the primarySpec section of your DBCluster resource specification.

Update the resource specification

Add or modify the required parameters and their values in your DBCluster resource specification. You can do this to configure parameters during cluster creation or to update parameters after the cluster is created.

The following snippet shows examples of GUC parameters. You can configure other supported database parameters similarly:

DBCluster:
  metadata:
    name: CLUSTER_NAME
  spec:
    primarySpec:
      # ... other settings ...
      parameters:
        # ... existing parameters ...
        max_wal_size: "MAX_WAL_SIZE"
        max_connections: "MAX_CONNECTIONS_LIMIT"
        huge_pages: "HUGE_PAGES"
        log_statement: "LOG_STATEMENT"
        # ... other parameters ...

Replace the following:

  • CLUSTER_NAME: the name of your database cluster.
  • MAX_WAL_SIZE: an example parameter controlling the maximum size the WAL can grow to between automatic WAL checkpoints, for example 2GB.
  • MAX_CONNECTIONS_LIMIT: an example parameter controlling the maximum number of concurrent connections allowed to the database server, for example, 200. Minimum supported value is 50.
  • HUGE_PAGES: an example parameter controlling the use of huge pages, for example on.
  • LOG_STATEMENT: an example parameter controlling which SQL statements are logged, for example all.

Apply the configuration

Apply the changes using your preferred orchestrator interface.

Ansible

If you're managing your AlloyDB Omni RPM orchestrator infrastructure directly using Ansible, it triggers updates by running the appropriate playbook and passing the selected update_action as an extra variable.

Sample file for update.yml:

---
- hosts: all
  vars:
    update_action: "update_resource_spec"
  ansible_become: true
  ansible_user: your_ssh_user
  ansible_ssh_private_key_file: ~/path/to/private-key
  roles:
    - role: google.alloydbomni_orchestrator.update

Run the Ansible command:

ansible-playbook -i DEPLOYMENT_SPECIFICATION update.yml -e resource_spec="DBCLUSTER_SPECIFICATION"

Replace the following variables:

  • DEPLOYMENT_SPECIFICATION: path to the deployment specification you created in Install AlloyDB Omni components.

  • DBCLUSTER_SPECIFICATION: path to your cluster specification.

alloydbctl

alloydbctl apply -d DEPLOYMENT_SPECIFICATION -r DBCLUSTER_SPECIFICATION

Replace the following variables:

  • DEPLOYMENT_SPECIFICATION: path to the deployment specification you created in Install AlloyDB Omni components.

  • DBCLUSTER_SPECIFICATION: path to your cluster specification.

Verify parameter changes

After applying the configuration, you can verify that the parameters are updated using the SHOW command in psql:

SHOW PARAMETER_NAME;

Replace PARAMETER_NAME with the name of the parameter that you configured.