This page provides instructions for creating Memorystore for Redis Cluster instances.
Before you begin
Complete the before you begin instructions:
- In the Google Cloud console, on the project selector page, select or create a Google Cloud project
.
Note:If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.
Go to project selector - Make sure that billing is enabled for your project. Learn how to check if billing is enabled on a project .
-
Install and initialize the Google Cloud CLI.
Note:If you installed the gcloud CLI previously, make sure you have the latest version by running
gcloud components update. You need at least gcloud CLI version440.0.0to access the Memorystore for Redis Cluster gcloud CLI commands. - Enable the Memorystore for Redis API
Memorystore for Redis - Enable the Network Connectivity API
Network Connectivity API - Enable the Service Consumer Management API
Service Consumer Management API
Other prerequisites
- You must have one of these IAM roles
in the Google Cloud project you're using:
-
roles/redis.admin(the Memorystore Admin predefined IAM role) -
roles/owner(the Owner basic IAM role) -
roles/editor(the Editor basic IAM role)
-
Set up networking
Read the Networking page to determine if you need to set up a service connection policy.
If a service connection policy hasn't been created for the network with which you will create the Redis cluster, follow the Networking guidance to create it.
Create an instance
Important : Before you follow the steps in this procedure, complete the steps in the Before you begin and Set up networking sections.
If you create a cluster with replicas, and a single zone of the region where you want the cluster to be created is unavailable, then Memorystore for Redis Cluster creates the cluster in the available zones of the region. This zonal allocation is temporary. After the unavailable zone becomes available, Memorystore for Redis Cluster redistributes the nodes of the cluster so that they're evenly distributed among the zones.
If you create a cluster without replicas and a single zone is unavailable, then Memorystore for Redis Cluster fails to create the cluster.
Console
-
In the Google Cloud console, go to the Memorystore for Redis Clusterpage.
-
Click Create cluster.
-
In the Name your cluster instancesection, enter an ID for the cluster. The Cluster ID must use only lowercase letters, numbers, and hyphens. It must also start with a letter and be unique in its region.
-
From the Regionmenu, select a region for your cluster.
-
In the Zonal availabilitysection, select the Multi-zoneoption because you want to create a multi-zone cluster.
-
In the Node Typesection, select one of the following node types :
- Shared-Core(
redis-shared-core-nano) - Small(
redis-standard-small) - Medium(
redis-highmem-medium) - X-Large(
redis-highmem-xlarge)
- Shared-Core(
-
In the Cluster sizesection, enter the number of shards for your cluster. The shard count determines the total memory capacity for storing cluster data. For more information about cluster specifications, see Cluster and node specification .
-
If you want to create a cluster with replicas, then in the Replicassection, select the number of replicas (per shard). You can select 0-5 replicas. The default value is 1 replica.
-
In the Set up connectionsection, select the network that your applications can use to connect to this cluster. For more information about private networking for Memorystore for Redis Cluster, see Networking overview .
-
Optional. If you want to increase the security of your cluster, then in the Securitysection, enable IAM authentication by selecting the Enable IAM AUTHcheckbox.
-
In the Data persistence strategysection, specify how you want Memorystore for Redis Cluster to persist the data in your cluster. Acceptable values are No persistence, Append Only File (AOF)persistence , and Redis Database (RDB)persistence .
-
Optional. If you want to enable automated backups for your cluster, then do the following:
- Select the Automated daily backupscheckbox.
- In the Days to retain backupsfield, enter the number of days
that you want Memorystore for Redis Cluster to keep backups before they're
deleted automatically. You can specify from
1to365days. The default value is35days. - From the Time windowmenu, select a time for the daily backup.
-
Click Create cluster.
gcloud
To create a Memorystore for Redis Cluster instance, run the create
command:
gcloud redis clusters create INSTANCE_ID \ --region= REGION_ID \ --network= NETWORK \ --replica-count= REPLICA_COUNT \ --node-type= NODE_TYPE \ --shard-count= SHARD_COUNT
Replace the following:
-
INSTANCE_ID is the ID of the Memorystore for Redis Cluster instance you're creating. Your instance ID must be 1 to 63 characters and use only lowercase letters, numbers, or hyphens. It must start with a lowercase letter and end with a lowercase letter or number.
-
REGION_ID is the region where you want the instance placed.
-
NETWORK is the network used to create your instance. It must use the format:
projects/NETWORK_PROJECT_ID/global/networks/NETWORK_ID. The network ID used here must match the network ID used by the service connection policy. Otherwise, thecreateoperation fails. -
REPLICA_COUNT is the number of replicas (per shard). Accepted values are
0-5. -
NODE_TYPE is your chosen node type. Accepted values are:
-
redis-shared-core-nano -
redis-standard-small -
redis-highmem-medium -
redis-highmem-xlarge
-
-
SHARD_COUNT determines the number of shards in your instance. Shard count determines the total memory capacity for storing cluster data. To see more details about cluster specification, see Cluster and node specification .
For example:
gcloud alpha redis clusters create my-instance \ --region=us-central1 \ --network=projects/my-project-335118/global/networks/default \ --replica-count=2 \ --node-type=redis-highmem-medium \ --shard-count=8
By default, in-transit encryption
is disabled, and the authorized network is default
.
Create a single-zone instance
This section provides instructions on creating a Single-zone instance .
Console
-
In the Google Cloud console, go to the Memorystore for Redis Clusterpage.
-
Click Create cluster.
-
In the Name your cluster instancesection, enter an ID for the cluster. The Cluster ID must use only lowercase letters, numbers, and hyphens. It must also start with a letter and be unique in its region.
-
From the Regionmenu, select a region for your cluster.
-
In the Zonal availabilitysection, do the following:
-
Select the Single zoneoption.
-
From the Zonemenu, select the zone where you want Memorystore for Redis Cluster to create the cluster.
-
-
In the Node Typesection, select one of the following node types :
- Shared-Core(
redis-shared-core-nano) - Small(
redis-standard-small) - Medium(
redis-highmem-medium) - X-Large(
redis-highmem-xlarge)
- Shared-Core(
-
In the Cluster sizesection, enter the number of shards for your cluster. The shard count determines the total memory capacity for storing cluster data. For more information about cluster specifications, see Cluster and node specification .
-
If you want to create a cluster with replicas, then in the Replicassection, select the number of replicas (per shard). You can select 0-5 replicas. The default value is 1 replica.
-
In the Set up connectionsection, select the network that your applications can use to connect to this cluster. For more information about private networking for Memorystore for Redis Cluster, see Networking overview .
-
Optional. If you want to increase the security of your cluster, then in the Securitysection, enable IAM authentication by selecting the Enable IAM AUTHcheckbox.
-
In the Data persistence strategysection, specify how you want Memorystore for Redis Cluster to persist the data in your cluster. Acceptable values are No persistence, Append Only File (AOF)persistence , and Redis Database (RDB)persistence .
-
Optional. If you want to enable automated backups for your cluster, then do the following:
- Select the Automated daily backupscheckbox.
- In the Days to retain backupsfield, enter the number of days
that you want Memorystore for Redis Cluster to keep backups before they're
deleted automatically. You can specify from
1to365days. The default value is35days. - From the Time windowmenu, select a time for the daily backup.
-
Click Create cluster.
gcloud
To create a single-zone instance, run the create
command:
gcloud redis clusters create INSTANCE_ID \ --region= REGION_ID \ --network= NETWORK \ --replica-count= REPLICA_COUNT \ --node-type= NODE_TYPE \ --shard-count= SHARD_COUNT \ --zone-distribution-mode= ZONE_DISTRIBUTION_MODE \ --zone= ZONE
Replace the following:
-
INSTANCE_ID is the ID of the Memorystore for Redis Cluster instance you're creating. Your instance ID must be 1 to 63 characters and use only lowercase letters, numbers, or hyphens. It must start with a lowercase letter and end with a lowercase letter or number.
-
REGION_ID is the region where you want the instance placed.
-
NETWORK is the network used to create your instance. It must use the format:
projects/NETWORK_PROJECT_ID/global/networks/NETWORK_ID. The network ID used here must match the network ID used by the service connection policy. Otherwise, thecreateoperation fails. -
REPLICA_COUNT is the number of replicas (per shard). Accepted values are
0-5. -
NODE_TYPE is your chosen node type. Accepted values are:
-
redis-shared-core-nano -
redis-standard-small -
redis-highmem-medium -
redis-highmem-xlarge
-
-
SHARD_COUNT determines the number of shards in your instance. Shard count determines the total memory capacity for storing cluster data. For more information about cluster specification, see Cluster and node specification .
-
ZONE_DISTRIBUTION_MODE is the mode that lets you choose between provisioning a single-zone instance or a multi-zone instance. The default is multi-zone. Accepted values are
single-zone, andmulti-zone. -
ZONE is the zone where you want to provision your nodes. This flag is applicable only if the
--zone-distribution-modeis set tosingle-zone.

