Generating deployment variables when joining a member server to a collective

You can use the genDeployVariables option of the collective join command to allocate deployment variables (ports) when you join a member server to a collective.

The genDeployVariables option registers deployment variables to the collective repository and generates deployment variables to the member $WLP_USER_DIR/servers/server_name/configDropins/overrides/deployVariables.xml file.

Before you begin

Create a collective controller. See Configuring a Liberty collective.

Procedure

  1. Specify deployment variables in the collective controller server.xml file.

    Add a deployVariable element to the controller server.xml file for each port that you want allocated. A deployVariable typically specifies a name for the deployment variable, the initial port value, and the amount to increment the port value.

    
    <featureManager>
       <feature>servlet-3.0</feature>
       <feature>collectiveController-1.0</feature>   
    </featureManager>
    
    <deployVariable name="PortBase1" value="7000" increment="20"/> 
    <deployVariable name="PortBase2" value="8000" increment="20"/>
    
  2. In the server.xml file of the server that you want to join to the collective as a member, specify port values that use the deployment variables.

    The following defaultHttpEndpoint element shows example port values that use the deployment variables in the server.xml file of a server to be joined to the collective:

    
    <defaultHttpEndpoint id="httpEndpoint"
                         host="*"
                         httpPort="${PortBase1}"
                         httpsPort="${PortBase1}+1"
                         httpPort="${PortBase2}"
                         httpsPort="${PortBase2}+1" />
    
  3. Run the collective join command with the genDeployVariables option.
    wlp/bin/collective join memberName --host=controllerHost --port=controllerHTTPSPort
     --user=controllerAdminUser --password=controllerAdminUserPassword
     --keystorePassword=memberKeystorePassword --genDeployVariables

Results

The command joins the server to the collective as a member, registers the deployment variables to the collective repository, and generates deployment variables to the member $WLP_USER_DIR/servers/serverName/configDropins/overrides/deployVariables.xml file. The generated file contains the following deployment variables for the example values:


<server>
   <variable name="PortBase1" value="7000"/>
   <variable name="PortBase2" value="8000"/>
</server>