Limitations
The following limitations apply:
AlloyDB Omni runs on port
5432. Configuring a custom port is not supported.Ensure that all database parameter configurations are correct before creating your cluster. Once your cluster is created, you cannot modify any database parameters.
Before you begin
Before you create your cluster, complete the following:
Mount an external volume (
DataDisk) to PG_DATA_DIR on all database nodes provisioned within the orchestrator.If you plan to use
alloydbctlinstead of Ansible, ensure that the requiredpolicycoreutils-python-utilspackage is installed on all of your VMs. To install this package, run the following command:sudo dnf install policycoreutils-python-utils
Prepare cluster specifications
To create your cluster, AlloyDB Omni must know how to configure
it. To create the necessary specifications, create a YAML file using the
DBCluster format:
Secret:
metadata:
name: db-pw-DBCLUSTER_NAME
spec:
type: Opaque
data:
DBCLUSTER_NAME: BASE64_PASSWORD
---
DBCluster:
metadata: DBCLUSTER_NAME
name:
spec:
databaseVersion: 18.1.0
mode: ""
availability:
numberOfStandbys: NUM_STANDBY_NODES
enableAutoFailover: true
enableAutoHeal: true
autoFailoverTriggerThreshold: AUTOFAILOVER_TRIGGER_THRESHOLD
autoHealTriggerThreshold: AUTOHEAL_TRIGGER_THRESHOLD
healthcheckPeriodSeconds: HEALTHCHECK_PERIOD
replayReplicationSlotsOnStandbys: false
primarySpec:
adminUser:
passwordRef:
name: db-pw-DBCLUSTER_NAME
resources:
cpu: CPU_LIMIT
memory: MEMORY_LIMIT
disks:
- name: DataDisk
path: PG_DATA_DIR
parameters:
max_connections: "MAX_CONNECTIONS"
max_wal_size: "MAX_WAL_SIZE"
max_worker_processes: "MAX_WORKER_PROCESSES"
log_connections: "LOG_CONNECTIONS"
log_disconnections: "LOG_DISCONNECTS"
log_hostname: "LOG_HOSTNAME"
log_statement: "LOG_STATEMENT"
huge_pages: "HUGE_PAGES"
tcp_keepalives_idle: "TCP_KEEPALIVES_IDLE"
tcp_keepalives_interval: "TCP_KEEPALIVES_INTERVAL"
tcp_keepalives_count: "TCP_KEEPALIVES_COUNT"
dbLoadBalancerOptions:
DB_LOAD_BALANCER_TYPE:
loadBalancerIP: "VIRTUAL_IP"
loadBalancerType: "internal"
loadBalancerInterface: "VIRTUAL_IP_INTERFACE"
Replace the following variables:
DBCLUSTER_NAME: name of your database cluster. For example,my-dbcluster.BASE64_PASSWORD: base64-encoded password used for thepostgresadministrator user.NUM_STANDBY_NODES: number of standby nodes in your cluster. For example,2.(Optional)
AUTOFAILOVER_TRIGGER_THRESHOLD: number of times the health check can fail before a failover occurs. The default value is3. The minimum value is0, but if the value is set to0, AlloyDB Omni uses the default value.An automatic failover occurs if the health check fails
AUTOFAILOVER_TRIGGER_THRESHOLDtimes or if the cumulative duration of the health check reachesHEALTHCHECK_PERIOD * AUTOFAILOVER_TRIGGER_THRESHOLDseconds.(Optional)
AUTOHEAL_TRIGGER_THRESHOLD: number of times the health check can fail before auto-heal begins. The default value is3. The minimum value is0, but if the value is set to0, AlloyDB Omni uses the default value.An automatic recovery occurs if the health check fails
AUTOHEAL_TRIGGER_THRESHOLDtimes or if the cumulative duration of the health check reachesHEALTHCHECK_PERIOD * AUTOHEAL_TRIGGER_THRESHOLDseconds.(Optional)
HEALTHCHECK_PERIOD: number of seconds to wait between each health check. The default value is30. The minimum value is1. The maximum value is86400(one day).CPU_LIMIT: number of CPUs to allocate to the database container. For example,4.MEMORY_LIMIT: amount of memory to allocate to the database container. For example,32Gi,500Mi.PG_DATA_DIR: host path to the directory where the database data will be stored.(Optional)
MAX_CONNECTIONS: maximum number of concurrent connections to the PostgreSQL database. The default value is100. For more information, see the PostgreSQLmax_connectionsreference.(Optional)
MAX_WAL_SIZE: maximum size to let the Write-Ahead-Log (WAL) grow during automatic checkpoints. The default value is2GB. For more information, see the PostgreSQLmax_wal_sizereference.(Optional)
MAX_WORKER_PROCESSES: maximum number of workers that can be started by a singleGatherorGather Merge. The default value is32. For more information, see the PostgreSQLmax_worker_processesreference.(Optional)
LOG_CONNECTIONS: determines whether or not connections to your PostgreSQL server are logged. The default value ison. For more information, see the PostgreSQLlog_connectionsreference.(Optional)
LOG_DISCONNECTS: determines if PostgreSQL session terminations are logged. The default value ison. For more information, see the PostgreSQLlog_disconnectionsreference.(Optional)
LOG_HOSTNAME: determines whether or not the hostname is logged in addition to the IP for the connecting host. The default value ison. For more information, see the PostgreSQLlog_hostnamereference.(Optional)
LOG_STATEMENT: determines which SQL statements are logged. The default value isnone. For more information, see the PostgreSQLlog_statementreference.(Optional)
HUGE_PAGES: determines if huge pages are requested for the main shared memory area. The default value isoff. For more information, see the PostgreSQLhuge_pagesreference.(Optional)
TCP_KEEPALIVES_IDLE: amount of time, in seconds, with no network activity before the OS attempts to send a TCPkeepalivemessage to the client. The default value is10. For more information, see the PostgreSQLtcp_keepalives_idlereference.(Optional)
TCP_KEEPALIVES_INTERVAL: amount of time, in seconds, before a TCPkeepalivemessage that hasn't been acknowledged by the client should be retransmitted. The default value is10. For more information, see the PostgreSQLtcp_keepalives_intervalreference.(Optional)
TCP_KEEPALIVES_COUNT: number of TCPkeepalivemessages that can be lost before the server's connection to the client is considered inactive. The default value is10. For more information, see the PostgreSQLtcp_keepalives_countreference.(Optional)
DB_LOAD_BALANCER_TYPE: determines the type of load balancer:onpremorgcp.(Optional)
VIRTUAL_IP: virtual IP address used by the load balancer. If you definedbLoadBalancerOptions, this is required. For more information, see Manage high availability.(Optional)
VIRTUAL_IP_INTERFACE: network interface whereVIRTUAL_IPis configured. The default value iseth0.
Create your cluster
To create your cluster, select the tab that matches your environment and follow the instructions.
Ansible
To create your cluster, complete the following instructions:
Create a playbook for your database cluster specifications.
- name: Create DBCluster hosts: localhost vars: ansible_become: true ansible_user: ANSIBLE_USER ansible_ssh_private_key_file: ANSIBLE_SSH_PRIVATE_KEY_FILE roles: - role: google.alloydbomni_orchestrator.bootstrapReplace the following variables:
ANSIBLE_USER: OS user that Ansible uses to log into your AlloyDB Omni nodes.ANSIBLE_SSH_PRIVATE_KEY_FILE: private key Ansible uses to connect to your AlloyDB Omni nodes using SSH.
Run your playbook.
ansible-playbook DBCLUSTER_PLAYBOOK -i "DEPLOYMENT_SPEC" \ -e resource_spec="DBCLUSTER_SPECIFICATIONS"Replace the following variables:
DBCLUSTER_PLAYBOOK: path to the playbook that you created for your database cluster.DEPLOYMENT_SPEC: path to the deployment specification you created in Install AlloyDB Omni components.DBCLUSTER_SPECIFICATIONS: path to your cluster specifications.
alloydbctl
To create your cluster, run the following command:
alloydbctl apply -d "DEPLOYMENT_SPEC" -r "DBCLUSTER_SPECIFICATIONS"Replace the following variables:
DEPLOYMENT_SPEC: path to the deployment specification you created in Install AlloyDB Omni components.DBCLUSTER_SPECIFICATIONS: path to your cluster specifications.
Delete your cluster
To delete your cluster, select the tab that matches your environment and follow the instructions.
Ansible
To delete your cluster using Ansible, complete the following:
Create a playbook named
teardown.yaml:- name: Tear down AlloyDB Omni cluster hosts: localhost vars: ansible_become: true ansible_user: ANSIBLE_USER ansible_ssh_private_key_file: ANSIBLE_SSH_PRIVATE_KEY_FILE roles: - role: google.alloydbomni_orchestrator.deleteExecute the playbook using
ansible-playbook. You must specifyDBClusteras theresource_typeand the name of the cluster to be deleted asresource_name.ansible-playbook -i "DEPLOYMENT_SPEC" teardown.yaml \ -e `resource_type`=`DBCluster` -e `resource_name`="DBCLUSTER_NAME"
If the teardown process fails due to inconsistencies in the cluster state (for
example, if a node is unreachable), you can attempt to force delete your
cluster by adding -e force=true to the command. This instructs the
orchestrator to ignore errors during the teardown process and attempt to remove
as many resources as possible.
ansible-playbook -i "DEPLOYMENT_SPEC" teardown.yaml \
-e resource_type=DBCluster -e resource_name="DBCLUSTER_NAME" -e force=true alloydbctl
To delete your cluster using alloydbctl, run the following command:
alloydbctl delete -d "DEPLOYMENT_SPEC" \
--resource_type DBCluster --resource_name "DBCLUSTER_NAME"Replace the following variables:
DEPLOYMENT_SPEC: path to the deployment specification you created in Install AlloyDB Omni components.DBCLUSTER_NAME: name of your database cluster. For example,my-dbcluster.