重新安裝及還原元件

本文說明如何重新安裝及還原 Edge 元件。如果必須先重新安裝 Edge 元件,才能還原備份資料,請按照這個程序操作。

Apache ZooKeeper

還原一個獨立節點

  1. 停止 ZooKeeper:
    /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper stop
  2. 移除舊的 ZooKeeper 目錄:
    /opt/apigee/data/apigee-zookeeper
    /opt/apigee/etc/apigee-zookeeper.d
  3. 重新安裝 ZooKeeper:
    /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper install
  4. 還原 ZooKeeper:
    /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper restore 2019.03.17,14.40.41

    請注意,還原元件時,您不需要指定備份檔案的目錄路徑,也不需要指定「backup-」前置字串或「.tar.gz」後置字串。您只需指定備份檔案名稱中的日期/時間部分。

    您也可以選擇在 restore 指令中省略備份檔案,Edge 會使用元件備份目錄中最新的備份檔案。

  5. 重新啟動所有元件:
    /opt/apigee/apigee-service/bin/apigee-all restart

還原一個叢集節點

如果叢集中的單一 ZooKeeper 節點發生故障,您可以建立主機名稱/IP 位址相同的新節點,然後重新安裝 ZooKeeper。新 ZooKeeper 節點加入 ZooKeeper 集合後,會從領導者取得最新快照,並開始為用戶端提供服務。您不需要在這個執行個體中還原資料。

  1. 重新安裝 ZooKeeper:
    /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper install
  2. 使用安裝原始節點時使用的相同設定檔,在 ZooKeeper 節點上執行設定:
    /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper setup -f configFile
  3. 啟動 ZooKeeper:
    /opt/apigee/apigee-service/bin/apigee-service apigee-zookeeper start

還原整個叢集

  1. 停止整個叢集。
  2. 如要還原所有 ZooKeeper 節點,請按照上述單一節點的還原方式,從備份檔還原。
  3. 啟動 ZooKeeper 叢集。
  4. 重新啟動所有元件。

Apache Cassandra

還原一個獨立節點

  1. 停止 Cassandra:
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra stop
  2. 移除舊的 Cassandra 目錄:
    /opt/apigee/data/apigee-cassandra
  3. 重新安裝 Cassandra:
    /apigee/apigee-service/bin/apigee-service apigee-cassandra install
  4. 還原 Cassandra:
    /apigee/apigee-service/bin/apigee-service apigee-cassandra restore 2019.03.17,14.40.41

    請注意,還原元件時,您不需要指定備份檔案的目錄路徑,也不需要指定「backup-」前置字串或「.tar.gz」後置字串。您只需指定備份檔案名稱中的日期/時間部分。

    您也可以選擇在 restore 指令中省略備份檔案,Edge 會使用元件備份目錄中最新的備份檔案。

  5. 重新啟動所有元件:
    /apigee/apigee-service/bin/apigee-all restart

還原一個叢集節點

如果叢集中的單一 Cassandra 節點發生故障,您可以建立具有相同主機名稱/IP 位址的新節點。您只需要重新安裝 Cassandra,並完成幾個額外步驟即可。您不需要從備份還原資料。其他節點上的副本可用於還原故障節點上的資料。如果 Cassandra 叢集中的節點因硬體故障等原因而當機,通常適用這些步驟。

如果無法再存取失敗的節點,請毀損該節點並隔離其網路,確保節點不會意外重新加入 Cassandra 叢集。然後,使用與原始節點相同的 IP 位址啟動新節點,並在新節點上執行一般的 Apigee 啟動程序。

如果節點仍可存取,且您想重複使用,請執行下列步驟:

  1. 停止節點上的 Cassandra 程序:
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra stop
  2. 從節點解除安裝 Cassandra 軟體:
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra uninstall
  3. 從節點中清除資料目錄:
    rm -rf /opt/apigee/data/apigee-cassandra

