停用資料中心

有時候,您可能需要停用資料中心。舉例來說,如果您要升級作業系統,需要在新的資料中心安裝新的作業系統,然後停用舊的資料中心。以下各節提供停用資料中心的範例,其中有兩個在12 節點叢集安裝上的資料中心 dc-1 和 dc-2:

  • dc-1 是即將停用的資料中心。
  • dc-2 是第二個資料中心,用於停用程序。

如果您要升級作業系統,dc-2 可能是已安裝新版作業系統 (OS) 的資料中心。不過,安裝新的 OS 不需要停用資料中心。

停用資料中心前的注意事項

停用資料中心時,請注意以下幾點:

  • 封鎖即將停用資料中心的所有執行階段及管理流量,並重新導向至其他資料中心。
  • 停用資料中心後,Apigee 叢集內的容量將會減少。如要彌補剩餘資料中心的容量,請考慮增加剩餘資料中心的容量,或是在停用後增加資料中心。
  • 在停用程序中,數據分析資料可能會遺失,實際情況視停用資料中心內安裝的數據分析元件而定。詳情請參閱「新增或移除 Qpid 節點」。
  • 停用資料中心之前,您應該瞭解所有資料中心的所有元件設定方式,尤其是 OpenLDAP、ZooKeeper、Cassandra 和 Postgres 伺服器。您也應該為所有元件及其設定建立備份。

事前準備

  • 管理伺服器:所有停用步驟都極為依賴管理伺服器。如果您只有一個管理伺服器,建議您先在 dc-1 以外的資料中心安裝新的管理伺服器元件,再停用 dc-1 上的管理伺服器,並確保其中一個管理伺服器隨時可用。
  • 路由器:在停用路由器之前,請先封鎖通訊埠 15999,藉此停用路由器的可連性。請確保系統不會將任何執行階段流量導向要停用的路由器。
  • Cassandra 和 ZooKeeper:以下各節說明如何在兩個資料中心設定中停用 dc-1。如果您有超過兩個資料中心,請務必將所有其他資料中心的無訊息設定檔 (在此例中為 dc-1) 參照全數移除。針對要停用的 Cassandra 節點,請從 CASS_HOSTS 捨棄這些主機。其餘 Cassandra 節點應維持 CASS_HOSTS 的原始順序。

  • Postgres:如果您停用 Postgres 主要執行個體,請務必將任一可用待命節點升級為新的 Postgres 主要執行個體。雖然 QPID 伺服器會將緩衝區保留在佇列中,但如果 Postgres 主要執行個體無法使用一段時間,您可能會遺失數據分析資料。

必備條件

  • 停用任何元件之前,建議您先為所有節點執行完整的備份。按照目前 Edge 版本的程序執行備份。如要進一步瞭解備份,請參閱「備份與還原」。

    注意:如果您有多個 Cassandra 或 ZooKeeper 節點,請一次備份一個節點,因為備份程序會暫時關閉 ZooKeeper。

  • 使用下列指令,確保 Edge 在停用前處於運作狀態:
    /opt/apigee/apigee-service/bin/apigee-all status
  • 確認目前停用的資料中心沒有任何執行階段流量。

停用元件的順序

如果您在多個節點上安裝 Edge for Private Cloud,請按照下列順序停用這些節點上的 Edge 元件:

  1. Edge UI (edge-ui)
  2. 管理伺服器 (edge-management-server)
  3. OpenLDAP (apigee-openldap)
  4. Router (edge-router)
  5. 訊息處理器 (edge-訊息處理器)
  6. Qpid 伺服器和 Qpidd (edge-qpid-server 和 apigee-qpidd)
  7. Postgres 和 PostgreSQL 資料庫 (edge-postgres-server 和 apigee-postgresql)
  8. ZooKeeper (apigee-zookeeper)
  9. Cassandra (apigee-cassandra)

以下各節說明如何停用每個元件。

Edge UI

如要停止並解除安裝 dc-1 的 Edge UI 元件,請輸入下列指令:

/opt/apigee/apigee-service/bin/apigee-service edge-ui stop
/opt/apigee/apigee-service/bin/apigee-service edge-ui uninstall

