透過 Coherence*Web 導入 PIA Web Resiliency

使用 Coherence*Web 為您的 PeopleSoft Internet Architecture (PIA) Web 伺服器增加 Web 彈性。Coherence*Web 在每個 PIA Web 伺服器上設定並平行執行,但與 PIA WebLogic 伺服器分開執行。這稱為 Coherence*Web 的處理作業外拓樸。啟動兩個或多個 Coherence*Web 快取伺服器時,就會形成叢集。設定 Coherence*Web 之後,您將設定 PIA Web 伺服器與 Coherence*Web 搭配運作,然後再加入此叢集。

設定 Coherence*Web

設定啟動和管理 Coherence*Web 所需的基礎架構和命令檔。當您建立可啟動產品的指令碼時,在執行指令碼之前,您還可以完成一些任務。

在 PeopleTools 8.57 中,Coherence*Web 隨附於 Fusion Middleware 安裝。在此專案中,它位於目錄中:/u01/app/psft/pt/bea/coherence。這是所有 PIA Web 伺服器都可以存取的共用目錄。

  1. 建立 Coherence*Web 組態和日誌檔的目錄。
    • 節點:所有 PIA Web 伺服器節點
    • 使用者:psadm2
    $ . ./psft.env
    $ mkdir -p $PS_CFG_HOME/coherence/config
    $ mkdir -p $PS_CFG_HOME/coherence/log
  2. 編輯 psft.env 檔案,將下列環境變數新增至 psft.env 檔案。
    • 節點:所有 PIA Web 伺服器節點
    • 使用者:psadm2
    export COHERENCE_HOME=$BASE_DIR/pt/bea/coherence
    export COHERENCE_CONFIG=$PS_CFG_HOME/coherence/config
    export COHERENCE_LOG=$PS_CFG_HOME/coherence/log
    重新取得環境檔案的來源。
  3. 取得每個 PIA Web 伺服器運算執行處理的專用 IP 位址。

    在我們的專案中,每個 PIA Web 伺服器在 Coherence*Web 文件中都有一個專用 IP 位址,稱為 well-known-address (WKA)。後續步驟將需要這些專用 IP 位址。

    • 節點:所有 PIA Web 伺服器節點
    • 使用者:psadm2,OCI 主控台使用者
    1. 登入 OCI 主控台。
    2. 按一下運算,然後按一下執行處理
    3. 選取保存 Web 伺服器的區間。
    4. 按一下列出的每個 PIA Web 伺服器即可查看其專用 IP 位址。記錄地址。
  4. COHERENCE_CONFIG 目錄中建立 Coherence 覆寫檔案。
    您可以為檔案選擇任何名稱,但一般稱為 tangosol-coherence-override.xml,,並在數個 Coherence*Web 文件中以該名稱參照。
    • 節點:所有 PIA Web 伺服器節點
    • 使用者:psadm2
    XML 檔案的內容與下列類似:
    <?xml version="1.0"?>
    <!DOCTYPE coherence SYSTEM "coherence-override.dtd">
    <!--
    This operational configuration override file is set up for use with Coherence
    -->
    <coherence>
    <cluster-config>
    <unicast-listener>
      <well-known-addresses>
       <socket-address id="1">
          <address>10.0.103.85</address>
       </socket-address>
       <socket-address id="2">
          <address>10.0.103.203</address>
      </socket-address>
    </well-known-addresses>
    <port system-property="tangosol.coherence.localport">8088</port>
    <address system-property="coherence.localhost">10.0.103.0/24</address>
    </unicast-listener>
    </cluster-config>
    </coherence>
    1. 指定每個 PIA Web 伺服器的專用 IP 位址。
      此範例組態使用兩個 Web 伺服器。
    2. 將檔案置於 ALL PIA Web 伺服器上。內容必須相同。
    參數 <address system-property="coherence.localhost">10.0.103.0/24</address> 指定提供 PIA Web 伺服器的整個專用子網路。啟動 Coherence*Web 快取伺服器時,會取得執行它的本機主機專用 IP 位址。
  5. 建立將會在每個 PIA Web 伺服器的背景中啟動 Coherence*Web 快取伺服器的命令檔。
    如需範例指令碼,請參閱 startCacheServer.sh。它位於 GitHub 的包裝函式目錄中。
    • 節點:所有 PIA Web 伺服器節點
    • 使用者:psadm2

