配置 Liberty 集合体

可以将 Liberty 服务器组织成集合体以支持一次对多个 Liberty 服务器执行建立集群、管理及其他操作,以便高效而准确地为组织提供应用程序服务。

适用于已分发平台适用于 IBM i 平台

开始之前

collectiveController-1.0 功能部件及其功能仅在 WebSphere® Application Server Liberty Network Deployment 和 WebSphere Application Server Liberty for z/OS® 中可用。此功能部件在 WebSphere Application Server Liberty、WebSphere Application Server Liberty - Express 或 WebSphere Application Server Liberty Core 中不可用。如果具有 WebSphere Application Server Liberty Network Deployment 安装,那么可使用其 collectiveController-1.0 功能部件来处理 WebSphere Application Server Liberty、WebSphere Application Server Liberty - Express 或 WebSphere Application Server Liberty Core 安装中的集合体成员。

关于此任务

Liberty 集合体是一组 Liberty 服务器,配置为同一个管理与运营域的一部分。

有关 Liberty 集合体的配置和状态数据保存在活动的运作存储库中。

Liberty 集合体中的成员资格可选。Liberty 服务器通过向集合体控制器注册成为成员,从而加入集合体。成员通过控制器的运作存储库来共享有关它们自己的信息。

下列规则适用:
  • Liberty 服务器只能是一个集合体的成员。
  • 同一个主机上的不同 Liberty 服务器可以位于不同集合体中。
  • 同一个主机上作为集合体成员的 Liberty 服务器可与不是集合体成员的 Liberty 服务器共存。

多媒体 观看: 视频:创建集合体的简介演示了此过程。WASdev Web 站点上提供了此视频和有关集合体的其他信息。[抄本]

