Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Crea un'istanza Memorystore for Memcached utilizzando la console Google Cloud
Questa guida rapida illustra i passaggi per creare un'istanza Memorystore for Memcached, connettersi all'istanza, impostare un valore, recuperare un valore ed eliminare l'istanza.
Prima di iniziare
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
Seleziona le configurazioni per la nuova istanza nella pagina Crea un'istanza
Memcached nella console Google Cloud :
Inserisci un ID istanza utilizzando solo lettere minuscole, numeri e trattini.
Deve iniziare con una lettera.
Ad esempio, my-memcached-instance-1.
Scegli us-central1 dal menu a discesa Regione.
Scegli Automatically distribute dal menu a discesa Zona.
Inserisci 2 in Nodi per creare due nodi.
Scegli 1 GB di Memoria per nodo.
Scegli 1 per Core per nodo.
Seleziona default per la rete autorizzata.
Fai clic su Crea.
Dopo aver creato l'istanza, fai clic sul relativo ID per visualizzare la pagina dei dettagli.
Annota l'IP address di uno dei tuoi nodi.
Connessione all'istanza da una VM Compute Engine
Per testare la connessione:
Connettiti a una VM Linux. Per i passaggi per connetterti a una VM Linux, consulta la Guida rapida all'utilizzo di una VM Linux.
Se hai utilizzato un'immagine basata su Debian per creare l'istanza VM come descritto nella
guida rapida, installa telnet utilizzando apt-get:
sudo apt-get install telnet
Nel terminale, inserisci il comando telnet seguito dall'indirizzo IP di uno dei nodi Memcached.
Sostituisci node-ip-address con l'indirizzo IP del tuo nodo.
telnet node-ip-address 11211
Dovresti vedere il seguente output con [bracketed-variables] sostituito
dalle variabili del tuo progetto:
Trying [node-ip-address]…
Connected to [node-ip-address]
Nella sessione di Telnet, inserisci alcuni comandi Memcached:
Digita:
get greeting
Risultato:
END
Digita:
set greeting 1 0 11
hello world
Risultato:
STORED
Digita:
get greeting
Risultato:
VALUE greeting 1 11
hello world
END
Memorystore for Memcached supporta le librerie Memcached open source standard.
Esegui la pulizia
Per evitare che al tuo account Google Cloud vengano addebitati costi relativi alle risorse utilizzate in questa pagina, segui questi passaggi.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-05 UTC."],[],[],null,["# Quickstart: Create a Memorystore for Memcached instance by using the Google Cloud console\n\nCreate a Memorystore for Memcached instance by using the Google Cloud console\n=============================================================================\n\nThis quickstart walks you through the steps to create a Memorystore for Memcached\ninstance, connect to the instance, set a value, retrieve a value, and delete the\ninstance.\n| **Caution:** You cannot create a Memorystore for Memcached instance without first having a private services access connection established. See [Networking](/memorystore/docs/memcached/networking) for details on the private services access connection that is required for Memorystore for Memcached.\n\nBefore you begin\n----------------\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **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.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **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.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n1. Enable the Service Networking API for your project. \n [Enable the Service Networking API](https://console.cloud.google.com/apis/library/servicenetworking.googleapis.com)\n2. Enable the Memorystore for Memcached API for your project. \n [Enable the Memorystore for Memcached API](https://console.cloud.google.com/apis/api/memcache.googleapis.com)\n\n\u003cbr /\u003e\n\nCreating a Memcached instance\n-----------------------------\n\n1. Go to the Memorystore for Memcached page in the Google Cloud console.\n\n [Memorystore for Memcached](https://console.cloud.google.com/memorystore/memcached/instances) \n\n2. Click the **Create Instance** button.\n\n3. Select the configurations for your new instance on the **Create a Memcached\n instance** page in the Google Cloud console:\n\n - Enter an instance ID using only lowercase letters, numbers, and hyphens. Start with a letter.\n - For example, `my-memcached-instance-1`.\n - Choose `us-central1` from the **Region** dropdown.\n - Choose `Automatically distribute` from the **Zone** dropdown.\n - Enter `2` under **Nodes** to create two nodes.\n - Choose 1 GB of **Memory per node**.\n - Choose 1 for **Cores per node**.\n - Select `default` for the **Authorized network**.\n\n | **Note:** If you see the **Private service connection required** panel, you need to [establish a private services access connection](/memorystore/docs/memcached/establishing-connection).\n4. Click **Create**.\n\n5. After the instance is created, click the instance ID to view the instance\n details page.\n\n6. Write down the `IP address` of one of your nodes.\n\nConnecting to your instance from a Compute Engine VM\n----------------------------------------------------\n\n| **Note:** To connect to a Memcached instance, your client VM must be located in the same region, and must be connected to the same network, as your instance.\n\nTo test the connection:\n\n1. Connect to a Linux VM. For steps to connect to a Linux VM, see [Quickstart Using a Linux VM](/compute/docs/create-linux-vm-instance).\n If you used a Debian based image to create your VM instance as described in the\n quickstart, install `telnet` using `apt-get`:\n\n sudo apt-get install telnet\n\n2. From the terminal, telnet to the IP address of one of the Memcached nodes.\n Replace \u003cvar translate=\"no\"\u003enode-ip-address\u003c/var\u003e with the IP address of your node.\n\n ```\n telnet node-ip-address 11211\n ```\n\n You should see the following output with the `[bracketed-variables]` replaced\n your project's variables: \n\n ```\n Trying [node-ip-address]…\n Connected to [node-ip-address]\n ```\n3. In the telnet session, enter some Memcached commands:\n\n Enter: \n\n ```\n get greeting\n ```\n\n Result: \n\n ```\n END\n ```\n\n Enter: \n\n ```\n set greeting 1 0 11\n hello world\n ```\n\n Result: \n\n ```\n STORED\n ```\n\n Enter: \n\n ```\n get greeting\n ```\n\n Result: \n\n ```\n VALUE greeting 1 11\n hello world\n END\n ```\n\nMemorystore for Memcached supports standard open source Memcached libraries.\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\n1. Go to the Memorystore for Memcached page in the Google Cloud console.\n\n [Memorystore for Memcached](https://console.cloud.google.com/memorystore/memcached/instances) \n\n2. Click the ID of the instance you want to delete.\n\n3. Click the **Delete** button.\n\n4. In the prompt that appears, enter the instance's ID.\n\n5. Click the **Delete** button.\n\nWhat's next\n-----------\n\n- [Connect to a Memcached instance](/memorystore/docs/memcached/connecting-memcached-instance).\n\n- [Use the Auto Discovery service](/memorystore/docs/memcached/using-auto-discovery).\n\n- [Monitor your Memcached instance](/memorystore/docs/memcached/monitoring-instances)."]]