Modify the collective repository replica set

Download

Modify the collective repository replica set sample script for Liberty Collectives

Modify the collective repository replica set

Description

In IBM WebSphere Application Server Network Deployment Version 8.5.5, Liberty profile has introduced the Liberty collective feature. Refer to information about collectives in the IBM WebSphere Application Server Version 8.5.5 information center for more specifics.

The updateRepositoryConfig.py sample demonstrates how to call the RepositoryConfiguration MBean from a Jython script to modify the active replicas in a replica set for a Liberty collective.

  • The RepositoryConfiguration MBean operations used:
    • addReplica
    • removeReplica

updateRepositoryConfig.py script

The updateRepositoryConfig sample script demonstrates how to modify the collective repository replica set with the given operation (“add” or “remove”). A connection is made to the collective controller located at the given host and port and the request to add or remove a replica is passed to the RepositoryConfiguration MBean.

For the “add” operation, the replica to be added should be created first before it can be added into an active replica set. Refer to information about Configuring Liberty collective replica sets in the WebSphere Application Server Version 8.5.5 information center on how to create a collective replica. After the replica is created, you can run this Jython script to performs the addReplica operation via the RepositoryConfiguration MBean, which is last step of “Add a replica to an existing replica set” shown in the information center page.

Instructions

Required parameters

First parameter add or remove. The specified replica endpoint is added/removed to/from the active replica set.
--truststore The path to the truststore to be used when establishing a connection to the collective controller.
--truststorePassword The password for the truststore specified by the --truststore parameter.
--host The host name where the collective controller is running.
--port The https port where the collective controller is listening.
--user The user name to use when connecting to the collective controller.
--password The password to use when connecting to the collective controller.
--endpoint The replica endpoint to add or remove, in the format of host:port.

Optional parameters

--help Displays help text.
--debug Displays additional details when an error occurs.

Sample use and resulting messages

	    
>> jython updateRepositoryConfig.py add 
   --truststore=c:\wlp\usr\servers\controller1\resources\security\trust.jks 
   --truststorePassword=secret 
   --host=localhost 
   --port=9443 
   --user=Administrator 
   --password=secret2 
   --endpoint=localhost:10011

   Connecting to the server...
   Successfully connected to the server "localhost:9443"
   Adding replica endpoint localhost:10011 to the repository configuration
   Operation: True

	  
	    
>> jython updateRepositoryConfig.py remove
   --truststore=c:\wlp\usr\servers\controller1\resources\security\trust.jks 
   --truststorePassword=secret 
   --host=localhost 
   --port=9443 
   --user=Administrator 
   --password=secret2 
   --endpoint=localhost:10011

   Connecting to the server...
   Successfully connected to the server "localhost:9443"
   Removing replica endpoint localhost:10011 to the repository configuration
   Operation: True

	  

Notes

The following additional sample scripts provide shared code which is used by this sample:

  • wlp_arguments.py
  • wlp_repository.py
  • wlp_serverConfig.py