Generate deployment variables when joining a member server to a collective
We can use the genDeployVariables option of the collective join command to allocate deployment variables (ports) when we join a member server to a collective.
The genDeployVariables option registers deployment variables to the collective repository and generates deployment variables to the member file...
-
$WLP_USER_DIR/servers/server_name/configDropins/overrides/deployVariables.xml
Procedure
- Create a collective controller.
- Specify deployment variables in the collective controller server.xml file.
Add a deployVariable element to the controller server.xml file for each port that we 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"/>
- In server.xml of the server we 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 server.xml of a server to be joined to the collective:
<defaultHttpEndpoint id="httpEndpoint" host="*" httpPort="${PortBase1}" httpsPort="${PortBase1}+1" httpPort="${PortBase2}" httpsPort="${PortBase2}+1" />
- 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
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 file...
-
$WLP_USER_DIR/servers/serverName/configDropins/overrides/deployVariables.xml
The generated file contains the following deployment variables for the example values:
<server> <variable name="PortBase1" value="7000"/> <variable name="PortBase2" value="8000"/> </server>
Parent topic: Configure a Liberty collective