Back to Redis

Change Node Role

content/operate/rs/7.22/clusters/change-node-role.md

latest3.8 KB
Original Source

A Redis Software cluster contains a primary node, which coordinates cluster-wide management operations, and multiple secondary nodes. Nodes with either role can host database shards.

Demote primary node

{{< multitabs id="demote-node" tab1="Cluster Manager UI" tab2="rladmin" >}}

To demote the primary node to a secondary node using the Cluster Manager UI:

  1. On the Nodes screen, click the More actions button () for the primary node you want to demote.

  2. Select Set as a secondary node from the list.

  3. Select one of the options to determine the new primary node:

    • Automatically: The cluster decides which node becomes the new primary node.

    • Choose specific node: You can manually select which node becomes the new primary node.

  4. Click Confirm.

-tab-sep-

To demote the primary node to a secondary node using rladmin:

  1. Identify the primary node's ID with [rladmin cluster master]({{<relref "/operate/rs/7.22/references/cli-utilities/rladmin/cluster/master">}}):

    sh
    $ rladmin cluster master
    Node <primary-node-id> is the cluster master node
    
  2. Run [rladmin node enslave]({{<relref "/operate/rs/7.22/references/cli-utilities/rladmin/node/enslave/#node-enslave">}}) with the demote_node option:

    sh
    rladmin node <primary-node-ID> enslave demote_node
    

    Replace <primary-node-ID> with the ID returned by rladmin cluster master.

{{< /multitabs >}}

Promote secondary node

{{< multitabs id="promote-node" tab1="Cluster Manager UI" tab2="rladmin" >}}

To promote a secondary node to become the primary node using the Cluster Manager UI:

  1. On the Nodes screen, click the More actions button () for the secondary node you want to promote.

  2. Select Set as the primary node from the list.

  3. Click Confirm.

-tab-sep-

To promote a secondary node to become the primary node using rladmin:

  1. To find the IDs of secondary nodes, run [rladmin status nodes]({{<relref "/operate/rs/7.22/references/cli-utilities/rladmin/status#status-nodes">}}):

    sh
    $ rladmin status nodes
    CLUSTER NODES:
    NODE:ID     ROLE       ADDRESS          EXTERNAL_ADDRESS          HOSTNAME            SHARDS     CORES          FREE_RAM                 PROVISIONAL_RAM          VERSION        STATUS   
    node:1      master     198.51.100.2                                 3d99db1fdf4b        4/100      6              14.74GB/19.54GB          10.73GB/16.02GB          7.22.0-250     OK       
    *node:3     slave      198.51.100.4                                 b87cc06c830f        0/100      6              14.74GB/19.54GB          11.22GB/16.02GB          7.22.0-250     OK       
    node:2      slave      198.51.100.3                                 fc7a3d332458        0/100      6              14.74GB/19.54GB          11.22GB/16.02GB          7.22.0-250     OK       
    

    Nodes with the slave role are secondary nodes.

  2. Run [rladmin cluster master set]({{<relref "/operate/rs/7.22/references/cli-utilities/rladmin/cluster/master">}}):

    sh
    rladmin cluster master set <secondary-node-ID>
    

    Replace <secondary-node-ID> with the ID of the secondary node you want to promote.

{{< /multitabs >}}

After this node becomes the primary node, all cluster management traffic is directed to it.