完成上述步驟後,您應該會看到與失敗節點 IP 位址相同的節點,且已準備好安裝 Apigee 軟體。請執行下列步驟:

  1. 找出資料中心的種子節點。
    1. 在與要還原的節點位於相同資料中心的任何運作中 Cassandra 節點上,執行下列指令:
      apigee-service apigee-cassandra configure -search conf_cassandra_seeds
    2. 輸出內容應如下所示:
      Found key conf_cassandra_seeds, with value, "127.0.0.1", in /opt/apigee/apigee-cassandra/token/default.properties
      Found key conf_cassandra_seeds, with value, 127.0.0.1, in /opt/apigee/apigee-cassandra/token/application/cassandra.properties
      Found key conf_cassandra_seeds, with value, "10.1.0.1,10.1.0.2", in /opt/apigee/token/application/cassandra.properties
      apigee-configutil: apigee-cassandra: # OK
    3. 請參閱輸出內容的最後一行。列出的 IP 位址以半形逗號分隔,是這個資料中心節點使用的種子節點。
  2. 在要還原的新節點上,建立或編輯下列檔案:
    vi /opt/apigee/customer/application/cassandra.properties
  3. Add the following line:
    conf_jvm_options_custom_settings=-Dcassandra.replace_address=<ip-address-of-dead-node>
  4. 如果這個節點是其中一個種子節點 (節點的 IP 位址會顯示在步驟 1 的種子節點清單中),請在檔案中新增一行:
    conf_cassandra_seeds="<comma-separated-seed-list-except-this-node’s-ip>"
    1. 舉例來說,在上述例項中,種子清單有 2 個 IP - 10.1.0.1 和 10.1.0.2。如果還原的節點是 10.1.0.1,請新增類似這樣的程式碼行:
      conf_cassandra_seeds="10.1.0.2"
  5. 儲存檔案,並確保 Apigee 使用者擁有檔案且可讀取:
    chown apigee:apigee /opt/apigee/customer/application/cassandra.properties
  6. 安裝 Cassandra 軟體:
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra install
  7. 執行 Cassandra 設定:
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra setup -f <configFile>
  8. 設定作業會在內部嘗試啟動 Cassandra 服務。視要從其他節點串流的資料量、網路總處理量等因素而定,這項作業可能需要很長時間。
  9. [進階選項] 你可以在節點上執行下列 nodetool 指令,加快資料串流速度:
    nodetool setstreamthroughput <value>
    nodetool setcompactionthroughput <value>
  10. Cassandra 節點恢復運作後,請使用下列標準指令,確認節點已成功加入環狀拓撲:
    /opt/apigee/apigee-cassandra/bin/nodetool ring
    /opt/apigee/apigee-cassandra/bin/nodetool status
  11. 確認節點已成功啟動並執行後,請再次編輯 /opt/apigee/customer/application/cassandra.properties 檔案,並移除您在本程序先前步驟 3 和 4 中新增的行。
  12. 在節點上重新啟動 Cassandra 服務:
    /opt/apigee/apigee-service/bin/apigee-service apigee-cassandra restart

還原整個叢集

  1. 停止整個叢集。
  2. 從備份檔還原所有 Cassandra 節點。
  3. 啟動 Cassandra 叢集。
  4. 重新啟動所有元件。

PostgreSQL 資料庫

獨立執行的 PostgreSQL 或以主機身分執行

  1. 在所有節點上停止管理伺服器、Qpid 伺服器和 Postgres 伺服器:
    /apigee/apigee-service/bin/apigee-service edge-management-server stop
    /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server stop
    /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server stop
  2. 重新安裝 PostgreSQL 資料庫:
    /apigee/apigee-service/bin/apigee-service apigee-postgresql install 
  3. 啟動 PostgreSQL:
    /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql start
  4. 從備份檔還原 PostgreSQL 資料庫:
    /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql restore 2019.03.17,14.40.41

    請注意,還原 PostgreSQL 元件時,您不需要指定備份檔案的目錄路徑,也不需要指定「.dump」後置字元。您只需指定備份檔案名稱中的日期/時間部分。

    您也可以選擇在 restore 指令中省略備份檔案,Edge 會使用元件備份目錄中最新的備份檔案。

  5. 在所有節點上啟動管理伺服器、Qpid 伺服器和 Postgres 伺服器:
    /opt/apigee/apigee-service/bin/apigee-service edge-management-server start
    /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server start
    /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server start

以待命模式執行的 PostgreSQL

  1. 重新安裝 PostgreSQL 資料庫:
    /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql install
  2. 使用安裝時所用的設定檔重新設定 PostgreSQL 資料庫:
    /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql setup -f configFile
  3. 啟動 PostgreSQL:
    /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql start 

