使用 Coherence*Web 实施 PIA Web Resiliency

使用 Coherence*Web 为 PeopleSoft Internet 体系结构 (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 服务器都有一个专用 IP 地址,在 Coherence*Web 文档中称为已知地址 (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. 将文件放置在所有 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 中的 Wrapper 目录中。
    • 节点:所有 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 中 Basic Tasks 目录中的 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 包的端口。
      例如,要测试端口 7574 是否在 iad-psft-web01 上打开,请启动 Netcat 侦听器,该侦听端口 7574 上的 UDP 数据包:
      # 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. 在该终端上,键入类似“测试”的内容,然后按 Enter 键。
      “test”一词应显示在另一个终端上。
    5. nc 正在监听的服务器终端上键入 "test",然后按 Enter 键。
      它应显示在客户机终端中。
    6. 如果测试成功,则切换角色并在 iad-psft-web02 上运行 nc 侦听器,在 iad-psft-web01 上运行客户机,然后重复测试。
    7. 如果测试不成功,则可能是以下一个或多个原因:
      • PIA Web 服务器子网的相关安全列表中没有允许端口 7574 使用 UDP 协议的入站规则。
      • PIA Web 服务器子网的相关安全列表中没有允许端口 7574 的 UDP 协议的出站规则。
      • 尚未在每个 PIA Web 服务器上运行 firewall-cmd 命令,以允许端口 7574 的 UDP 通信。
      Coherence*Web 提供了一个数据报测试实用程序来测试 TCP 和 UDP 的连接。有关详细信息,请参阅 Using the Datagram Test Utility

为 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 参数”开头的部分。此部分包含 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 的注释。下面是 setEnv.sh 文件的片段,我们在其中添加了 PIA Web 启动参数:
    下面是此特定部分的一个示例:
    # 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
    注意:
    • 每个参数前面紧邻连字符(单词换行可能会拆分显示内容)
    • 必须在导出 JAVA_OPTION_LINUX 之前定义 COHERENCE_PARAMETERS
    • 必须指定 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 高速缓存服务器集群。每个高速缓存服务器日志都应显示建立连接并以 WeblogicServer 角色加入群集的 WebLogic 服务器。下面是日志中的片段:
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 命令等。