Create instances

This page provides instructions for creating Memorystore for Redis Cluster instances.

Before you begin

Complete the before you begin instructions:

  1. 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
  2. Make sure that billing is enabled for your project. Learn how to check if billing is enabled on a project.
  3. 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 version 440.0.0 to access the Memorystore for Redis Cluster gcloud CLI commands.

  4. Enable the Memorystore for Redis API
    Memorystore for Redis
  5. Enable the Network Connectivity API
    Network Connectivity API
  6. 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

Console

  1. In the Google Cloud console, go to the Memorystore for Redis Cluster page.

    Memorystore for Redis Cluster

  2. Click Create cluster.

  3. In the Name your cluster instance section, 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.

  4. From the Region menu, select a region for your cluster.

  5. In the Zonal availability section, select the Multi-zone option because you want to create a multi-zone cluster.

  6. In the Node Type section, 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)
  7. In the Cluster size section, 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.

  8. If you want to create a cluster with replicas, then in the Replicas section, select the number of replicas (per shard). You can select 0-5 replicas. The default value is 1 replica.

  9. In the Set up connection section, 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.

  10. Optional. If you want to increase the security of your cluster, then in the Security section, enable IAM authentication by selecting the Enable IAM AUTH checkbox.

  11. In the Data persistence strategy section, 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.

  12. Optional. If you want to enable automated backups for your cluster, then do the following:

    1. Select the Automated daily backups checkbox.
    2. In the Days to retain backups field, enter the number of days that you want Memorystore for Redis Cluster to keep backups before they're deleted automatically. You can specify from 1 to 365 days. The default value is 35 days.
    3. From the Time window menu, select a time for the daily backup.
  13. 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, the create operation 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

  1. In the Google Cloud console, go to the Memorystore for Redis Cluster page.

    Memorystore for Redis Cluster

  2. Click Create cluster.

  3. In the Name your cluster instance section, 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.

  4. From the Region menu, select a region for your cluster.

  5. In the Zonal availability section, do the following:

    1. Select the Single zone option.

    2. From the Zone menu, select the zone where you want Memorystore for Redis Cluster to create the cluster.

  6. In the Node Type section, 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)
  7. In the Cluster size section, 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.

  8. If you want to create a cluster with replicas, then in the Replicas section, select the number of replicas (per shard). You can select 0-5 replicas. The default value is 1 replica.

  9. In the Set up connection section, 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.

  10. Optional. If you want to increase the security of your cluster, then in the Security section, enable IAM authentication by selecting the Enable IAM AUTH checkbox.

  11. In the Data persistence strategy section, 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.

  12. Optional. If you want to enable automated backups for your cluster, then do the following:

    1. Select the Automated daily backups checkbox.
    2. In the Days to retain backups field, enter the number of days that you want Memorystore for Redis Cluster to keep backups before they're deleted automatically. You can specify from 1 to 365 days. The default value is 35 days.
    3. From the Time window menu, select a time for the daily backup.
  13. 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, the create operation 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, and multi-zone.

  • ZONE is the zone where you want to provision your nodes. This flag is applicable only if the --zone-distribution-mode is set to single-zone.