Postgres 伺服器

  1. 在所有主要和待命節點上停止 Postgres 伺服器:
    /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server stop
  2. 移除舊的 Postgres 伺服器目錄:
    /opt/apigee/data/edge-postgres-server /opt/apigee/etc/edge-postgres-server.d
  3. 重新安裝 Postgres 伺服器:
    /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server install
  4. 從備份檔案還原 Postgres 伺服器:
    /opt/apigee/apigee-service/bin/apigee-service edge-postgre-server restore 2019.03.17,14.40.41

    請注意,還原元件時,您不需要指定備份檔案的目錄路徑,也不需要指定「backup-」前置字串或「.tar.gz」後置字串。您只需指定備份檔案名稱中的日期/時間部分。

    您也可以選擇在 restore 指令中省略備份檔案,Edge 會使用元件備份目錄中最新的備份檔案。

  5. 在所有主要和待命節點上啟動 Postgres 伺服器:
    /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server start

Qpid Server 和 Qpidd

  1. 在所有節點上停止 Qpidd、Qpid Server 和 Postgres Server:
    /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server stop
    /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server stop
    /opt/apigee/apigee-service/bin/apigee-service apigee-qpidd stop
  2. 移除舊的 Qpid Server 和 Qpidd 目錄:
    /opt/apigee/data/edge-qpid-server
    /opt/apigee/etc/edge-qpid-server.d
    /opt/apigee/data/apigee-qpidd
    /opt/apigee/etc/apigee-qpidd.d 
  3. 重新安裝 Qpidd:
    /opt/apigee/apigee-service/bin/apigee-service apigee-qpidd install 
  4. 還原 Qpidd:
    /opt/apigee/apigee-service/bin/apigee-service apigee-qpidd restore 2019.03.17,14.40.41

    請注意,還原元件時,您不需要指定備份檔案的目錄路徑,也不需要指定「backup-」前置字串或「.tar.gz」後置字串。您只需指定備份檔案名稱中的日期/時間部分。

    您也可以選擇在 restore 指令中省略備份檔案,Edge 會使用元件備份目錄中最新的備份檔案。

  5. 啟動 Qpidd:
    /opt/apigee/apigee-service/bin/apigee-service apigee-qpidd start 
  6. 重新安裝 Qpid 伺服器:
    /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server install
  7. 還原 Qpid 伺服器:
    /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server restore 2019.03.17,14.40.41

    請注意,還原元件時,您不需要指定備份檔案的目錄路徑,也不需要指定「backup-」前置字串或「.tar.gz」後置字串。您只需指定備份檔案名稱中的日期/時間部分。

    您也可以選擇在 restore 指令中省略備份檔案,Edge 會使用元件備份目錄中最新的備份檔案。

  8. 在所有節點上重新啟動 Qpid 伺服器、Qpidd 和 Postgres 伺服器:
    /opt/apigee/apigee-service/bin/apigee-service apigee-qpidd restart
    /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server restart
    /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server restart

SymasLDAP

  1. 停止 SymasLDAP:
    /opt/apigee/apigee-service/bin/apigee-service apigee-openldap stop
  2. 重新安裝 SymasLDAP:
    /opt/apigee/apigee-service/bin/apigee-service apigee-openldap install
  3. 移除舊的 SymasLDAP 目錄:
    /opt/apigee/data/apigee-openldap /opt/apigee/etc/apigee-openldap.d
  4. 還原 SymasLDAP:
    /opt/apigee/apigee-service/bin/apigee-service apigee-openldap restore 2019.03.17,14.40.41

    請注意,還原元件時,您不需要指定備份檔案的目錄路徑,也不需要指定「backup-」前置字串或「.tar.gz」後置字串。您只需指定備份檔案名稱中的日期/時間部分。

    您也可以選擇在 restore 指令中省略備份檔案,Edge 會使用元件備份目錄中最新的備份檔案。

  5. 重新啟動 SymasLDAP:
    /opt/apigee/apigee-service/bin/apigee-service apigee-openldap start
  6. 重新啟動所有管理伺服器:
    /opt/apigee/apigee-service/bin/apigee-service edge-management-server restart

