Yandex Cloud
  • Services
  • Solutions
  • Why Yandex Cloud
  • Blog
  • Pricing
  • Documentation
  • Contact us
Get started
Language / Region
Yandex project
© 2023 Intertech Services AG
Yandex Managed Service for Redis
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Information about existing clusters
    • Creating clusters
    • Changing cluster and database settings
    • Connecting to a database
    • Stopping and starting clusters
    • Updating a Redis version
    • Managing hosts in a cluster
    • Managing shards
    • Managing backups
    • Switching the master
    • Monitoring the state of clusters and hosts
    • Viewing cluster logs
    • Deleting clusters
  • Tutorials
  • Concepts
  • Access management
  • Pricing policy
  • API reference
  • Revision history
  • Questions and answers
  1. Step-by-step instructions
  2. Switching the master

Switching the master

Written by
Yandex Cloud

    In a failover Managed Service for Redis cluster with multiple hosts, you can switch the master role from the current master host to the replica host. After this operation, the current master host becomes the replica host of the new master.

    It takes several minutes on average to switch, and the cluster is available during that time.

    A sharded cluster contains three or more master hosts: one per shard. Switching the master for a sharded cluster is done for each shard one by one.

    Management console
    CLI
    API

    To switch the master in a non-sharded cluster:

    1. In the management console, go to the folder containing a non-sharded cluster.
    2. Select Managed Service for Redis.
    3. Click on the name of the cluster you need and select the Hosts tab.
    4. In the line of the host with the MASTER role, click and select Switch master.
    5. In the resulting window, select I want to switch the master and click Switch.

    To switch the master in a sharded cluster:

    1. In the management console, go to the folder containing a sharded cluster.
    2. Select Managed Service for Redis.
    3. Click on the name of the cluster you need and select the Hosts tab.
    4. In the line of the host with the MASTER role, click and select Switch master.
    5. In the window that opens, click Switch.

    If you don't have the Yandex Cloud command line interface yet, install and initialize it.

    The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name or --folder-id parameter.

    To switch the master in a non-sharded cluster, run the command:

    yc managed-redis cluster start-failover \
      --name <cluster name>
    

    To switch the master in a sharded cluster, run the command:

    yc managed-redis cluster start-failover \
      --name <cluster name> \
      --hostnames <name of current master host>
    

    You can request the cluster name with a list of clusters in the folder and the name of the master host for the desired shard with a list of hosts in the cluster.

    Use the API startFailover method and pass the following in the request:

    • In the clusterId parameter, the ID of the cluster where you want to switch the master. To find out the cluster ID, get a list of clusters in the folder.
    • For a sharded cluster only: the name of the current master host of the desired shard in the hostNames parameter. To find out the name, request a list of hosts in the cluster.

    Was the article helpful?

    Language / Region
    Yandex project
    © 2023 Intertech Services AG