管理伺服器

如要停用 dc-1 上的管理伺服器,請按照下列步驟操作:

  1. 在 dc-1 上停止管理伺服器:
    apigee-service edge-management-server stop
  2. 找出在 dc-1 中註冊的管理伺服器的 UUID:
    curl -u <AdminEmailID>:'<AdminPassword>' \
    -X GET “http://{MS_IP}:8080/v1/servers?pod=central&region=dc-1&type=management-server”
  3. 取消註冊伺服器的類型:
    curl -u <AdminEmailID>:'<AdminPassword>' -X POST http://{MS_IP}:8080/v1/servers \
    -d "type=management-server&region=dc-1&pod=central&uuid=UUID&action=remove"
  4. 刪除伺服器。注意:如果這個伺服器上也安裝了其他元件,請先取消註冊所有元件,再刪除 UUID。
    curl -u <AdminEmailID>:'<AdminPassword> -X DELETE http://{MS_IP}:8080/v1/servers/{UUID}
  5. 在 dc-1 上解除安裝管理伺服器元件:
    /opt/apigee/apigee-service/bin/apigee-service edge-management-server uninstall

開啟 LDAP

本節說明如何在 dc-1 上停用 OpenLDAP。

注意:如果您擁有兩個以上的資料中心,請參閱下方「設定超過兩個資料中心的設定」一節。

如要在 dc-1 上停用 OpenLDAP,請按照下列步驟操作:

  1. 請按照如何備份一文中的步驟備份 dc-1 OpenLDAP 節點。
  2. 在兩個資料中心中執行下列步驟,藉此中斷 dc-1 和 dc-2 兩個資料中心之間的資料複製作業。

    1. 查看目前狀態:
      ldapsearch -H ldap://{HOST}:{PORT} -LLL -x -b "cn=config" -D "cn=admin,cn=config" -w {credentials} -o ldif-wrap=no 'olcSyncRepl' | grep olcSyncrepl

      輸出的內容會類似以下:

      olcSyncrepl: {0}rid=001 provider=ldap://{HOST}:{PORT}/ binddn="cn=manager,dc=apigee,dc=com" bindmethod=simple credentials={credentials} searchbase="dc=apigee,dc=com" attrs="*,+" type=refreshAndPersist retry="60 1 300 12 7200 +" timeout=1

    2. 建立含有下列指令的檔案 break_repl.ldif
      dn: olcDatabase={2}bdb,cn=config
      changetype: modify
      delete: olcSyncRepl
      
      dn: olcDatabase={2}bdb,cn=config
      changetype: modify
      delete: olcMirrorMode
    3. 執行 ldapmodify 指令:
      ldapmodify -x -w {credentials} -D "cn=admin,cn=config" -H "ldap://{HOST}:{PORT}/" -f path/to/file/break_repl.ldif

      輸出的內容會類似以下:

      modifying entry "olcDatabase={2}bdb,cn=config"
      modifying entry "olcDatabase={2}bdb,cn=config"

  3. 您可以在 dc-2 LDAP 中建立項目,確認 dc-2 是否不再複製到 dc-1,藉此確認該項目不會出現在 dc-1 的 LDAP 中。

    或者,您也可以按照下列步驟操作,在 dc-2 OpenLDAP 節點中建立唯讀使用者,然後檢查是否已複製該使用者。使用者隨後遭到刪除。

    1. 在 dc-2 中建立含有以下內容的檔案 readonly-user.ldif
      dn: uid=readonly-user,ou=users,ou=global,dc=apigee,dc=com
      objectClass: organizationalPerson
      objectClass: person
      objectClass: inetOrgPerson
      objectClass: top
      cn: readonly-user
      sn: readonly-user
      userPassword: {testPassword}
    2. 在 dc-2 中使用「ldapadd」指令新增使用者:
      ldapadd -H ldap://{HOST}:{PORT} -w {credentials} -D "cn=manager,dc=apigee,dc=com" -f path/to/file/readonly-user.ldif

      輸出結果會與下列內容相似:

      adding new entry "uid=readonly-user,ou=users,ou=global,dc=apigee,dc=com"

    3. 在 dc-1 中搜尋使用者,確認系統不會複製該使用者。如果使用者不存在於 dc-1 中,您將確認兩個 LDAP 已不再複製:
      ldapsearch -H ldap://{HOST}:{PORT} -x -w {credentials} -D "cn=manager,dc=apigee,dc=com" -b uid=readonly-user,ou=users,ou=global,dc=apigee,dc=com -LLL

      畫面會顯示如下的輸出內容:

      No such object (32)
      Matched DN: ou=users,ou=global,dc=apigee,dc=com
    4. 移除先前新增的唯讀使用者:
      ldapdelete -v -H ldap://{HOST}:{PORT} -w {credentials} -D "cn=manager,dc=apigee,dc=com" "uid=readonly-user,ou=users,ou=global,dc=apigee,dc=com"
  4. 在 dc-1 中停止 OpenLDAP:
    /opt/apigee/apigee-service/bin/apigee-service apigee-openldap stop
  5. 解除安裝 dc-1 中的 OpenLDAP 元件:
    /opt/apigee/apigee-service/bin/apigee-service apigee-openldap uninstall

