This page describes how to initiate a manual failover for a standard tier Memorystore for Redis instance. The manual failover feature allows you to test how normal failovers affect your application.
For an overview of this feature, see Manual failover.
Initiating a failover
Open a terminal window
Use the
gcloud config
command to set your default project:gcloud config set core/project PROJECT_ID
Use the following command to initiate a failover:
gcloud redis instances failover INSTANCE_NAME
Optional data protection mode
The two available data protection modes are:
limited-data-loss
mode (default).force-data-loss
mode.
To set the data protection mode, use one of the following commands:
gcloud redis instances failover INSTANCE_NAME --data-protection-mode=limited-data-loss
or
gcloud redis instances failover INSTANCE_NAME --data-protection-mode=force-data-loss
How data protection modes work
The limited-data-loss
mode minimizes data loss by verifying that the
difference in data between the primary and replica is below 30 MB before
initiating the failover. The offset on the primary is incremented for each byte
of data that must be synchronized to its replicas. In the limited-data-loss
mode, the failover will abort if the greatest offset delta between the primary
and each replica is 30MB or greater. If you can tolerate more data loss and want
to aggressively execute the failover, try setting the data protection mode to
force-data-loss
.
The force-data-loss
mode employs a chain of failover strategies to
aggressively execute the failover. It does not check the offset delta between
the primary and replicas before initiating the failover; you can potentially
lose more than 30MB of data changes.
See Manual failover for additional information.