Changing the port of a replica

To change the port of a replica that is in a replica set which has many replicas, you must stop and start replicas in a specific order and not change the port of at least one replica until after you change the ports of the other replicas.

Before you begin

Create a replica set. See Configuring Liberty collective replica sets. The topic includes Example: Create and activate a replica set, an example of creating a replica set consisting of three collective controllers on the same host.

About this task

When you added a replica to a replica set, you specified a port number for the replica. For example, the following element in a replica server.xml file specifies a replica port of 10011:

<collectiveController replicaPort="10011"
                      replicaSet="localhost:10010"
                      isInitialReplicaSet="false" />

When a replica set contains only one replica, you can simply change the replicaPort value. However, when the replica set has many replicas, you must stop a replica before changing its port. Also, one replica in the replica set must remain running and must not have its port changed until after you change the ports of the stopped replicas successfully.

Procedure

  1. Stop the replicas for which you want to change ports. Do not stop at least one replica or change its port.
  2. Change the replicaPort value in the server.xml files of the stopped replicas.
  3. Start the stopped replicas.
  4. Check the messages.log of the replicas, and verify that the changed replicas can communicate.
    Look for the CWWKX6011I message in the replica messages to see if the replica synchronized correctly:
    CWWKX6011I: The collective controller is ready, and can accept requests. The leader is replicaHost:replicaPort. Current active replica set is [replicaHost:replicaPort, replicaHost:replicaPort, replicaHost:replicaPort]. The configured replica set is [replicaHost:replicaPort, replicaHost:replicaPort, replicaHost:replicaPort].
  5. If you want to change the port of the replica that remained running, you now can stop the replica, change its port, restart it, and verify that it can communicate with the other replicas.

Icon that indicates the type of topic Task topic

File name: tagt_wlp_change_replicas.html