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. Go to the Memorystore for Redis Cluster page in the Google Cloud console.

    Memorystore for Redis Cluster

  2. Click Create Cluster.

  3. On the Create a Redis Cluster instance page, select your desired configurations for your new instance.

    • Under Name your cluster instance enter a Cluster ID. The Cluster ID must use only lowercase letters, numbers and hyphens. It must also start with a letter and be unique in its region.
      • For example: my-instance-1.
    • Under Choose region select a region for your instance.
    • Under Node Type select your chosen node type.
    • Under Cluster size, define the number of shards for your cluster. The shard count determines the total memory capacity for storing cluster data. To see more details about cluster specification, see Cluster and shard specification.
    • If you want to create an instance with replicas, enter your desired number of replicas (per shard) under Replicas. Acceptable values are No Replica, 1 Replica, and 2 Replicas. The default value is 1 Replica when using the Google Cloud console.
    • Under Set up connection select your desired network. For more details on private networking for Memorystore for Redis Cluster, see Networking.
    • If you want to enable IAM authentication select Enable IAM AUTH.
    • If you want to enable in-transit encryption select Enable Transport Layer Security (TLS).
  4. Click the Create Cluster button.

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 your desired number of replicas (per shard). Accepted values are 0, 1, and 2.

  • NODE_TYPE is your chosen node type. Accepted values are:

    • redis-shared-core-nano
    • redis-standard-small
    • redis-highmem-medium
    • redis-highmem-xlarge

    For more details on node types and cluster configurations, see Cluster and node specification.

  • 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.

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 your chosen number of replicas (per shard). Accepted values are 0, 1, and 2.

  • NODE_TYPE is your chosen node type. Accepted values are:

    • redis-shared-core-nano
    • redis-standard-small
    • redis-highmem-medium
    • redis-highmem-xlarge

    For more details on node types and cluster configurations, see Cluster and node specification.

  • 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.