How to change the cluster's master node?

Last updated 18, Apr 2024

Question

How to transfer the master of the cluster to a different Redis Enterprise node?

Answer

You can use the command rladmin cluster master to demote the master of the cluster node and promote another node to the master of the cluster.

rladmin cluster master set <node_id>

The REST API has a path on the cluster endpoint POST /v1/cluster/actions/<ACTION> so it is possible to change the node running as master of the cluster as follows:

curl -k -u <EMAIL>:<PASSWORD> -H "Content-Type: application/json" -X POST -d '{"node_uid":"<TARGET_NODE>"}' https://localhost:9443/v1/cluster/actions/change_master

Typically, you would change the master when maintenance operations are performed against the node or for troubleshooting reasons. However, if you need to patch or update a host, you can set a node to maintenance mode. This will migrate shards off of the node. When you restart the (or remove the maintenance mode), the master will return to the cluster. This operation is required node by node through the cluster for rolling patch/os updates.

References

Learn more about the maintenance mode.