附註:

您將在設定 Coherence*Web 網路之後執行命令檔。

設定 Coherence*Web 網路

每個 PIA Web 伺服器均以隔離方式執行,不會與其他 Web 伺服器通訊。若要在此層提供跨伺服器的抗逆力,Coherence*Web 伺服器會形成一個叢集,並且需要一個網路組態,允許其快取伺服器相互通訊。

若要允許 Coherence*Web 形成快取叢集,請使用 OCI 主控台,將傳入和傳出規則新增至與 app_private_seclist 關聯的安全清單。除了連接埠 8088 和 8089 之外,您還可以使用 Coherence*Web 文件中指定的預設連接埠。

傳入規則:

無狀態 來源 CIDR IP 協定 來源連接埠範圍 目的地連接埠範圍
10.0.103.0/24 TCP 全部 7
10.0.103.0/24 UDP 全部 7
10.0.103.0/24 TCP 全部 7574
10.0.103.0/24 UDP 全部 7574
10.0.103.0/24 TCP 全部 8088-8089

傳出規則:

無狀態 目的地 CIDR IP 協定 來源連接埠範圍 目的地連接埠範圍
0.0.0.0/0 TCP 全部 全部
0.0.0.0/0 UDP 全部 全部
  1. 登入「OCI 主控台」。
  2. 將傳入和傳出規則新增至與 app_private_seclist 關聯的安全清單。
  3. 在每個運算執行處理上以 root 身分執行下列 firewall-cmd 命令,以啟用每個 PIA Web 運算執行處理上表格中所列的連接埠。
    修改您的環境。
    $ firewall-cmd --zone=public --add-rich-rule 'rule family=ipv4 source address=10.0.103.0/24 port port=7 protocol=tcp accept' –permanent
    $ firewall-cmd --zone=public --add-rich-rule 'rule family=ipv4 source address=10.0.103.0/24 port port=7 protocol=udp accept' –permanent
    $ firewall-cmd --zone=public --add-rich-rule 'rule family=ipv4 source address=10.0.103.0/24 port port=8088-8089 protocol=tcp accept' –permanent
    $ firewall-cmd --zone=public --add-rich-rule 'rule family=ipv4 source address=10.0.103.0/24 port port=7574 protocol=tcp accept' –permanent
    $ firewall-cmd --zone=public --add-rich-rule 'rule family=ipv4 source address=10.0.103.0/24 port port=7574 protocol=udp accept' --permanent
    $ firewall-cmd –reload
  4. 啟動第一個 Coherence*Web 快取伺服器 (iad-psft-hcm-web01)。

    使用位於 GitHub 之基本工作目錄中的 startCacheServer.sh 命令檔,在一個運算執行處理上發出下列命令作為 psadm2,以啟動快取伺服器。下列假設程序檔目錄位於管理員的 PATH 中。

    $ startCacheServer.sh
    啟動第一個快取伺服器時,輸出看起來會像下面這樣:
    …
    2022-08-31 21:15:11.539/0.639 Oracle Coherence 12.2.1.3.0 <Info> (thread=main, member=n/a): Loaded operational configuration from "jar:file:/u01/app/psft/pt/bea/coherence/lib/coherence.jar!/tangosol-coherence.xml" 
    …
    2022-08-31 21:15:16.137/5.237 Oracle Coherence GE 12.2.1.3.0 <Info> (thread=main, member=n/a): Started cluster Name=psadm2's cluster, ClusterPort=7574
    
    WellKnownAddressList(
      10.0.103.203
      10.0.103.85
      )
    
    MasterMemberSet(
      ThisMember=Member(Id=1, Timestamp=2022-08-31 21:15:12.825, Address=10.0.103.85:8088, MachineId=10879, Location=site:appprivatesu.ebscloudmaavcn.oraclevcn.com,machine:iad-psft-hcm-web01,process:21537, Role=CoherenceServer)
      OldestMember=Member(Id=1, Timestamp=2022-08-31 21:15:12.825, Address=10.0.103.85:8088, MachineId=10879, Location=site:appprivatesu.ebscloudmaavcn.oraclevcn.com,machine:iad-psft-hcm-web01,process:21537, Role=CoherenceServer)
      ActualMemberSet=MemberSet(Size=1
        Member(Id=1, Timestamp=2022-08-31 21:15:12.825, Address=10.0.103.85:8088, MachineId=10879, Location=site:appprivatesu.ebscloudmaavcn.oraclevcn.com,machine:iad-psft-hcm-web01,process:21537, Role=CoherenceServer)
        )
      MemberId|ServiceJoined|MemberState|Version
        1|2022-08-31 21:15:12.825|JOINED|12.2.1.3.0
      RecycleMillis=1200000
      RecycleSet=MemberSet(Size=0

    您可以看到 WellKnownAddresslist 區段中所列的 IP 位址,確認是否已正確挑選配置。

    由於您只啟動一個快取伺服器,因此只有一個成員 (啟動快取伺服器的運算執行處理):iad-psft-hcm-web01

  5. 使用相同的命令檔在第二個中間層運算執行處理 (iad-psft-hcm-web02) 上啟動快取伺服器。
    $ startCacheServer.sh
    它應該結合叢集,且日誌檔看起來應該類似以下所示:
    …
    
    2022-08-31 21:15:36.513/0.628 Oracle Coherence 12.2.1.3.0 <Info> (thread=main, member=n/a): Loaded operational configuration from "jar:file:/u01/app/psft/pt/bea/coherence/lib/coherence.jar!/tangosol-coherence.xml" 
    …
    2022-08-31 21:15:38.307/2.421 Oracle Coherence GE 12.2.1.3.0 <Info> (thread=main, member=n/a): Started cluster Name=psadm2's cluster, ClusterPort=7574
    
    WellKnownAddressList(
      10.0.103.203
      10.0.103.85
      )
    
    MasterMemberSet(
      ThisMember=Member(Id=2, Timestamp=2022-08-31 21:15:37.981, Address=10.0.103.203:8088, MachineId=10880, Location=site:appprivatesu.ebscloudmaavcn.oraclevcn.com,machine:iad-psft-hcm-web02,process:12859, Role=CoherenceServer)
      OldestMember=Member(Id=1, Timestamp=2022-08-31 21:15:12.825, Address=10.0.103.85:8088, MachineId=10879, Location=site:appprivatesu.ebscloudmaavcn.oraclevcn.com,machine:iad-psft-hcm-web01,process:21537, Role=CoherenceServer)
      ActualMemberSet=MemberSet(Size=2
        Member(Id=1, Timestamp=2022-08-31 21:15:12.825, Address=10.0.103.85:8088, MachineId=10879, Location=site:appprivatesu.ebscloudmaavcn.oraclevcn.com,machine:iad-psft-hcm-web01,process:21537, Role=CoherenceServer)
        Member(Id=2, Timestamp=2022-08-31 21:15:37.981, Address=10.0.103.203:8088, MachineId=10880, Location=site:appprivatesu.ebscloudmaavcn.oraclevcn.com,machine:iad-psft-hcm-web02,process:12859, Role=CoherenceServer)
        )
      MemberId|ServiceJoined|MemberState|Version
        1|2022-08-31 21:15:12.825|JOINED|12.2.1.3.0,
        2|2022-08-31 21:15:37.981|JOINED|12.2.1.3.0
      RecycleMillis=1200000
      RecycleSet=MemberSet(Size=0
        )
    
    …

    上方的日誌檔片段顯示叢集中的兩個成員,這兩個成員的角色為 CoherenceServer

  6. 查看您在運算執行處理 iad-psft-hcm-web01 上第一次啟動的快取伺服器日誌檔。您應該會看到與下列類似的項目,顯示已建立與 iad-psft-hcm-web02 的連線。
    2022-08-31 21:15:38.179/27.279 Oracle Coherence GE 12.2.1.3.0 <D6> (thread=Cluster, member=1): TcpRing connected to Member(Id=2, Timestamp=2022-08-31 21:15:37.981, Address=10.0.103.203:8088, MachineId=10880, Location=site:appprivatesu.ebscloudmaavcn.oraclevcn.com,machine:iad-psft-hcm-web02,process:12859, Role=CoherenceServer)

    您第一次一次啟動一個快取伺服器,並檢查每一個伺服器,以確認是否正確設定。展望未來,當您需要啟動中間層時,您可以一次啟動所有 Coherence*Web 快取伺服器。

  7. 如果您在每個運算執行處理上只看到一個成員,則 Coherence*Web 快取伺服器無法彼此「查看」。
    這是由一或多個網路連接埠被封鎖所造成。測試被封鎖之連接埠的一種方式是使用 Netcat (nc) 公用程式,此公用程式必須安裝在每個 PIA Web 運算執行處理上。
    1. 使用 yumroot 使用者身分在每個 PIA Web 運算執行處理上安裝 nc) 公用程式
      # yum install -y nc
    2. root 身分登入,測試 PIA Web 伺服器上 TCP 和 UDP 封包的連接埠。
      例如,若要測試 iad-psft-web01 上是否開啟連接埠 7574,請啟動監聽連接埠 7574 上 UDP 封包的 Netcat 監聽器:
      # nc -u -l iad-psft-web01 7574

      nc 命令將等待,讓它坐在那裡。

    3. 在不同的階段作業中,以 root 身分登入 iad-psft-web02。啟動在連接埠 7574 上連線至 iad-psft-web01 的 Netcat UDP 用戶端:
       # nc -u iad-psft-web01 7574

      nc 指令將等待。

    4. 在該終端機上,輸入像是 "test" 的內容,然後按 Enter 鍵。
      "test" 這個字會顯示在其他終端機上。
    5. nc 監聽的伺服器終端機上鍵入 "test",然後按 Enter 鍵。
      它應該會顯示在用戶端終端機中。
    6. 如果測試成功,請切換角色並在 iad-psft-web02iad-psft-web01 上執行 nc 監聽器,然後重複測試。
    7. 如果測試失敗,則下列一或多項可能是原因:
      • PIA Web 伺服器子網路的相關安全清單中沒有允許連接埠 7574 使用 UDP 通訊協定的傳入規則。
      • PIA Web 伺服器子網路的相關安全清單中沒有允許連接埠 7574 使用 UDP 協定的傳出規則。
      • 尚未在每個 PIA Web 伺服器上執行 firewall-cmd 指令,以允許連接埠 7574 的 UDP 流量。
      Coherence*Web 提供資料包測試公用程式,可測試 TCP 和 UDP 的連線。如需進一步的詳細資訊,請參閱使用資料包測試公用程式

設定 Coherence*Web 的 PIA Web 伺服器

在所有 PIA Web 伺服器運算執行處理上設定並執行 Coherence*Web 快取伺服器之後,您現在可以設定 PIA Web 伺服器。

PeopleTools 組態檔的最新版本已經有大部分的必要組態,加上註解。若要啟用 Coherence*Web 快取伺服器的存取,請依照步驟進行調整,並適當地為您的環境進行調整。

psadm2 使用者身分在所有 PIA Web 伺服器節點上執行下列作業。

  1. 請確定 weblogic.xml 檔案中所有 PIA Web 伺服器的階段作業 Cookie 和網路網域名稱相同。weblogic.xml 檔案位於 $PS_CFG_HOME/ webserv/HR92U033/applications/peoplesoft/PORTAL.war/WEB-INF。在此範例中,網域為 HR92U033
  2. 在相同的 weblogic.xml 檔案中,將 end comment 字串從 <persistent-store-type>coherence-web</persistent-store-type> 標記下方移至其上方,因此不再是註解的一部分:
    下列是 weblogic.xml 檔案的範例:
    <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
    <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/weblogic-web-app">
    <description>PeopleSoft Internet Architecture</description>
      <session-descriptor>
      <id-length>32</id-length>
      <cookie-name>iad-hcm-8080-PORTAL-PSJSESSIONID</cookie-name>
      <cookie-domain>.appprivatesu.ebscloudmaavcn.oraclevcn.com</cookie-domain>
      <monitoring-attribute-name>USERID</monitoring-attribute-name>
      <persistent-store-table>wl_servlet_sessions</persistent-store-table>
      <http-proxy-caching-of-cookies>true</http-proxy-caching-of-cookies>
    <!-- Coherence*Web
    -->
      <persistent-store-type>coherence-web</persistent-store-type>
      </session-descriptor>
        <container-descriptor>
          <servlet-reload-check-secs>-1</servlet-reload-check-secs>
          <session-monitoring-enabled>true</session-monitoring-enabled>
      </container-descriptor>
      <context-root>/</context-root>
    </weblogic-web-app>
  3. web.xml 檔案中,將區段從 "Coherence*Web parameters" 開始取消註解。本節包含 Coherence*Web 的所有必要參數。
    web.xml 檔案與 weblogic.xml 檔案位於相同的目錄中。
    下列是此特定區段的範例:
    <!-- Coherence*Web parameters
    -->
      <context-param>
        <description>With this set to "true", attributes that are deemed to be
          mutable (detected with a simple check) and which are accessed through a get,
          are deemed to be suspect in that they may have been changed in application code.
          Suspect attributes are treated as changed. Defaults to "false".</description>
        <param-name>coherence-enable-suspect-attributes</param-name>
        <param-value>true</param-value>
      </context-param>
      <context-param>
        <description>This value specifies a class name of the optional
          com.tangosol.coherence.servlet.HttpSessionCollection.AttributeScopeController
          interface implementation to use.</description>
        <param-name>coherence-scopecontroller-class</param-name>
        <param-value>com.tangosol.coherence.servlet.AbstractHttpSessionCollection$GlobalScopeController</param-value>
      </context-param>
      <context-param>
        <description>Specifies a cache delegator class that is responsible for manipulating
         (getting, putting, or deleting) data in the distributed cache
        </description>
        <param-name>coherence-cache-delegator-class</param-name>
        <param-value>com.tangosol.coherence.servlet.LocalSessionCacheDelegator</param-value>
      </context-param>
      <context-param>
        <description>This value, if set to true, specifies that non-serializable attributes
          should be preserved as local ones. This parameter requires a load balancer to
          be present to retrieve non-serializable attributes for a session
        </description>
        <param-name>coherence-preserve-attributes</param-name>
        <param-value>true</param-value>
      </context-param>
      <context-param>
        <description>
          This value specifies a class name of the com.tangosol.coherence.servlet.HttpSessionCollection
          $SessionDistributionController interface implementation
        </description>
        <param-name>coherence-distributioncontroller-class</param-name>
        <param-value>com.tangosol.coherence.servlet.AbstractHttpSessionCollection$HybridController</param-value>
      </context-param>
  4. 將其他參數新增至位於 $PS_CFG_HOME/webserver/HR92U033/bin 目錄中的 PIA setEnv.sh
    此檔案中有 Coherence 的註解。以下是新增 PIA Web 啟動參數之 setEnv.sh 檔案的程式碼片段:
    下列是此特定區段的範例:
    # Coherence*Web related parameters
    # COHERENCE_PARAMETERS=-Dtangosol.coherence.session.localstorage=false
    # Optionally add -Dtangosol.coherence.override=file:OVERRIDE_FILE_PATH
    COHERENCE_PARAMETERS="-Dtangosol.coherence.override=file:/peoplesoft/local/ps_config/coherence/config/tangosol-coherence-override.xml -Dtangosol.coherence.session.localstorage=false -Djava.net.preferIPv4Stack=true"
    # Example: JAVA_OPTIONS_LINUX="$JAVA_OPTIONS_LINUX $COHERENCE_PARAMETERS"
    # export JAVA_OPTIONS_LINUX
    JAVA_OPTIONS_LINUX="$JAVA_OPTIONS_LINUX $COHERENCE_PARAMETERS"
    export JAVA_OPTIONS_LINUX
    # Refer to Coherence*Web documentation
    注意事項:
    • 每個參數前面會有連字號 (文字換行可能會分割顯示畫面)
    • 您必須先定義 COHERENCE_PARAMETERS,才能匯出 JAVA_OPTION_LINUX
    • 您必須指定 Dtangosol.coherence.override=file:/peoplesoft/local/ps_config/coherence/config/tangosol-coherence-override.xml,讓 PIA WebLogic 伺服器能夠正確註冊為 Coherence*Web 從屬端。
  5. 使用自訂的 PeopleSoft 啟動命令檔和關閉命令檔重新啟動 PIA Web 伺服器。
    $ stopWS.sh 
    $ startWS.sh
  6. 對每個 PIA Web 伺服器節點重複這些步驟。
當每次重新啟動 PIA Web 伺服器時,它會將 Coherence*Web 快取伺服器叢集作為從屬端加入。每個快取伺服器日誌都應該顯示建立連線的 WebLogic 伺服器,以及以 WeblogicServer 角色加入叢集。這裡是紀錄中的片段 :
2021-10-28 23:27:01.237/160.748 Oracle Coherence GE 12.2.1.3.0 <D6> (thread=Cluster, member=1): TcpRing connected to Member(Id=3, Timestamp=2021-10-28 23:27:01.044, Address=10.0.103.85:8089, MachineId=10879, Location=site:appprivatesu.ebscloudmaavcn.oraclevcn.com,machine:iad-psft-hcm-web01,process:16067, Role=WeblogicServer)
…
2021-10-28 23:28:14.958/234.469 Oracle Coherence GE 12.2.1.3.0 <D6> (thread=Cluster, member=1): TcpRing connecting to Member(Id=4, Timestamp=2021-10-28 23:28:14.768, Address=10.0.103.203:8089, MachineId=10880, Location=site:appprivatesu.ebscloudmaavcn.oraclevcn.com,machine:iad-psft-hcm-web02,process:14708, Role=WeblogicServer)

每個 PIA Web 伺服器上的快取伺服器記錄應該會顯示類似上述的內容。PeopleSoft 部署現在具有 Web 伺服器復原能力。

測試 PIA Web 彈性

執行以下步驟以測試並驗證 Coherence*Web 是否提供 Web 復原能力。

  1. 關閉一個 PIA Web 伺服器以外的所有伺服器。
  2. 使用 Web 瀏覽器登入 PeopleSoft 應用程式。
  3. 四處導覽,進行一些工作。啟動交易,但是不完成它。
  4. 啟動第二個 PIA Web 伺服器,讓它完全啟動。從 OCI 主控台檢查負載平衡器,以確保第二個 PIA Web 伺服器的狀態顯示確定
  5. 關閉步驟 1 中離開的 PIA Web 伺服器。
  6. 在連線至 PeopleSoft 應用程式的 Web 瀏覽器中,繼續您的交易。
    您可能會偵測到稍微暫停,但您不會收到錯誤、需要重新登入,或是遺失任何工作。
    如果發生錯誤 (例如「未授權的記號」),請複查下列各項:
    • 所有 PIA Web 伺服器 weblogic.xml 檔案的階段作業 Cookie 和網域名稱都必須相同。
    • OCI 負載平衡器後端集必須設定啟用應用程式 Cookie 持續性,而且必須指定 Cookie 名稱。
    • 所有 Coherence*Web 快取伺服器必須能夠相互查看並形成叢集。
    • 所有 PIA Web 伺服器都必須以 WeblogicServer 用戶端的形式加入快取伺服器叢集。
    • 再次檢查網路組態,包括安全清單傳入和傳出規則、firewall-cmd 命令等等。