本頁提供各種 YAML 設定範例,說明如何使用 RPM 自動調度管理工具部署及管理 AlloyDB Omni。
DBCluster 設定
Minimal DBCluster
取得獨立 DBCluster 的基本設定。
查看 DBCluster YAML 最少設定
DBCluster: metadata: name: alloydb-prod spec: databaseVersion: 18.1.0 primarySpec: adminUser: passwordRef: name: db-pw-alloydb-prod resources: disks: - name: DataDisk path: /mnt/disks/pgsql
完整 DBCluster
顯示所有選項的完整 DBCluster 設定。
查看完整的 DBCluster YAML 設定
DBCluster: metadata: name: alloydb-prod spec: databaseVersion: 18.1.0 loadBalancerPort: 5433 readOnlyPort: 5434 mode: "" availability: numberOfStandbys: 2 enableAutoFailover: true enableAutoHeal: true enableStandbyAsReadReplica: true autoFailoverTriggerThreshold: 2 autoHealTriggerThreshold: 2 healthcheckPeriodSeconds: 10 primarySpec: adminUser: passwordRef: name: db-pw-alloydb-prod port: 5432 monitorPort: 9187 parameters: max_connections: "100" max_wal_size: "2GB" max_worker_processes: "32" log_connections: "on" log_disconnections: "on" log_hostname: "on" log_statement: "none" resources: cpu: 16 memory: 32Gi limits: memory: 64Gi disks: - name: DataDisk path: /mnt/disks/pgsql - name: ObsDisk path: /obs dbLoadBalancerOptions: onprem: loadBalancerIP: 10.1.0.95 loadBalancerType: "internal" loadBalancerInterface: "eth0" features: columnarSpillToDisk: cacheSize: "50Gi" localVolume: path: "/mnt/disks/ssd1" ultraFastCache: cacheSize: "100Gi" localVolume: path: "/mnt/disks/ssd2" googleMLExtension: enabled: true config: vertexAIKeyRef: "vertex-ai-key" vertexAIRegion: "us-central1"
密鑰設定
使用密碼的範例:
查看 Secret (密碼) YAML 設定
Secret: metadata: name: db-pw-sample-st-1 spec: type: Opaque data: sample-st-1: cG9zdGdyZXM=
使用憑證的範例:
查看 Secret (certs) YAML 設定
Secret: metadata: name: dbs-alloydbomni-cluster spec: type: Opaque data: ca.crt: <base64_ca_certificate> tls.crt: <base64_tls_certificate> tls.key: <base64_tls_private_key>
Gemini Enterprise Agent Platform 金鑰範例:
查看密鑰 (Vertex AI) YAML 設定
Secret: metadata: name: vertex-ai-key spec: type: Opaque data: private-key.json: <base64_encoded_private_key>
PgBouncer 設定
查看 PgBouncer YAML 設定
PgBouncer: metadata: name: sample-pgbouncer spec: accessMode: "rw" allowSuperUserAccess: true dbClusterRef: dbcluster-sample port: 6432
排定的備份方案
排定完整備份和增量備份。
查看排定備份方案的 YAML 設定
BackupPlan: metadata: name: sample-backupplan spec: dbclusterRef: sample-dbc backupRetainDays: 14 paused: false backupSchedules: # Full backup at 00:00 on every Sunday. full: "0 0 * * 0" # Incremental backup at 21:00 every day. incremental: "0 21 * * *" backupLocation: type: GCS gcsOptions: bucket: sample-backup-bucket key: /backups secretRef: name: gcs-access-secret
備份至 Cloud Storage
將備份儲存在 Cloud Storage bucket 中。
查看備份至 Cloud Storage 的 YAML 設定
BackupPlan: metadata: name: sample-backupplan-gcs spec: dbclusterRef: sample-dbc backupRetainDays: 14 paused: false backupSchedules: # Full backup at 00:00 every Sunday. full: "0 0 * * 0" # Incremental backup at every day at 21:00. incremental: "0 21 * * *" backupLocation: type: GCS gcsOptions: bucket: sample-backup-bucket key: /backups secretRef: name: gcs-access-secret
備份至 Amazon S3
將備份檔儲存在與 Amazon S3 相容的儲存桶中。
查看備份至 Amazon S3 的 YAML 設定
BackupPlan: metadata: name: sample-backupplan-s3 spec: dbclusterRef: sample-dbc backupRetainDays: 14 paused: false backupSchedules: # Full backup at 00:00 on every Sunday. full: "0 0 * * 0" # Incremental backup at 21:00 every day. incremental: "0 21 * * *" backupLocation: type: S3 s3Options: bucket: sample-backup-bucket-s3 key: /backups region: "us-east-1" endpoint: "https://s3.storage.com" secretRef: name: s3-access-secret
手動備份
建立單一手動備份。
查看隨選手動備份 YAML 設定
Backup: metadata: name: sample-backup spec: dbclusterRef: sample-dbc backupPlanRef: sample-backupplan manual: true physicalBackupSpec: backupType: full
從備份還原
從儲存的備份還原或建立叢集。
查看「從備份還原」YAML 設定
Restore: metadata: name: sample-restore spec: sourceDBCluster: sample-dbc backup: sample-backup
還原至某個時間點
將叢集還原至過去的特定時間戳記。
查看時間點還原 YAML 設定
Restore: metadata: name: sample-restore-pitr spec: sourceDBCluster: sample-dbc pointInTime: "2026-08-12T00:00:00Z"
切換設定
切換設定範例
查看切換 YAML 設定
Switchover: metadata: name: switchover-alloydb-prod-12345 spec: dbclusterRef: "alloydb-prod"
容錯移轉設定
容錯移轉設定範例
查看容錯移轉 YAML 設定
Failover: metadata: name: failover-alloydb-prod-abcde spec: dbclusterRef: "alloydb-prod"
DBInstance 設定
DBInstance (ReadPool) 設定範例
查看 DBInstance (ReadPool) YAML 設定
DBInstance: metadata: name: sample-readpool spec: instanceType: ReadPool dbcParent: name: alloydb-prod nodeCount: 2