路由器

本節說明如何停用路由器。如要進一步瞭解如何移除路由器,請參閱 移除伺服器一文。

下列步驟會從 dc-1 停用路由器。如果 dc-1 中設定了多個路由器節點,請一次執行所有路由器節點中的步驟

注意:這裡假設路由器的健康狀態檢查通訊埠 15999 已在負載平衡器中設定,而封鎖通訊埠 15999 會導致路由器無法存取。您可能需要根層級存取權才能封鎖通訊埠。

如要停用路由器,請按照下列步驟操作:

  1. 封鎖健康狀態檢查通訊埠 15999,藉此停用路由器的可連性。確保這個資料中心的執行階段流量遭到封鎖:

    iptables -A INPUT -i eth0 -p tcp --dport 15999 -j REJECT
  2. 確認可以連上路由器:

    curl -vvv -X GET http://{ROUTER_IP}:15999/v1/servers/self/reachable

    輸出的內容會類似以下:

    About to connect() to 10.126.0.160 port 15999 (#0)
    Trying 10.126.0.160...
    Connection refused
    Failed connect to 10.126.0.160:15999; Connection refused
    Closing connection 0
    curl: (7) Failed connect to 10.126.0.160:15999; Connection refused

  3. 按照取得 UUID 一文的說明,取得路由器的 UUID。
  4. 停止路由器:
    /opt/apigee/apigee-service/bin/apigee-service edge-router stop
  5. 使用下列指令列出機構中可用的閘道 Pod:
    curl -u  <AdminEmailID>:<AdminPassword> -X GET "http://{MS_IP}:8080/v1/organizations/{ORG}/pods"

    請參閱 關於 Pod 一文。

  6. 取消註冊伺服器類型:
    curl -u <AdminEmailID>:'<AdminPassword>' -X POST http://{MS_IP}:8080/v1/servers \
    -d "type=router&amp;region=dc-1&amp;pod=gateway-1&amp;uuid=UUID&amp;action=remove"
  7. 取消註冊伺服器:
    curl -u <AdminEmailID>:'<AdminPassword>’ -X DELETE http://{MS_IP}:8080/v1/servers/UUID
  8. 解除安裝 edge-router
    /opt/apigee/apigee-service/bin/apigee-service edge-router uninstall
    請參閱「 移除伺服器」。
  9. 清除 iptables 規則以啟用封鎖的通訊埠 15999:
    iptables -F

訊息處理器

本節說明如何從 dc-1 停用訊息處理器。如要進一步瞭解如何移除訊息處理器,請參閱 移除伺服器

因為我們假設 dc-1 有12 個節點叢集安裝,所以 dc-1 中設定兩個訊息處理器節點。在這兩個節點中執行下列指令。

  1. 按照取得 UUID 一文的說明,取得訊息處理器的 UUID。
  2. 停止訊息處理器:
    apigee-service edge-message-processor stop
  3. 取消註冊伺服器類型:
    curl -u <AdminEmailID>:'<AdminPassword>' -X POST http://{MS_IP}:8080/v1/servers  \
    -d "type=message-processor&amp;region=dc-1&amp;pod=gateway-1&amp;uuid=UUID&amp;action=remove"/pre>
  4. Disassociate an environment from the Message Processor.

    Note: You need to remove the bindings on each org/env that associates the Message Processor UUID.

    curl -H "Content-Type:application/x-www-form-urlencoded" -u <AdminEmailID>:''  \
    -X POST http://{MS_IP}:8080/v1/organizations/{ORG}/environments/{ENV}/servers \
    -d "action=remove&uuid=UUID"
  5. 取消註冊伺服器類型:
    curl -u <AdminEmailID>:'<AdminPassword>' -X POST http://MS_IP:8080/v1/servers -d "type=message-processor&region=dc-1&pod=gateway-1&uuid=UUID&action=remove"
  6. 解除安裝訊息處理器:
    /opt/apigee/apigee-service/bin/apigee-service edge-message-processor uninstall
  7. 取消註冊伺服器:
    curl -u <AdminEmailID>:'<AdminPassword> -X DELETE http://{MS_IP}:8080/v1/servers/UUID

Qpid 伺服器和 Qpidd

本節說明如何停用 Qpid 伺服器 (edge-qpid-server) 和 Qpidd (apigee-qpidd)。 dc-1 中設定兩個 Qpid 節點,因此您必須為這兩個節點執行下列步驟:

  1. 按照「取得 UUID」一文的說明,取得 Qpidd 的 UUID。
  2. 停止 edge-qpid-serverapigee-qpidd
    /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server stop
    /opt/apigee/apigee-service/bin/apigee-service apigee-qpidd stop
  3. 取得 Analytics (分析) 和消費者群組的清單:
    curl -u <AdminEmailID>:'<AdminPassword>' -X GET http://{MS_IP}:8080/v1/analytics/groups/ax
  4. 將 Qpid 從消費者群組中移除:
    curl -u <AdminEmailID>:'<AdminPassword>' -H "Content-Type: application/json"  -X DELETE \ "http://{MS_IP}:8080/v1/analytics/groups/ax/{ax_group}/consumer-groups/{consumer_group}/consumers/{QPID_UUID}"
  5. 將 Qpid 從分析群組中移除:
    curl -v -u <AdminEmailID>:'<AdminPassword>' \
    -X DELETE "http://{MS_IP}:8080/v1/analytics/groups/ax/{ax_group}/servers?uuid={QPID_UUID}&type=qpid-server"
  6. 從 Edge 安裝作業中取消註冊 Qpid 伺服器:
    curl -u <AdminEmailID>:'<AdminPassword>' -X POST http://{MS_IP}:8080/v1/servers \
    -d "type=qpid-server&region=dc-1&pod=central&uuid={QPID_UUID}&action=remove"
  7. 從 Edge 安裝作業中移除 Qpid 伺服器:
    curl -u <AdminEmailID>:'<AdminPassword>' -X DELETE http://{MS_IP}:8080/v1/servers/UUID
  8. 重新啟動所有節點上的所有 Edge-qpid-server 元件,確保這些元件納入變更:
    $ /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server restart
    $ /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server wait_for_ready
  9. 解除安裝 Edge-qpid-server 和 apigee-qpidd:
    $ /opt/apigee/apigee-service/bin/apigee-service edge-qpid-server uninstall
    $ /opt/apigee/apigee-service/bin/apigee-service apigee-qpidd uninstall

Postgres 和 Postgresql

您停用的資料中心可能有 Postgres 主要執行個體或 Postgres 待命機器。以下各節說明如何停用:

停用 Postgres 大師

注意:如果您停用 Postgres 主要執行個體,請務必將任一可用待命節點升級為新的 Postgres 主要執行個體。雖然 QPID 會排入緩衝區資料,但如果 Postgres 主要執行個體長時間無法使用,可能會導致數據分析資料遺失。

如要停用 Postgres 主要執行個體:

  1. 按照下列連結的操作說明備份 dc-1 Postgres 主要節點:
  2. 按照取得 UUID 一文的說明,取得 Postgres 伺服器的 UUID。
  3. 在 dc-1 上,停止目前主要執行個體的 edge-postgres-serverapigee-postgresql
    /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server stop
    /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql stop
  4. 在 dc-2 的待命節點上,輸入下列指令,使其成為主要節點:
    /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql promote-standby-to-master <IP of OLD Progress master>

    注意:如果您有多個待命 Postgres 節點,您必須在新的主要執行個體中新增主機項目,並更新所有可用 Postgres 待命節點的複製設定。

    如要將主機項目新增至新的 Postgres 主要版本,請按照下方相關章節的步驟操作:

    如果只剩一個待命節點

    舉例來說,假設在停用前設定了三個 Postgres 節點。您已停用現有的主要執行個體,並將其中一個剩餘的 Postgres 待命節點升級為主要執行個體。請按照下列步驟設定剩餘的待命節點:

    1. 在新主要執行個體上編輯設定檔以設定:
      PG_MASTER=IP_or_DNS_of_new_PG_MASTER
      PG_STANDBY=IP_or_DNS_of_PG_STANDBY
    2. 啟用新主要執行個體的複製功能:
      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql setup-replication-on-master -f configFIle

    如果剩餘的待命節點超過一個

    1. /opt/apigee/customer/application/postgresql.properties 中新增下列設定:
      conf_pg_hba_replication.connection=host replication apigee standby_1_ip/32 trust \n host replication apigee standby_2_ip/32 trust
    2. 確保 Apigee 使用者擁有 /opt/apigee/customer/application/postgresql.properties 檔案:
            chown apigee:apigee /opt/apigee/customer/application/postgresql.properties
    3. 重新啟動「apigee-postgresql」:
      apigee-service apigee-postgresql restart
    4. 如要更新待命節點的複製設定:

      1. 修改設定檔 /opt/silent.conf,並將 PG_MASTER 欄位更新為新 Postgres 主要執行個體的 IP 位址。
      2. 使用下列指令移除所有舊的 Postgres 資料:
        rm -rf /opt/apigee/data/apigee-postgresql/
      3. 在待命節點上設定複製作業:
        /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql setup-replication-on-standby -f configFile
    5. 在 dc-2 中輸入以下指令,確認 Postgres 主要執行個體設定正確:
      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql postgres-check-master
    6. 從分析群組和消費者群組中移除並新增 Postgresql 伺服器。
      1. 按照 從分析群組移除 Postgres 伺服器的操作說明,將舊的 Postgres 伺服器從分析群組中移除。
      2. 按照 將現有的 Postgres 伺服器新增至分析群組中的操作說明,在分析群組中新增 Postgres 伺服器。
    7. 從 dc-1 取消註冊舊的 Postgres 伺服器:
      curl -u <AdminEmailID>:'<AdminPassword>' -X POST http://{MS_IP}:8080/v1/servers \
      -d "type=postgres-server&region=dc-1&pod=analytics&uuid=UUID&action=remove"<
    8. 從 dc-1 刪除舊的 Postgres 伺服器:
      curl -u >AdminEmailID>:'>AdminPassword>' -X DELETE http://{MS_IP}:8080/v1/servers/UUID
    9. 舊的 Postgres 大師現在已經可以安全停用。解除安裝「edge-postgres-server」和 apigee-postgresql
      /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server uninstall
      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql uninstall

    正在停用 Postgres 待機時間

    注意:12 節點叢集安裝的說明文件顯示 dc-1 postgresql 節點為主要執行個體,但為方便起見,本節假設 dc-1 postgresql 節點為待命,且 dc-2 postgresql 節點為主要節點。

    如要停用 Postgres 待命功能,請按照下列步驟操作:

    1. 按照取得 UUID 的操作說明,取得 Postgres 伺服器的 UUID。
    2. 停止 dc-1 中目前待命節點上的 apigee-postgresql
      /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server stop
      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql stop
    3. 從分析群組和消費者群組中移除並新增 Postgresql 伺服器。
      1. 按照 從分析群組移除 Postgres 伺服器的操作說明,將舊的 Postgres 伺服器從分析群組中移除。
      2. 按照 將現有的 Postgres 伺服器新增至分析群組中的操作說明,在分析群組中新增 Postgres 伺服器。
    4. 從 dc-1 取消註冊舊的 Postgres 伺服器:
      curl -u <AdminEmailID>:'<AdminPassword>' -X POST http://{MS_IP}:8080/v1/servers \
      -d "type=postgres-server&region=dc-1&pod=analytics&uuid=UUID&action=remove"<
    5. 從 dc-1 刪除舊的 Postgres 伺服器:
      curl -u >AdminEmailID>:'>AdminPassword>' -X DELETE http://{MS_IP}:8080/v1/servers/UUID
    6. 舊的 Postgres 大師現在已經可以安全停用。解除安裝「edge-postgres-server」和 apigee-postgresql
      /opt/apigee/apigee-service/bin/apigee-service edge-postgres-server uninstall
      /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql uninstall

    ZooKeeper 和 Cassandra

    本節說明如何在兩個資料中心設定中停用 ZooKeeper 和 Cassandra 伺服器。

    如果您有超過兩個資料中心,請務必將所有其他資料中心的無訊息設定檔 (在此例中為 dc-1) 參照全數移除。針對要停用的 Cassandra 節點,請從 CASS_HOSTS 捨棄這些主機。其餘 Cassandra 節點應維持 CASS_HOSTS 的原始順序。

    ZooKeeper 注意事項:修改設定檔中的 ZK_HOST 屬性時,您必須維護選民節點的仲裁,確保 ZooKeeper 綜合項目保持運作。設定中必須有奇數節點。詳情請參閱 Apache ZooKeeper 維護工作

    如要停用 ZooKeeper 和 Cassandra 伺服器:

    1. 按照以下連結中的操作說明備份 dc-1 Cassandra 和 ZooKeeper 節點:
    2. 列出資料中心內 ZooKeeper 和 Cassandra 伺服器的 UUID,因為 Cassandra 節點即將停用。

      apigee-adminapi.sh servers list -r dc-1 -p central -t application-datastore --admin <AdminEmailID> --pwd '<AdminPassword>' --host localhost
    3. 取消註冊伺服器類型:
      curl -u <AdminEmailID>:'<AdminPassword>' -X POST http://MS_IP:8080/v1/servers -d "type=cache-datastore&type=user-settings-datastore&type=scheduler-datastore&type=audit-datastore&type=apimodel-datastore&type=application-datastore&type=edgenotification-datastore&type=identityzone-datastore&type=user-settings-datastore&type=auth-datastore&region=dc-1&pod=central&uuid=UUID&action=remove"
    4. 取消註冊伺服器:
      curl -u <AdminEmailID>:'<AdminPassword>' -X DELETE http://MS_IP:8080/v1/servers/UUID
    5. 以已從 ZK_HOSTSCASS_HOSTS 中移除已停用節點的 IP 更新設定檔。

      範例:假設您在 dc-1 中有 IP $IP1 $IP2 $IP3,而 dc-2 中有 $IP4 $IP5 $IP6,而您將停用 dc-1。接著,您應該從設定檔中移除 IP $IP1 $IP2 $IP3

      • 現有的設定檔項目:
        ZK_HOSTS="$IP1 $IP2 $IP3 $IP4 $IP5 $IP6"
        CASS_HOSTS="$IP1:1,1 $IP2:1,1 $IP3:1,1, $IP4:2,1 $IP5:2,1 $IP6:2,1”
      • 新的設定檔項目:
        ZK_HOSTS="$IP4 $IP5 $IP6"
        CASS_HOSTS="$IP4:2,1 $IP5:2,1 $IP6:2,1"
    6. 使用已移除的已停用節點的 IP 更新無聲設定檔 (在步驟 e 中修改),然後在託管管理伺服器的所有節點上執行管理伺服器設定檔:
      /opt/apigee/apigee-setup/bin/setup.sh -p ms -f updated_config_file
    7. 使用已移除的已移除節點的 IP 更新設定檔,並在所有路由器和訊息處理器節點上執行 MP/RMP 設定檔:
      • 如果已在同一節點上設定邊緣路由器和訊息處理器,請輸入:
        /opt/apigee/apigee-setup/bin/setup.sh -p rmp -f updated_config_file
      • 如果在不同節點上設定邊緣路由器和訊息處理器,請輸入以下內容:

        路由器:

        /opt/apigee/apigee-setup/bin/setup.sh -p r -f updated_config_file

        訊息處理器:

        /opt/apigee/apigee-setup/bin/setup.sh -p mp -f updated_config_file
    8. 重新設定所有 Qpid 節點,並將停用節點的 IP 從回應檔案中移除:
      /opt/apigee/apigee-setup/bin/setup.sh -p qs -f updated_config_file
    9. 重新設定所有 Postgres 節點,並將已停用節點的 IP 從回應檔案中移除:
      /opt/apigee/apigee-setup/bin/setup.sh -p ps -f updated_config_file
    10. 修改 system_auth 鍵空間。如果您已為現有的 Cassandra 節點啟用 Cassandra 驗證,請執行下列指令,更新 system_auth 金鑰空間的複製係數:
      ALTER KEYSPACE system_auth WITH replication = {'class': 'NetworkTopologyStrategy', 'dc-2': '3'};

      這個指令會將複製係數設為 '3',指出叢集中的三個 Cassandra 節點。請視需要修改這個值。

      完成這個步驟後,Cassandra 拓撲在任何索引鍵空間中都不應有 dc-1

    11. 逐一停用 dc-1 中的 Cassandra 節點。

      如要停用 Cassandra 節點,請輸入下列指令:

      /opt/apigee/apigee-cassandra/bin/nodetool -h cassIP -u cassandra -pw '<AdminPassword>' decommission

    12. 使用下列其中一個指令檢查 dc-1 的 Cassandra 節點連線:
      /opt/apigee/apigee-cassandra/bin/cqlsh cassIP 9042 -u cassandra -p '<AdminPassword>'

      或是在已停用的節點上執行次要驗證指令:

      /opt/apigee/apigee-cassandra/bin/nodetool netstats

      上述指令應會傳回:

      Mode: DECOMMISSIONED

    13. 針對 dc-2 中的所有 Cassandra 和 ZooKeeper 節點執行 DS 設定檔:
      /opt/apigee/apigee-setup/bin/setup.sh -p ds -f updated_config_file
    14. 停止 dc-1 中的 apigee-cassandraapigee-zookeeper
      apigee-service apigee-cassandra stop
      apigee-service apigee-zookeeper stop
    15. 解除安裝 dc-1 中的 apigee-cassandraapigee-zookeeper
      apigee-service apigee-cassandra uninstall
      apigee-service apigee-zookeeper uninstall

    從 dc-1 刪除繫結

    如要從 dc-1 刪除繫結,請按照下列步驟操作:

    1. 從 dc-1 刪除繫結。
      1. 列出機構下所有可用的 Pod:
        curl -v -u  <AdminEmailID>:<AdminPassword> -X GET "http://MS_IP:8080/v1/o/ORG/pods"
      2. 如要檢查是否已移除所有繫結,請取得與 pod 相關聯的伺服器 UUID
        curl -v -u  <AdminEmailID>:<AdminPassword> \
        -X GET "http://MS_IP:8080/v1/regions/dc-1/pods/gateway-1/servers"

        如果這個指令未傳回任何 UUID,則先前的步驟會移除所有繫結,因此您可以略過下一步。否則,請執行下一個步驟。

      3. 移除您在上一個步驟中取得的 UUID 所有伺服器繫結:
        curl -u <AdminEmailID>:'<AdminPassword>' -X DELETE http://MS_IP:8080/v1/servers/UUID
      4. 取消機構與 Pod 的關聯:
        curl -v -u  <AdminEmailID>:<AdminPassword>  "http://MS_IP:8080/v1/o/ORG/pods" -d "action=remove&region=dc-1&pod=gateway-1" -H "Content-Type: application/x-www-form-urlencoded" -X POST
    2. 刪除 Pod:
      curl -v -u <AdminEmailID>:<AdminPassword> "http://MS_IP:8080/v1/regions/dc-1/pods/gateway-1" -X DELETE
    3. 刪除區域。
      curl -v -u <AdminEmailID>:<AdminPassword>  "http://MS_IP:8080/v1/regions/dc-1" -X DELETE

    注意:如果您錯過任一步驟刪除伺服器,上述步驟將傳回錯誤訊息,指出 Pod 中的特定伺服器仍然存在。因此,請按照下方的疑難排解步驟刪除這些項目,同時在 curl 指令中自訂類型。

    到目前為止,您已完成 dc-1 的停用作業。

    附錄

    疑難排解

    如果執行上述步驟後,某些 Pod 中仍有伺服器,請按照下列步驟取消註冊並刪除伺服器。注意:請視需要變更類型和 Pod。

    1. 使用下列指令取得 UUID
      apigee-adminapi.sh servers list -r dc-1 -p POD -t  --admin <AdminEmailID> --pwd  '<AdminPassword>’ --host localhost
    2. 取消註冊伺服器的類型:
      curl -u <AdminEmailID>:'<AdminPassword>' -X POST http://MP_IP:8080/v1/servers -d "type=TYPE=REGION=dc-1&pod=POD&uuid=UUID&action=remove"
    3. 逐一刪除伺服器:
      curl -u <AdminEmailID>:'<AdminPassword>' -X DELETE http://MP_IP:8080/v1/servers/UUID

    驗證

    您可以使用下列指令驗證停用作業。

    管理伺服器

    在所有區域的管理伺服器執行下列指令。

    curl -v  -u  <AdminEmailID>:'<AdminPassword>' http://MS_IP:8080/v1/servers?pod=central&region=dc-1
    curl -v  -u  <AdminEmailID>:'<AdminPassword>' http://MS_IP:8080/v1/servers?pod=gateway&region=dc-1
    curl -v -u  <AdminEmailID>:'<AdminPassword>'  http://MS_IP:8080/v1/servers?pod=analytics&region=dc-1

    對所有元件執行下列指令,檢查所有管理通訊埠的通訊埠需求。

    curl -v http://MS_IP:8080/v1/servers/self

    查看數據分析群組。

    curl  -v  -u  <AdminEmailID>:'<AdminPassword>' "http://MS_IP:8080}/v1/o/ORG/e/ENV/provisioning/axstatus"
    curl -v  -u  <AdminEmailID>:'<AdminPassword>'  http://MS_IP:8080/v1/analytics/groups/ax

    Cassandra/ZooKeeper 節點

    在所有 Cassandra 節點中,輸入:

    /opt/apigee/apigee-cassandra/bin/nodetool -h <host> statusthrift

    這會傳回該特定節點的 runningnot running 狀態。

    在一個節點上,輸入:

    /opt/apigee/apigee-cassandra/bin/nodetool -h <host> ring
    /opt/apigee/apigee-cassandra/bin/nodetool -h <host> status

    上述指令會傳回有效的資料中心資訊。

    在 ZooKeeper 節點上,請先輸入:

    echo ruok | nc <host> 2181

    這個指令會傳回 imok

    接著輸入:

    echo stat | nc <host> 2181 | grep Mode

    上述指令傳回的 Mode 值會是下列其中一項:observerleaderfollower

    在一個 ZooKeeper 節點中:

    /opt/apigee/apigee-zookeeper/contrib/zk-tree.sh >> /tmp/zk-tree.out.txt

    在 Postgres 主要節點上執行:

    /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql postgres-check-master

    驗證回應是否顯示節點是主要節點。

    在待命節點上:

    /opt/apigee/apigee-service/bin/apigee-service apigee-postgresql postgres-check-standby

    驗證回應是否顯示節點為待命。

    使用以下指令登入 PostgreSQL 資料庫

    psql -h localhost -d apigee -U postgres

    系統顯示提示時,請以 'postgres' 輸入「postgres」使用者密碼。從數據分析中選取 max(client_received_start_timestamp)

    ”$org.$env.fact” limit 1

    記錄檔

    檢查元件的記錄,確認沒有錯誤。