從備份還原

您可以從備份元件時建立的檔案還原元件。您可以使用 restore 指令執行這項操作。

請注意,restore 指令:

  • 使用指定的備份檔案,或取得最新的備份檔案 (如未指定檔案名稱)。
  • 確保元件的資料目錄為空白。
  • 停止元件。還原後,您必須明確重新啟動元件。

本節說明如何使用 restore 指令。

如要從備份檔案還原元件:

  1. 確認下列目錄為空白:
    /opt/apigee/data/component_name
    /opt/apigee/etc/component_name.d

    如果不是空的,請使用下列指令刪除內容:

    rm -r /opt/apigee/data/component_name
    rm -r /opt/apigee/etc/component_name.d
  2. 使用下列指令還原先前的設定和資料:
    /opt/apigee/apigee-service/bin/apigee-service component_name restore backup_file

    其中:

    • component_name 是元件名稱。可能的值包括:
      • apigee-cassandra (Cassandra)
      • apigee-openldap (OpenLDAP)
      • apigee-postgresql (PostgreSQL 資料庫)
      • apigee-qpidd (魁北克)
      • apigee-sso (邊緣單一登入)
      • apigee-zookeeper (ZooKeeper)
      • edge-management-server (管理伺服器)
      • edge-management-ui (新版 Edge UI)
      • edge-message-processor (訊息處理器)
      • edge-postgres-server (Postgres 伺服器)
      • edge-qpid-server (快速伺服器)
      • edge-router (邊緣路由器)
      • edge-ui (傳統版 UI)
    • backup_file 是您在備份該元件時建立的檔案名稱;這個值不包含路徑,但包含「backup-」前置字串和副檔名。例如:backup-2019.03.17,14.40.41.tar.gz。

    例如:

    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra restore backup-2019.03.17,14.40.41.tar.gz

    您可以選擇是否指定 backup_file。如果省略,Apigee 會使用 /opt/apigee/backup/component_name 中最新的檔案。

    restore 指令會重新套用備份的設定,並還原備份時的資料。

  3. 重新啟動元件,如以下範例所示:
    /opt/apigee/apigee-service/bin/apigee-service component_name start