Deploying scaling policies to a Liberty collective

You can use the scaling-metadata.xml file to set scaling policies for an auto-scalable cluster. The scaling-metadata.xml file uses XML format and does not exist by default. You must create the file and place it in a cluster member configuration directory. After creating the scaling-metadata.xml file, you can deploy it through a server package to a Liberty collective.

Procedure

  1. Create an auto-scalable cluster with <scalingMember metadataMonitorEnabled="true"/> in its configuration. Optionally, specify a cluster name for the collective member.

    The following example defines an auto-scalable cluster member in a cluster named cluster1:

    <featureManager>
        <feature>collectiveMember-1.0</feature>
        <feature>clusterMember-1.0</feature>
        <feature>scalingMember-1.0</feature>
    </featureManager>
    <clusterMember name="cluster1"/>
    <scalingMember metadataMonitorEnabled="true"/>

    This example changes two default settings:

    • The <clusterMember name="cluster1"/> statement assigns the member to the cluster1 cluster. This statement is optional. Without this statement, the cluster member is assigned to defaultCluster.
    • The <scalingMember metadataMonitorEnabled="true"> statement enables monitoring for the scaling-metadata.xml file. The default is metadataMonitorEnabled="false", which disables monitoring.

    Optionally, you can omit <feature>clusterMember-1.0</feature> from the auto-scalable cluster configuration because the scalingMember-1.0 feature enables the clusterMember-1.0 feature. The clusterMember-1.0 feature is shown in this example for clarity.

    For information about creating an auto-scalable cluster, see Configuring auto-scalable clusters for JVM elasticity.

  2. Create a text file named scaling-metadata.xml that defines a scaling policy.
    <?xml version="1.0" encoding="UTF-8" ?>
    <server description="Scaling Policy for cluster1">
         <scalingDefinitions>
              <scalingPolicy name="cluster1">
                   ...
                   <bind clusters="cluster1"/>
              </scalingPolicy>
         </scalingDefinitions>
    </server>

    The bind element must specify the name of the cluster to be deployed in a server package. In this example, the bind element specifies cluster1. If your cluster member definition does not specify a cluster name, specify defaultCluster.

  3. Place the scaling-metadata.xml file in the cluster member configuration directory.

    The directory is ${wlp.install.dir}/usr/servers/cluster_member_name or, if the $WLP_USER_DIR variable is set in a server.env file or command window, $WLP_USER_DIR/servers/cluster_member_name.

    The product deploys the scaling policy to the collective repository when the following events occur:

    • The cluster member connects with the controller, such as when the cluster member starts
    • The clusterMember feature name attribute changes
    • The scaling-metadata.xml file changes for the cluster member

    The product monitors the scaling-metadata.xml file after the cluster member starts and dynamically deploys any file changes to the collective repository. If the cluster member is removed from the collective controller through the collective remove command, the product undeploys the scaling policy from the collective repository.

  4. Optional: Package the cluster member into a server package and deploy the package.
    1. Package the cluster member into a server package.

      Available tools for packaging archives include:

      • The Liberty server package command. Sample command syntax is:
        wlp/bin/server package cluster_member_name --include=all | minify --archive=cluster_member_name.zip | jar | pax
      • The package action in the WebSphere Developer Tools for Eclipse product.
      For example, to use the package command:
      1. Stop the cluster member if it is running.
      2. Run the package command to create the server package. For example, if the cluster member name is clusterMember1, run:
        wlp/bin/server package clusterMember1
      The command creates a server package named, for example, C:\wlp\usr\servers\clusterMember1\clusterMember1.zip on Windows computers.

      You might need to customize the installation by changing port numbers, database connections, or messaging system connections.

    2. Deploy the server package to host computers.

      Available tools for deploying packages include:


Icon that indicates the type of topic Task topic

File name: twlp_autoscale_deploypol.html