Create a Memorystore for Memcached instance by using the Google Cloud console
This quickstart walks you through the steps to create a Memorystore for Memcached instance, connect to the instance, set a value, retrieve a value, and delete the instance.
Before you begin
- 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.
-
Make sure that billing is enabled for your Google Cloud project.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Service Networking API for your project.
Enable the Service Networking API -
Enable the Memorystore for Memcached API for your project.
Enable the Memorystore for Memcached API
Creating a Memcached instance
Go to the Memorystore for Memcached page in the Google Cloud console.
Memorystore for MemcachedClick the Create Instance button.
Select the configurations for your new instance on the Create a Memcached instance page in the Google Cloud console:
- Enter an instance ID using only lowercase letters, numbers, and hyphens.
Start with a letter.
- For example,
my-memcached-instance-1
.
- For example,
- Choose
us-central1
from the Region dropdown. - Choose
Automatically distribute
from the Zone dropdown. - Enter
2
under Nodes to create two nodes. - Choose 1 GB of Memory per node.
- Choose 1 for Cores per node.
Select
default
for the Authorized network.
- Enter an instance ID using only lowercase letters, numbers, and hyphens.
Start with a letter.
Click Create.
After the instance is created, click the instance ID to view the instance details page.
Write down the
IP address
of one of your nodes.
Connecting to your instance from a Compute Engine VM
To test the connection:
Connect to a Linux VM. For steps to connect to a Linux VM, see Quickstart Using a Linux VM. If you used a Debian based image to create your VM instance as described in the quickstart, install
telnet
usingapt-get
:sudo apt-get install telnet
From the terminal, telnet to the IP address of one of the Memcached nodes. Replace node-ip-address with the IP address of your node.
telnet node-ip-address 11211
You should see the following output with the
[bracketed-variables]
replaced your project's variables:Trying [node-ip-address]… Connected to [node-ip-address]
In the telnet session, enter some Memcached commands:
Enter:
get greeting
Result:
END
Enter:
set greeting 1 0 11 hello world
Result:
STORED
Enter:
get greeting
Result:
VALUE greeting 1 11 hello world END
Memorystore for Memcached supports standard open source Memcached libraries.
Clean up
To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.
Go to the Memorystore for Memcached page in the Google Cloud console.
Memorystore for MemcachedClick the ID of the instance you want to delete.
Click the Delete button.
In the prompt that appears, enter the instance's ID.
Click the Delete button.