Google Cloud AlloyDB 運算子

The AlloyDB for PostgreSQL 是一個完全託管、與 PostgreSQL 相容的資料庫服務,專為您最嚴苛的工作負載而設計,包括混合式交易和分析處理。AlloyDB 將 Google 建置的資料庫引擎與雲端式多節點架構配對,以提供企業級效能、可靠性和可用性。

Airflow 提供運算子來管理 AlloyDB 叢集。

先決條件任務

若要使用這些運算子,您必須執行幾項操作

建立叢集

若要建立 AlloyDB 叢集(主要和次要),您可以使用 AlloyDBCreateClusterOperator

tests/system/google/cloud/alloy_db/example_alloy_db.py[原始碼]

create_cluster = AlloyDBCreateClusterOperator(
    task_id="create_cluster",
    cluster_id=CLUSTER_ID,
    cluster_configuration=CLUSTER,
    is_secondary=False,
    location=GCP_LOCATION,
    project_id=GCP_PROJECT_ID,
)

更新叢集

若要更新 AlloyDB 叢集,您可以使用 AlloyDBUpdateClusterOperator

tests/system/google/cloud/alloy_db/example_alloy_db.py[原始碼]

update_cluster = AlloyDBUpdateClusterOperator(
    task_id="update_cluster",
    cluster_id=CLUSTER_ID,
    cluster_configuration=CLUSTER_UPDATE,
    update_mask=CLUSTER_UPDATE_MASK,
    location=GCP_LOCATION,
    project_id=GCP_PROJECT_ID,
)

刪除叢集

若要刪除 AlloyDB 叢集,您可以使用 AlloyDBDeleteClusterOperator

tests/system/google/cloud/alloy_db/example_alloy_db.py[原始碼]

delete_cluster = AlloyDBDeleteClusterOperator(
    task_id="delete_cluster",
    project_id=GCP_PROJECT_ID,
    location=GCP_LOCATION,
    cluster_id=CLUSTER_ID,
)

這篇文章是否對您有幫助?