Cassandra 磁碟空間不足

問題

Cassandra 資料庫的磁碟空間不足,導致 Apigee hybrid 安裝程序失敗。安裝程序失敗,並顯示下列錯誤訊息:

Error: UPGRADE FAILED: cannot patch "default" with kind ApigeeDatastore:
Internal error occurred

此外,Cassandra 記錄檔會包含類似下列的警告:

WARN  [main] 2024-06-18 12:34:55,583 DatabaseDescriptor.java:579 - Only
62.440GiB free across all data volumes. Consider adding more capacity to your
cluster or removing obsolete snapshots

常見診斷步驟

使用 Apigee hybrid 必備資訊收集指令碼,收集 Cassandra Pod 的記錄檔以供查看。

可能原因

原因 說明
磁碟空間不足 Cassandra 的可用磁碟空間低於 50%。

原因 1:磁碟空間不足

升級 Apigee hybrid 時,請確保所有 Cassandra Pod 都有超過 50% 的可用磁碟空間。

診斷

  1. 在 Apigee hybrid 必備資訊收集指令碼中,檢查下列指令的輸出內容,確認與 Cassandra 相關聯的磁碟區總大小:

    kubectl get pv -n APIGEE_NAMESPACE

    輸出內容範例

    NAME                                     CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM                                            STORAGECLASS   VOLUMEATTRIBUTESCLASS   REASON    AGE
    pvc-0b6b2daa-d512-4780-9021-fc97293a8154 10Gi     RWO          Delete         Bound  apigee/cassandra-data-apigee-cassandra-default-1 standard-rwo    <unset>                 -        20d
    pvc-2263fc7c-e057-406a-ad60-38573733c92d 10Gi     RWO          Delete         Bound  apigee/cassandra-data-apigee-cassandra-default-2 standard-rwo    <unset>                 -        20d
    pvc-8c854fe9-adaa-440f-90d9-d15497e7f530 10Gi     RWO          Delete         Bound  apigee/cassandra-data-apigee-cassandra-default-0 standard-rwo    <unset>                 -        20d
    
  2. 查看 nodetool 狀態輸出內容,瞭解每個 Cassandra Pod 使用的磁碟。指派給 Cassandra Pod 的永久磁碟區要求 (PVC) 磁碟空間使用率,不應超過可用儲存容量的 50%。請參考下列指令:
    kubectl -n APIGEE_NAMESPACE -c apigee-cassandra exec apigee-cassandra-default-1 -- bash -c 'nodetool -u cassandra -pw $CASS_PASSWORD status'

    其中 CASS_PASSWORD 是 設定屬性參考資料中提及的 cassandra.auth.default.password。

    輸出內容範例

    Datacenter: us-west3
    ========================
    Status=Up/Down
    |/ State=Normal/Leaving/Joining/Moving
    --  Address      Load        Tokens  Owns (effective)  Host ID                               Rack
    UN  10.10.10.1   6.69 GiB   256     100.0%            2a184030-444-4155-8375-156e87539711      a
    UN  10.10.10.2   7.42 GiB   256     53.1%             f22b66c7-4444-4000-b9c0-5a71ee6315a8     c
    UJ  10.10.10.3   7.39 GiB   256     ?                 78fb2737-4444-4468-a786-e473ead115b5     b
    UN  10.10.10.4   7.81 GiB   256     47.0%             779fcdf1-4444-4186-bcbb-2844e59629c2     b
    UN  10.10.10.5   6.91 GiB   256     53.0%             55ca07b2-4444-4967-b321-6477d50f9846     b
    UN  10.10.10.6   7.41 GiB   256     46.9%             0cf33585-444-46ce-811f-9c6376ed58ac      c
    

    (選用) 使用 kubectl 在 Cassandra 容器中執行指令,檢查磁碟用量百分比。

    kubectl exec -it apigee-cassandra-default-0 -n apigee – df -h /opt/apigee/data
    kubectl exec -it apigee-cassandra-default-1 -n apigee – df -h /opt/apigee/data
    kubectl exec -it apigee-cassandra-default-2 -n apigee – df -h /opt/apigee/data
    

    範例

    以下範例顯示磁碟空間使用率超過 50% 的情況。這會導致 Apigee Hybrid 升級作業發生問題。

    kubectl exec -it apigee-cassandra-default-0 -n apigee -- df -h /opt/apigee/data
    

    Defaulted container "apigee-cassandra" out of: apigee-cassandra, apigee-cassandra-ulimit-init (init) Filesystem Size Used Avail Use% Mounted on /dev/sdb 10G 6G 4G 60% /opt/apigee/data

    kubectl exec -it apigee-cassandra-default-1 -n apigee -- df -h /opt/apigee/data

    Defaulted container "apigee-cassandra" out of: apigee-cassandra, apigee-cassandra-ulimit-init (init) Filesystem Size Used Avail Use% Mounted on /dev/sdb 10G 5.9G 4.1G 59% /opt/apigee/data

    kubectl exec -it apigee-cassandra-default-2 -n apigee -- df -h /opt/apigee/data

    Defaulted container "apigee-cassandra" out of: apigee-cassandra, apigee-cassandra-ulimit-init (init) Filesystem Size Used Avail Use% Mounted on /dev/sdb 10G 5.6G 4.4G 56% /opt/apigee/data

解析度

如果發現磁碟使用率超過 50%,請先擴充 Cassandra 磁碟容量,確保使用率低於 50%,再執行 Apigee Hybrid 升級作業。

如要擴充磁碟容量,請參閱「管理 Cassandra 永久儲存空間大小」。

必須收集診斷資訊

如果按照上述操作說明操作後,問題仍未解決,請收集下列診斷資訊,然後與 Google Cloud Customer Care 聯絡:
  • 您的 Google Cloud 專案 ID。
  • 您的 Apigee Hybrid 組織。
  • 來源和新區域的 overrides.yaml 檔案 (請務必遮蓋所有機密資訊)。
  • Apigee Hybrid 必備資訊收集中的指令輸出內容。