使用 RPM 编排器示例的 AlloyDB Omni

本页面提供了各种 YAML 配置示例,以使用 RPM 编排器部署和管理 AlloyDB Omni。

DBCluster 配置

极简 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 配置

使用密码的示例:

查看 Secret(密码)YAML 配置

Secret:
  metadata:
    name: db-pw-sample-st-1
  spec:
    type: Opaque
    data:
      sample-st-1: cG9zdGdyZXM=

使用证书的示例:

查看 Secret(证书)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 密钥示例:

查看 Secret (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 存储桶中。

查看“备份到 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