过程

  1. 创建和配置控制器。
    1. 创建要用作集合体控制器的服务器。
      wlp/bin/server create myController
    2. 创建集合体控制器配置。

      这主要由用来在控制器和成员之间进行安全通信的管理域安全性配置组成。

      wlp/bin/collective create myController --keystorePassword=controllerKSPassword
      [8.5.5.2 或更高版本]缺省情况下,此 collective 命令将输出写至控制台屏幕。在下一步中,将输出复制到 server.xml 文件。 要将输出写至文件而不是控制台屏幕,请指定可选 --createConfigFile=outputFilePath 参数;例如:
      wlp/bin/collective create myController --keystorePassword=controllerKSPassword --createConfigFile=c:/wlp/usr/servers/myController/collective-create-include.xml
      运行 create 命令后,将显示要使用的 include 语句。要在集合体配置中包含所输出文件,请将 include 语句添加至 server.xml 文件;例如:
      <include location="c:\wlp\usr\servers\myController\collective-create-include.xml" />
    3. 更新集合体控制器的 server.xml 文件。
      • 复制并粘贴输出。

        如果此命令将输出写至控制台屏幕:

        1. 将 collective 命令的输出复制并粘贴到 server.xml 文件中。
        2. 对集合体指定管理用户标识和密码值。例如,将
          <quickStartSecurity userName="" userPassword="" />
          更改为:
          <quickStartSecurity userName="adminUser" userPassword="adminPassword" />
        集合体控制器 server.xml 文件的缺省路径为 ${wlp.install.dir}/usr/servers/myController/server.xml,如果在 server.env 文件或命令窗口中设置了 $WLP_USER_DIR 变量,那么缺省路径为 $WLP_USER_DIR/servers/myController/server.xml。编辑后,文件类似以下所示:
        <server description="controller server">
        
            <!-- Enable features -->
        
            <featureManager>
                <feature>jsp-2.2</feature>
            </featureManager>
        
            <httpEndpoint id="defaultHttpEndpoint"
                          host="*"
                          httpPort="9080"
                          httpsPort="9443" />
        
            <featureManager>
                <feature>collectiveController-1.0</feature>
            </featureManager>
        
            <!-- Define the host name for use by the collective.
            If the host name needs to be changed, the server should be
            removed from the collective and re-joined or re-replicated. -->
        
            <variable name="defaultHostName" value="controllerHostname" />
        
            <!-- TODO: Set the security configuration for Administrative access -->
        
            <quickStartSecurity userName="adminUser" userPassword="adminPassword" />
        
            <!-- clientAuthenticationSupported set to enable bidirectional trust -->
        
            <ssl id="defaultSSLConfig"
                 keyStoreRef="defaultKeyStore"
                 trustStoreRef="defaultTrustStore"
                 clientAuthenticationSupported="true" />
        
            <!-- inbound (HTTPS) keystore -->
            <keyStore id="defaultKeyStore" password="yourPassword"
                      location="${server.config.dir}/resources/security/key.jks" />
        
            <!-- inbound (HTTPS) truststore -->
            <keyStore id="defaultTrustStore" password="yourPassword"
                      location="${server.config.dir}/resources/security/trust.jks" />
        
            <!-- server identity keystore -->
            <keyStore id="serverIdentity" password="yourPassword"
                      location="${server.config.dir}/resources/collective/serverIdentity.jks" />
        
            <!-- collective trust keystore -->
            <keyStore id="collectiveTrust" password="yourPassword"
                      location="${server.config.dir}/resources/collective/collectiveTrust.jks" />
        
            <!-- collective root signers keystore -->
            <keyStore id="collectiveRootKeys" password="yourPassword"
                      location="${server.config.dir}/resources/collective/rootKeys.jks" />
        </server>
      • [8.5.5.2 或更高版本]添加 include 语句。
        如果已使用 --createConfigFile=outputFilePath 参数将输出写至文件,请将 include 语句添加至 $WLP_USER_DIR/servers/myController/server.xml 以在集合体配置中包含所输出文件;例如:
        <server description="controller server">
        
            <!-- Enable features -->
        
            <featureManager>
                <feature>jsp-2.2</feature>
            </featureManager>
        
            <httpEndpoint id="defaultHttpEndpoint"
                          host="*"
                          httpPort="9080"
                          httpsPort="9443" />
        
            <include location="c:\wlp\usr\servers\myController\collective-create-include.xml" />
        
        </server>
        确保所输出文件对集合体设置了管理用户标识和密码值;例如:
        <quickStartSecurity userName="adminUser" userPassword="adminPassword" />
    4. 启动集合体控制器服务器。
      wlp/bin/server start myController
      图 1. 集合体 1
      集合体 1
    5. 验证集合体控制器服务器是否正确启动及其是否准备好接收成员。
      1. 使用编辑器打开集合体控制器消息日志 $WLP_USER_DIR/servers/myController/logs/messages.log
      2. 查找以下消息:
        CWWKX9003I: CollectiveRegistration MBean 可用。
  2. 创建并配置成员以加入集合体。

    控制器和成员可以在不同主机上。在此示例中,控制器和成员在相同主机上。

    1. 创建成员服务器。
      wlp/bin/server create myMember
    2. 加入该成员。

      运行集合体 join 命令以使该服务器加入集合体成为其成员。join 命令需要与集合体控制器的网络连接及管理用户标识和密码以对控制器执行 MBean 操作。查看集合体控制器的 server.xml 文件以查找 --host--port--user--password 参数的值。对于 --keystorePassword,设置要用于成员密钥库密码的值,例如,memberKSPassword。可对加入集合体的每个服务器指定不同 --keystorePassword 值。要获取有关这些必需参数和可选参数的信息,请在命令行运行 collective help join

      wlp/bin/collective join myMember --host=controllerHostname --port=9443 --user=adminUser --password=adminPassword --keystorePassword=memberKSPassword

      [8.5.5.4 或更高版本]缺省情况下,join 操作保留远程过程调用 (RPC) 凭证为未定义状态,要求您对 rpcUserrpcUserPassword 指定值,并对成员服务器所在的主机指定操作系统登录用户和密码。如果已向集合体控制器注册成员主机,请指定可选 --useHostCredentials 参数以允许该成员通过它在控制器上的主机注册继承 RPC 凭证。指定 --useHostCredentials 会将 <hostAuthInfo useHostCredentials="true" /> 添加至成员 server.xml 文件。然后,您可在不指定 RPC 凭证的情况下运行集合体成员服务器命令(例如,startstop),因为成员从其主机继承凭证。有关 hostAuthInfo--useHostCredentials 参数及将集合体控制器连接至服务器的信息,请参阅覆盖 Liberty 服务器主机信息

      [8.5.5.2 或更高版本]要将此集合体命令的输出写至文件,而不是控制台屏幕,请指定可选 --createConfigFile=outputFilePath 参数。然后,通过将 include 语句添加至成员 server.xml 文件以在集合体配置中包含所输出文件:
      <include location=outputFilePath />
    3. 如果系统提示您接受证书链,请输入 y(是)。
    4. 更新成员 server.xml 文件。
      • 复制并粘贴输出。

        如果此命令将输出写至控制台屏幕:

        1. 从集合体命令复制输出并将其粘贴至成员 server.xml 文件。
        2. 修改端口,以便服务器可以打开其 HTTP 端口。确保成员 server.xml 在其主机上设置独有 HTTP 端口号。例如,如果该成员与集合体控制器在同一主机上,请更改 HTTP 端口号:
          <httpEndpoint id="defaultHttpEndpoint" httpPort="9081" httpsPort="9444" />
          (可选)要从远程客户机访问成员服务器,也应在 httpEndpoint 元素中设置 host="*"
        $WLP_USER_DIR/servers/myMember/server.xml 中,例如:
        <server description="member server">
        
            <!-- Enable features -->
        
            <featureManager>
                <feature>jsp-2.2</feature>
            </featureManager>
        
            <httpEndpoint id="defaultHttpEndpoint"
                          host="*"
                          httpPort="9081"
                          httpsPort="9444" />
        
            <featureManager>
                <feature>collectiveMember-1.0</feature>
            </featureManager>
        
            <!-- Define the host name for use by the collective.
            If the host name needs to be changed, the server should be
            removed from the collective and re-joined or re-replicated. -->
        
            <variable name="defaultHostName" value="memberHostname" />
        
        [8.5.5.4 或更高版本]<!-- Remote host authentication configuration -->
            <hostAuthInfo rpcUser="admin_user_id" rpcUserPassword="admin_user_password" />
        
            <!-- Connection to the collective controller -->
            <collectiveMember controllerHost="controllerHostname"
                              controllerPort="9443" />
        
            <!-- clientAuthenticationSupported set to enable bidirectional trust -->
        
            <ssl id="defaultSSLConfig"
                 keyStoreRef="defaultKeyStore"
                 trustStoreRef="defaultTrustStore"
                 clientAuthenticationSupported="true" />
        
            <!-- inbound (HTTPS) keystore -->
            <keyStore id="defaultKeyStore" password="yourPassword"
                      location="${server.config.dir}/resources/security/key.jks" />
        
            <!-- inbound (HTTPS) truststore -->
            <keyStore id="defaultTrustStore" password="yourPassword"
                      location="${server.config.dir}/resources/security/trust.jks" />
        
            <!-- server identity keystore -->
            <keyStore id="serverIdentity" password="yourPassword"
                      location="${server.config.dir}/resources/collective/serverIdentity.jks" />
        
            <!-- collective truststore -->
            <keyStore id="collectiveTrust" password="yourPassword"
                      location="${server.config.dir}/resources/collective/collectiveTrust.jks" />
        </server>
      • [8.5.5.2 或更高版本]添加 include 语句。
        如果已使用 --createConfigFile=outputFilePath 参数将输出写至文件,请将 include 语句添加至 $WLP_USER_DIR/servers/myMember/server.xml 以包含所输出文件;例如:
        <server description="member server">
        
            <!-- Enable features -->
        
            <featureManager>
                <feature>jsp-2.2</feature>
            </featureManager>
        
            <httpEndpoint id="defaultHttpEndpoint"
                          host="*"
                          httpPort="9081"
                          httpsPort="9444" />
        
            <include location="c:\wlp\usr\servers\myMember\collective-join-include.xml" />
        
        </server>
    5. [8.5.5.4 或更高版本]如果未在 join 命令中指定 --useHostCredentials,请在成员 server.xml 文件或所输出文件中对 hostAuthInfo 设置 RPC 凭证。 可通过下列两者中的任何一种方式对成员服务器设置 RPC 凭证:
      • 设置 hostAuthInfo RPC 用户和密码值。将 rpcUser 设置为在成员服务器所在的主机的操作系统登录用户标识,并将 rpcUserPassword 设置为该用户标识的操作系统登录密码。例如,如果使用用户 test1 和密码 test1pwd 登录成员计算机,请将 hostAuthInfo 元素更改为以下内容:
        <hostAuthInfo rpcUser="test1" rpcUserPassword="test1pwd" />
      • 如果已向集合体控制器注册成员主机,请将 hostAuthInfo useHostCredentials 设置为 true 以便该成员服务器从其主机继承 RPC 凭证。
        <hostAuthInfo useHostCredentials="true" />

      有关 hostAuthInfo 设置的信息及说明如何注册成员主机并运行带 --useHostCredentialsjoin 命令的示例,请参阅覆盖 Liberty 服务器主机信息

    6. 启动成员服务器。
      wlp/bin/server start myMember
      图 2. 简单集合体
      简单集合体
    7. 请验证成员服务器是否已正确启动并正向控制器发布信息。
      1. 使用编辑器打开成员消息日志 $WLP_USER_DIR/servers/myMember/logs/messages.log
      2. 按任意顺序查找以下消息:
        CWWKX8112I: 服务器的主机信息已成功发布至集合体存储库。CWWKX8114I: 服务器的路径已成功发布至集合体存储库。CWWKX8116I: 服务器已启动状态已成功发布至集合体存储库。

用于指示主题类型的图标 任务主题

信息中心的条款和条件 | 反馈


时间戳记图标 最近一次更新时间: Wednesday, 2 September 2015
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=phil&product=was-libcore-mp&topic=tagt_wlp_configure_collective
文件名:tagt_wlp_configure_collective.html