This page provides instructions for enabling and managing read replicas .
Create a Redis instance with read replicas
Console
-
Go to the Memorystore for Redispage in the Google Cloud console.
-
Click Create Instance.

-
Follow the instructions at Create a Redis instance on a VPC network , but return to these instructions when selecting Tier.
-
Choose Standardtier.
-
Under the Configure read replicasdropdown, select your desired number of read replicas.
-
Return to the Create a Redis instance on a VPC network instructions for additional guidance on other Memorystore configurations, or click the Createbutton.
gcloud
Enter the following command, replacing variables with appropriate values:
gcloud redis instances create instance-id --size= size --region= region-id --replica-count= count --read-replicas-mode=read-replicas-enabled --tier=standard
Where:
- count is a value from 1 to 5. This sets the number of read replicas.
Enable read replicas on existing Redis instances
Console
-
Go to the Memorystore for Redispage in the Google Cloud console.
-
Click the ID of the instance.
-
Under the Configurationsection, next to Read Replicas, click ENABLE.
-
(Optional)Specify a custom IP range
-
If your instance uses the direct peering connection mode , you can enter a specific CIDR range with a block size of at least
/28, as long as it doesn't overlap with any other existing ranges. For example, you could enter10.100.0.0/28. -
If your instance uses the private services access connection mode , you can choose an existing allocated range of size
/28from the dropdown menu. For instructions on allocating an IP address range viewable from the dropdown menu, see Creating an IP allocation .
-
-
Click Enable Read Replicas.
gcloud
To enable read replicas for your instance, enter the following command, replacing variables with appropriate values.
gcloud redis instances update INSTANCE_ID --read-replicas-mode=READ_REPLICAS_ENABLED --secondary-ip-range= SECONDARY_RANGE
Where:
- INSTANCE_ID is the ID of the instance for which you're enabling read replicas.
- SECONDARY_RANGE
is one of the following options:
-
auto.autois supported for both networking connection modes. - If your instance uses the direct peering connection mode
you must provide a valid CIDR IP address range
of size
/28. For example,--secondary-ip-range=10.100.0.0/28. - If your instance uses the private services access connection mode
you must provide the name of an allocated range
of size
/28. For example,--secondary-ip-range=my-secondary-range-memorystore.
-
Scale read replica enabled instances
Add or remove replica nodes from your Redis instance
Console
- Go to the Memorystore for Redis page in the Google Cloud console.
Memorystore for Redis - Click the Instance ID of the instance to which you want to add/remove replica nodes.
- Click Edit.
- Under Configure read replicas, enter your desired number of replicas.
- Click Save.
gcloud
Enter the following command, replacing variables with appropriate values:
gcloud redis instances update instance-id --region= region-id --replica-count= count
Where:
- count is a value from 1 to 5. This sets the number of read replicas.
Scale the size of Redis nodes
Console
- Go to the Memorystore for Redis page in the Google Cloud console.
Memorystore for Redis - Click the Instance ID of the instance you want to resize.
- Click Edit.
- Under Capacity, enter a new size in the field to update the instance's capacity.
- Click Save.
gcloud
Enter the following command, replacing variables with appropriate values:
gcloud redis instances update instance-id --region= region-id --size= size
Where:
- size
is the size of each Redis node in your instance, including
the primary node. For example, if you have a read replica enabled instance
with six nodes (including the primary node) with
--size=10, your total instance size is 60 GiB.
Connect to your instance using the read endpoint
For instructions on using the read endpoint to connect to your instance, see Connect to a Redis instance using the read endpoint .
View read replica information for your instance
To find information about read replicas for your instance, run the following command replacing variables with appropriate values:
gcloud redis instances describe instance-id --region= region-id
In the metadata output from the previous command:
-
readEndpoint:shows the read endpoint IP address. -
readEndpointPortshows the read endpoint port number. -
readReplicasModeshows if read replicas have been enabled. -
readReplicaCountshows the number of replicas the instance has. -
nodes:displays each replica node ID, and the region where each replica node is located.

