Memorystore is a fully managed in-memory data store service for Redis and Memcached at Google Cloud. It is best for in-memory and transient data stores and automates the complex tasks of provisioning, replication, failover, and patching so you can spend more time coding. Because it offers extremely low latency and high performance, Memorystore is great for web and mobile, gaming, leaderboard, social, chat, and news feed applications.
- Create a new Memorystore for Redis instance
- Connect to the instance once created
- Send and receive cached data stored in the instance
gcloud redis instances create --project=qwiklabs-gcp-03-bda628d88494 my-instance-1 --tier=basic --size=5 --region=us-east4 --redis-version=redis_5_0 --network=projects/qwiklabs-gcp-03-bda628d88494/global/networks/default --connect-mode=DIRECT_PEERING --display-name="My Quickstart Instance"
Instance IP address
After the instance is created, obtain your instance's IP address by following these steps:
From the Memorystore > Redis page, click on the ID of the instance:my-instance-1.
Under Connections, from Primary endpoint take a note of your instance's IP address.
Also note that your instance's Port number is 6379
Connections
Primary endpoint
10.44.247.27:6379
Authorized network
default (qwiklabs-gcp-03-bda628d88494)
Connection mode
Direct peering
IP range
10.44.247.24/29
Task 2. Connecting to the Redis instance from a Compute Engine VM instance
CONNECT TO REDIS MEMORYSTORE INSTANCE:
student-02-9cd4e84cc657@test-vm:~$ telnet 10.44.247.24 6379
Trying 10.44.247.24...
^C
student-02-9cd4e84cc657@test-vm:~$ telnet 10.44.247.27 6379
Trying 10.44.247.27...
Connected to 10.44.247.27.
Escape character is '^]'.
PING
+PONG
SET HELLO WORLD
+OK
GET HELLO
$5
WORLD
SET greeting HeLL0
+OK
GET greeting
$5
HeLL0
SET greeting HeLL0
+OK
GET greeting
$5
HeLL0
student_02_9cd4e84cc657@cloudshell:~ (qwiklabs-gcp-03-bda628d88494)$ gcloud compute ssh --zone "us-east4-c" "test-vm" --project "qwiklabs-gcp-03-bda628d88494"
WARNING: The private SSH key file for gcloud does not exist.
WARNING: The public SSH key file for gcloud does not exist.
WARNING: You do not have an SSH key for gcloud.
WARNING: SSH keygen will be executed to generate a key.
This tool needs to create the directory [/home/student_02_9cd4e84cc657/.ssh] before being able to generate SSH keys.
Do you want to continue (Y/n)? Y
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/student_02_9cd4e84cc657/.ssh/google_compute_engine
Your public key has been saved in /home/student_02_9cd4e84cc657/.ssh/google_compute_engine.pub
The key fingerprint is:
SHA256:5S/4ysu1cN+D8/5nJCJNJ7UI1yD11Jy21z7PzyWH3JM student_02_9cd4e84cc657@cs-985543892336-default
The key's randomart image is:
+---[RSA 3072]----+
| ..oo.o.|
| ...oooo|
| .o oo.o|
| o + o.o|
| S .o o ..|
| ...o..++|
| o +..o+E*|
| o = +o..+B|
| =oo .+++*|
+----[SHA256]-----+
Warning: Permanently added 'compute.6836265187214649201' (ECDSA) to the list of known hosts.
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.15.0-1039-gcp x86_64)
System information as of Sun Aug 20 20:23:12 UTC 2023
System load: 0.0 Processes: 116
Usage of /: 22.3% of 9.51GB Users logged in: 0
Memory usage: 1% IPv4 address for ens4: 10.150.0.2
Swap usage: 0%
Creating directory '/home/student-02-9cd4e84cc657'.
student-02-9cd4e84cc657@test-vm:~$
gcloud compute --project=qwiklabs-gcp-03-bda628d88494 firewall-rules create allowall --direction=INGRESS --priority=1000 --network=default --action=ALLOW --rules=all --source-ranges=0.0.0.0/0
No comments:
Post a Comment