Configure a cluster

Memorystore for Redis Cluster supports a subset of the Redis configuration parameters that you can modify to customize the behavior of your cluster.

Configuration changes don't require you to restart the cluster, and they don't interrupt the service. Memorystore for Redis Cluster saves your changes immediately. If the cluster restarts, then the cluster retains your configuration changes. After creating a cluster, you can update the modifiable configuration parameters. For more information, see Supported cluster configurations.

Before you begin

Make sure that you install the latest version of the Google Cloud CLI. To update an existing installation, use the gcloud components update command.

View configuration parameters

To view configuration parameters, use the gcloud redis clusters describe command.

gcloud redis clusters describe CLUSTER_ID --region=REGION_ID

Make the following replacements:

  • CLUSTER_ID: the ID of the cluster
  • REGION_ID: the region where the cluster is located

For example:

gcloud redis clusters describe my-cluster --region=us-central1

If you don't change any configuration parameters from their default values, then the parameters don't appear in the output.

Set a configuration parameter when you create a cluster

To set a configuration parameter when you create a cluster, use the
gcloud redis clusters create command with the --redis-config flag.

gcloud redis clusters create CLUSTER_ID \
--region=REGION_ID \
--project=PROJECT_ID \
--network=NETWORK \
--node-type=NODE_TYPE \
--shard-count=SHARD_COUNT \
--redis-config=CONFIG_NAME=CONFIG_VALUE

Make the following replacements:

  • CLUSTER_ID: the ID of the cluster that you're creating.
  • REGION_ID: the region where you want the cluster to be located.
  • PROJECT_ID: your project ID.
  • NETWORK: the name or fully qualified path of the Virtual Private Cloud (VPC) network to which the cluster connects.
  • NODE_TYPE: the node type for the cluster.

  • SHARD_COUNT: the number of shards in your cluster. The shard count determines the total memory capacity for storing cluster data.

  • CONFIG_NAME: the name of the configuration parameter that you want to set.

  • CONFIG_VALUE: the value of the parameter that you're setting.

For example:

gcloud redis clusters create my-cluster --region=us-east1 --project=my-project --network=projects/my-project/global/networks/default --node-type=redis-highmem-medium --shard-count=3 --redis-config=maxmemory-policy=allkeys-lru

Update a configuration parameter

To update a configuration parameter for an existing cluster, use the
gcloud redis clusters update command with the --update-redis-config flag.

gcloud redis clusters update CLUSTER_ID \
--region=REGION_ID \
--project=PROJECT_ID \
--update-redis-config=CONFIG_NAME=CONFIG_VALUE

Make the following replacements:

  • CLUSTER_ID: the ID of the cluster
  • REGION_ID: the region where the cluster is located
  • PROJECT_ID: your project ID
  • CONFIG_NAME: the name of the configuration parameter that you want to update
  • CONFIG_VALUE: the new value of the parameter

For example:

gcloud redis clusters update my-cluster --region=us-east1 --project=my-project --update-redis-config=maxmemory-policy=allkeys-lru

For more information about which configuration parameters you can update, see Modifiable configuration parameters.

Reset a configuration parameter

To reset a configuration parameter to its default value, use the
gcloud redis clusters update command with the --remove-redis-config flag.

gcloud redis clusters update CLUSTER_ID \
--region=REGION_ID \
--project=PROJECT_ID \
--remove-redis-config=CONFIG_NAME

Make the following replacements:

  • CLUSTER_ID: the ID of the cluster
  • REGION_ID: the region where the cluster is located
  • PROJECT_ID: your project ID
  • CONFIG_NAME: the name of the configuration parameter that you want to reset to its default value

For example:

gcloud redis clusters update my-cluster --region=us-east1 --project=my-project --remove-redis-config=maxmemory-policy