During the life of a replica set, it might become necessary to remove one or more
replicas from the replica set. You 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.
About this task
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, you might want to update them so that their configurations in the
server.xml files more accurately reflect the updated replica set.
Note: It is not necessary to change the replicaSet value in the
server.xml file of a remaining replica in the set. No change to the
configuration of a remaining replica is required. If you 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, you must set the
isInitialReplicaSet value in the configurations of the remaining replicas to
false. This is because after you change the replicaSet value,
it no longer describes the initial replica set; it now describes a changed replica set.
- 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 that you want
to remove in the form
replicaHost:replicaPort. Look at the
server.xml file of the collective controller to find the values for the
--host, --port, --user, and
--password parameters. For information about these required parameters and about
optional parameters, run collective help removeReplica at a command line.
wlp/bin/collective removeReplica replicaHost:replicaPort --host=host_of_running_controller --port=https_port_of_running_controller --user=user_for_running_controller --password=user_password
To reduce the number of options needed, use the --controller option instead of --user, --password,
--host, and --port.
wlp/bin/collective removeReplica replicaHost:replicaPort --controller=user_for_running_controller:user_password@host_of_running_controller:https_port_of_running_controller
For example, to remove myController2 from the example replica set in Configuring Liberty collective replica sets, run the following command:
wlp/bin/collective removeReplica localhost:10011 --host=host_of_myController --port=https_port_of_myController --user=user_for_myController --password=user_password
To reduce the number of options needed, use the --controller option instead of --user, --password,
--host, and --port.
wlp/bin/collective removeReplica localhost:10011 --controller=user_for_myController:user_password@host_of_myController:https_port_of_myController