Remove a controller from a Liberty collective replica set
Overview
We can use the collective utility removeReplica command to remove a replica from a replica set. A replica is a collective controller. The removeReplica command does not delete the collective controller server. Administrators of a collective can enable a Liberty server to act as a collective controller using the replicate and addReplica commands and, after the controller is no longer needed, remove the controller from the collective using the removeReplica command. After removal of a replica, the remaining replicas in the replica set do not require any updates to their configuration. However, we might want to update them so that their configurations in server.xmls more accurately reflect the updated replica set.
It is not necessary to change the replicaSet value in server.xml of a remaining replica in the set. No change to the configuration of a remaining replica is required. If we do want to update the replicaSet values in the configurations of remaining replicas in the set so that the configuration values are consistent across all replicas in the set, set the isInitialReplicaSet value in the configurations of the remaining replicas to false. This is because after we change the replicaSet value, it no longer describes the initial replica set; it now describes a changed replica set.
Procedure
- Optional: Back up the replica set.
- Ensure the collective controller is running.
For a controller named myController, run the status command:
- wlp/bin/server status myController
If the collective controller is not running, then start it using the start or run command:
- wlp/bin/server start myController
- Remove a collective controller or replica from the replica set.
Run a removeReplica command that uses the administrative security domain configuration of the collective controller and specifies the endpoint of the replica to remove in the form replicaHost:replicaPort. Look at server.xml of the collective controller to find the values for the --host, --port, --user, and --password parameters. For more information run collective help removeReplica.
wlp/bin/collective removeReplica replicaHost:replicaPort \ --host=host \ --port=https_port \ --user=controller_user \ --password=passwordAlternate syntax:
wlp/bin/collective removeReplica replicaHost:replicaPort --controller=controller_user:password@host:https_portFor example, to remove myController2 from the example replica set in Configure Liberty collective replica sets, run the following command:
wlp/bin/collective removeReplica localhost:10011 --host=myController_host --port=myController_port --user=myController_user --password=password
Parent topic: Update a Liberty collective
Related information