管理伺服器

  1. 停止管理伺服器:
    /opt/apigee/apigee-service/bin/apigee-service edge-management-server stop
  2. 移除舊的管理伺服器目錄:
    /opt/apigee/data/edge-management-server /opt/apigee/etc/edge-management-server.d
  3. 重新安裝管理伺服器:
    /opt/apigee/apigee-service/bin/apigee-service edge-management-server install
  4. 從備份檔還原管理伺服器:
    /opt/apigee/apigee-service/bin/apigee-service edge-management-server restore 2019.03.17,14.40.41

    請注意,還原元件時,您不需要指定備份檔案的目錄路徑,也不需要指定「backup-」前置字串或「.tar.gz」後置字串。您只需指定備份檔案名稱中的日期/時間部分。

    您也可以選擇在 restore 指令中省略備份檔案,Edge 會使用元件備份目錄中最新的備份檔案。

  5. 重新啟動管理伺服器:
    /opt/apigee/apigee-service/bin/apigee-service edge-management-server start

訊息處理器

  1. 停止訊息處理器:
    /opt/apigee/apigee-service/bin/apigee-service edge-message-processor stop
  2. 移除舊的 Message Processor 目錄:
    /opt/apigee/data/edge-message-processor
    /opt/apigee/etc/edge-message-processor.d
  3. 重新安裝 Message Processor:
    /opt/apigee/apigee-service/bin/apigee-service edge-message-processor install
  4. 從備份檔還原 Message Processor:
    /opt/apigee/apigee-service/bin/apigee-service edge-message-processor restore 2019.03.17,14.40.41

    請注意,還原元件時,您不需要指定備份檔案的目錄路徑,也不需要指定「backup-」前置字串或「.tar.gz」後置字串。您只需指定備份檔案名稱中的日期/時間部分。

    您也可以選擇在 restore 指令中省略備份檔案,Edge 會使用元件備份目錄中最新的備份檔案。

  5. 重新啟動訊息處理器:
    /opt/apigee/apigee-service/bin/apigee-service edge-message-processor start

路由器

  1. 停止路由器:
    /opt/apigee/apigee-service/bin/apigee-service edge-router stop
  2. 移除舊的 Router 目錄:
    /opt/apigee/data/edge-router
    /opt/apigee/etc/edge-router.d
  3. 重新安裝路由器:
    /opt/apigee/apigee-service/bin/apigee-service edge-router install
  4. 從備份檔還原路由器:
    /opt/apigee/apigee-service/bin/apigee-service edge-router restore 2019.03.17,14.40.41

    請注意,還原元件時,您不需要指定備份檔案的目錄路徑,也不需要指定「backup-」前置字串或「.tar.gz」後置字串。您只需指定備份檔案名稱中的日期/時間部分。

    您也可以選擇在 restore 指令中省略備份檔案,Edge 會使用元件備份目錄中最新的備份檔案。

  5. 重新啟動路由器:
    /opt/apigee/apigee-service/bin/apigee-service edge-router start

Edge UI

  1. 停止 UI:
    /opt/apigee/apigee-service/bin/apigee-service edge-ui stop
  2. 移除舊的 UI 目錄:
    /opt/apigee/data/edge-ui
    /opt/apigee/etc/edge-ui.d
  3. 重新安裝 UI:
    /opt/apigee/apigee-service/bin/apigee-service edge-ui install
  4. 從備份檔還原 UI:
    /opt/apigee/apigee-service/bin/apigee-service edge-ui restore 2019.03.17,14.40.41

    請注意,還原元件時,您不需要指定備份檔案的目錄路徑,也不需要指定「backup-」前置字串或「.tar.gz」後置字串。您只需指定備份檔案名稱中的日期/時間部分。

    您也可以選擇在 restore 指令中省略備份檔案,Edge 會使用元件備份目錄中最新的備份檔案。

  5. 重新啟動 UI:
    /opt/apigee/apigee-service/bin/apigee-service edge-ui start

完成網站復原

  1. 停止所有元件節點。請注意,停止子系統的順序很重要:請先停止所有 Edge 節點,然後停止所有資料儲存節點。
  2. 如上所述還原所有元件。
  3. 現在請依下列順序啟動所有元件。請注意,啟動子系統的順序非常重要:
    1. 啟動 ZooKeeper 叢集
    2. 啟動 Cassandra 叢集
    3. 確認 SymasLDAP 正常運作
    4. 啟動 qpid
    5. 確認 PostgreSQL 資料庫已啟動並執行
    6. 啟動管理伺服器
    7. 啟動路由器和訊息處理器
    8. 啟動 Qpid 伺服器
    9. 啟動 Postgres 伺服器
    10. 啟動 Apigee UI