Dans la liste déroulante Configurer des instances dupliquées avec accès en lecture, sélectionnez le nombre souhaité d'instances dupliquées avec accès en lecture.
Revenez aux instructions Créer une instance Redis sur un réseau VPC pour obtenir des conseils supplémentaires sur d'autres configurations Memorystore ou cliquez sur le bouton Créer.
gcloud
Saisissez la commande suivante en remplaçant les variables par les valeurs appropriées :
Dans la section Configuration, à côté de Instances répliquées avec accès en lecture, cliquez sur ACTIVER.
(Facultatif) Spécifiez une plage d'adresses IP personnalisée.
Si votre instance utilise le mode de connexion par peering direct, vous pouvez saisir une plage CIDR spécifique avec une taille de bloc d'au moins /28, à condition qu'elle ne chevauche aucune autre plage existante.
Par exemple, vous pouvez saisir 10.100.0.0/28.
Si votre instance utilise le mode de connexion d'accès privé aux services, vous pouvez choisir une plage allouée existante de taille /28 dans le menu déroulant. Pour savoir comment allouer une plage d'adresses IP visible dans le menu déroulant, consultez Créer une allocation d'adresses IP.
Cliquez sur Activer les instances répliquées avec accès en lecture.
gcloud
Pour activer les instances dupliquées avec accès en lecture pour votre instance, saisissez la commande suivante en remplaçant variables par les valeurs appropriées.
size est la taille de chaque nœud Redis de votre instance, y compris le nœud principal. Par exemple, si vous disposez d'une instance activée pour les instances dupliquées avec accès en lecture dotée de six nœuds (y compris le nœud principal) avec --size=10, la taille totale de votre instance est de 60 Gio.
Se connecter à l'instance à l'aide du point de terminaison de lecture
Afficher les informations sur l'instance dupliquée avec accès en lecture pour votre instance
Pour trouver des informations sur les instances dupliquées avec accès en lecture pour votre instance, exécutez la commande suivante en remplaçant variables par les valeurs appropriées :
Dans les résultats de métadonnées de la commande précédente :
readEndpoint: indique l'adresse IP du point de terminaison de lecture.
readEndpointPort indique le numéro de port du point de terminaison de lecture.
readReplicasMode indique si les instances dupliquées avec accès en lecture ont été activées.
readReplicaCount indique le nombre d'instances dupliquées de l'instance.
nodes: affiche chaque ID de nœud d'instance dupliquée et la région où se trouve le nœud d'instance dupliquée.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/05 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/05 (UTC)."],[],[],null,["# Manage read replicas\n\nThis page provides instructions for enabling and managing [read replicas](/memorystore/docs/redis/read-replicas).\n\nCreating a Redis instance with read replicas\n--------------------------------------------\n\n### Console\n\n| **Note:** Once you create and instance with read replicas, read replicas can't be disabled for that instance.\n\n1. Go to the **Memorystore for Redis** page in the Google Cloud console.\n\n [Memorystore for Redis](https://console.cloud.google.com/memorystore/redis/instances?)\n2. Click **Create Instance**.\n\n3. Follow the instructions at [Creating a Redis instance on a VPC network](/memorystore/docs/redis/create-manage-instances#creating_a_redis_instance_on_a_vpc_network),\n but return to these instructions when selecting **Tier**.\n\n4. Choose **Standard** tier.\n\n5. Under the **Configure read replicas** dropdown, select your desired number\n of read replicas.\n\n6. Return to the [Creating a Redis instance on a VPC network](/memorystore/docs/redis/create-manage-instances#creating_a_redis_instance_on_a_vpc_network)\n instructions for additional guidance on other Memorystore\n configurations, or click the **Create** button.\n\n### gcloud\n\n| **Note:** Once you create and instance with read replicas, read replicas can't be disabled for that instance.\n\nEnter the following command, replacing \u003cvar translate=\"no\"\u003evariables\u003c/var\u003e with appropriate\nvalues: \n\n```\ngcloud redis instances create instance-id --size=size --region=region-id --replica-count=count --read-replicas-mode=read-replicas-enabled --tier=standard\n```\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003ecount\u003c/var\u003e is a value from 1 to 5. This sets the number of read replicas.\n\nEnabling read replicas on existing Redis instances\n--------------------------------------------------\n\n### Console\n\n| **Important:**\n| - Enabling [read replicas](/memorystore/docs/redis/read-replicas) on an existing Redis instance is an exclusive operation, meaning you cannot perform other [update operation](/sdk/gcloud/reference/redis/instances/update) instance modifications as a part of the same operation that enables read replicas.\n| - After enabling read replicas, [scale the node count](/memorystore/docs/redis/managing-read-replicas#adding_or_removing_replica_nodes_from_your_redis_instance) to your desired number of read replicas.\n\n1. Go to the **Memorystore for Redis** page in the Google Cloud console.\n\n [Memorystore for Redis](https://console.cloud.google.com/memorystore/redis/instances?)\n2. Click the ID of the instance.\n\n3. Under the **Configuration** section, next to **Read Replicas** ,\n click **ENABLE**.\n\n4. **(Optional)** Specify a custom IP range\n\n - If your instance uses the direct peering [connection mode](/memorystore/docs/redis/networking#connection_modes),\n you can enter a specific CIDR range with a block size of at least `/28`,\n as long as it doesn't overlap with any other existing ranges.\n For example, you could enter `10.100.0.0/28`.\n\n - If your instance uses the private services access [connection mode](/memorystore/docs/redis/networking#connection_modes),\n you can choose an existing allocated range of size `/28` from the\n dropdown menu. For instructions on allocating an IP address range\n viewable from the dropdown menu, see\n [Creating an IP allocation](/vpc/docs/configure-private-services-access#procedure).\n\n5. Click **Enable Read Replicas**.\n\n### gcloud\n\n| **Important:** Enabling [read replicas](/memorystore/docs/redis/read-replicas) on an existing Redis instance is an exclusive operation, meaning you cannot perform other [update operation](/sdk/gcloud/reference/redis/instances/update) instance modifications as a part of the same operation that enables read replicas. \n|\n| After enabling read replicas, [scale the node count](/memorystore/docs/redis/managing-read-replicas#adding_or_removing_replica_nodes_from_your_redis_instance) to your desired number of read replicas.\n\nTo enable read replicas for your instance, enter the following command,\nreplacing \u003cvar translate=\"no\"\u003evariables\u003c/var\u003e with appropriate values. \n\n```\ngcloud redis instances update INSTANCE_ID --read-replicas-mode=READ_REPLICAS_ENABLED --secondary-ip-range=SECONDARY_RANGE\n```\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003eINSTANCE_ID\u003c/var\u003e is the ID of the instance for which you're enabling read replicas.\n- \u003cvar translate=\"no\"\u003eSECONDARY_RANGE\u003c/var\u003e is one of the following options:\n - `auto`. `auto` is supported for both networking connection modes.\n - If your instance uses the [direct peering connection mode](/memorystore/docs/redis/networking#direct_peering) you must provide a [valid CIDR IP address range](/memorystore/docs/redis/networking#supported_and_unsupported_networks) of size `/28`. For example, `--secondary-ip-range=10.100.0.0/28`.\n - If your instance uses the [private services access connection mode](/memorystore/docs/redis/networking#private_services_access) you must provide the name of an [allocated range](/vpc/docs/configure-private-services-access#procedure) of size `/28`. For example, `--secondary-ip-range=my-secondary-range-memorystore`.\n\nScaling read replica enabled instances\n--------------------------------------\n\n#### Adding or removing replica nodes from your Redis instance\n\n### Console\n\n1. Go to the Memorystore for Redis page in the Google Cloud console. \n [Memorystore for Redis](https://console.cloud.google.com/memorystore/redis/instances?)\n2. Click the Instance ID of the instance to which you want to add/remove replica nodes.\n3. Click **Edit**.\n4. Under **Configure read replicas**, enter your desired number of replicas.\n5. Click **Save**.\n\n### gcloud\n\nEnter the following command, replacing \u003cvar translate=\"no\"\u003evariables\u003c/var\u003e with appropriate\nvalues: \n\n```\ngcloud redis instances update instance-id --region=region-id --replica-count=count\n```\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003ecount\u003c/var\u003e is a value from 1 to 5. This sets the number of read replicas.\n\n#### Scaling the size of Redis nodes\n\n### Console\n\n1. Go to the Memorystore for Redis page in the Google Cloud console. \n [Memorystore for Redis](https://console.cloud.google.com/memorystore/redis/instances?)\n2. Click the Instance ID of the instance you want to resize.\n3. Click **Edit**.\n4. Under **Capacity**, enter a new size in the field to update the instance's capacity.\n5. Click **Save**.\n\n### gcloud\n\nEnter the following command, replacing \u003cvar translate=\"no\"\u003evariables\u003c/var\u003e with appropriate\nvalues: \n\n```\ngcloud redis instances update instance-id --region=region-id --size=size\n```\n\nWhere:\n\n- \u003cvar translate=\"no\"\u003esize\u003c/var\u003e 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.\n\nConnecting to your instance using the read endpoint\n---------------------------------------------------\n\nFor instructions on using the read endpoint to connect to your instance, see\n[Connecting to a Redis instance using the read endpoint](/memorystore/docs/redis/connecting-redis-instance#connecting_to_a_redis_instance_using_the_read_endpoint).\n\nViewing read replica information for your instance\n--------------------------------------------------\n\nTo find information about read replicas for your instance, run the following\ncommand replacing \u003cvar translate=\"no\"\u003evariables\u003c/var\u003e with appropriate values: \n\n```\ngcloud redis instances describe instance-id --region=region-id\n```\n\nIn the metadata output from the previous command:\n\n- `readEndpoint:` shows the read endpoint IP address.\n- `readEndpointPort` shows the read endpoint port number.\n- `readReplicasMode` shows if read replicas have been enabled.\n- `readReplicaCount` shows the number of replicas the instance has.\n- `nodes:` displays each replica node ID, and the region where each replica node is located."]]