Buat instance Memorystore for Redis menggunakan Google Cloud konsol
Pelajari cara membuat instance Memorystore for Redis, terhubung ke instance, lalu menghapusnya.
Untuk mengikuti panduan langkah demi langkah untuk tugas ini langsung di Google Cloud konsol, klik Pandu saya:
Sebelum memulai
- Login ke akun Google Cloud Anda. Jika Anda baru menggunakan Google Cloud, buat akun untuk mengevaluasi performa produk kami dalam skenario dunia nyata. Pelanggan baru juga mendapatkan kredit gratis senilai $300 untuk menjalankan, menguji, dan men-deploy workload.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Memorystore for Redis API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
Roles required to select or create a project
- Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
-
Create a project: To create a project, you need the Project Creator role
(
roles/resourcemanager.projectCreator), which contains theresourcemanager.projects.createpermission. Learn how to grant roles.
-
If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Memorystore for Redis API.
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.
Peran yang diperlukan
Untuk mendapatkan izin yang Anda perlukan guna membuat instance Memorystore for Redis, minta administrator untuk memberi Anda peran IAM berikut pada project:
-
Admin Cloud Memorystore Redis (
roles/redis.admin) -
Compute Instance Admin (v1) (
roles/compute.instanceAdmin.v1) -
Service Account User (
roles/iam.serviceAccountUser)
Untuk mengetahui informasi selengkapnya tentang pemberian peran, lihat Mengelola akses ke project, folder, dan organisasi.
Anda mungkin juga bisa mendapatkan izin yang diperlukan melalui peran khusus atau peran bawaan lainnya.
Buat instance Memorystore for Redis
Di bagian ini, Anda akan membuat instance Memorystore for Redis 2 GB yang
berada di region us-central1 dan menggunakan tingkat Dasar. Untuk mengetahui informasi selengkapnya tentang tingkat, lihat Kemampuan tingkat Redis.
Di konsol Google Cloud , buka halaman Memorystore for Redis.
Klik Create instance.
Di halaman Create a Redis instance, lakukan konfigurasi berikut untuk instance yang Anda buat:
- Di kolom Instance ID, masukkan
my-instance-1. - Di kolom Nama tampilan, masukkan
My Quickstart Instance. - Di bagian Tier selection, pilih Basic. Tingkat ini menetapkan node Redis mandiri, berbeda dengan tingkat Standar, yang menggunakan node replika untuk mencadangkan data Anda.
- Di kolom Kapasitas, masukkan
5. Tindakan ini menetapkan kapasitas instance Anda ke 5 GB. - Dari menu Region, pilih us-central1 (Iowa).
- Dari menu Network, pilih default.
- Luaskan node Configuration, lalu dari menu Version,
pilih
7.2 (Direkomendasikan).
- Di kolom Instance ID, masukkan
Klik Create instance.
Setelah membuat instance, dapatkan
IP addressinstance Anda dengan mengikuti langkah-langkah berikut:- Di konsol Google Cloud , buka halaman Memorystore for Redis.
Memorystore for Redis - Klik ID instance Anda:
my-instance-1. - Di bagian Connections, catat
Primary Endpoint dan nomor Port instance Anda di
6379. Anda memerlukan endpoint dan nomor port untuk terhubung ke instance.
- Di konsol Google Cloud , buka halaman Memorystore for Redis.
Menghubungkan ke instance Memorystore for Redis dari VM Compute Engine
Anda dapat terhubung ke instance Memorystore for Redis dari VM Compute Engine mana pun yang menggunakan jaringan resmi instance dengan alamat IP RFC 1918 yang didukung.
Jika Anda tidak memiliki VM Compute Engine yang menggunakan jaringan resmi yang sama dengan instance Anda, buat VM tersebut, lalu hubungkan ke VM menggunakan SSH. Untuk melakukannya, ikuti langkah-langkah di Membuat instance VM Linux di Compute Engine.
Gunakan
apt-getuntuk menginstaltelnet:sudo apt-get install telnetDari terminal, telnet ke alamat IP instance. Ganti VARIABLES dengan nilai yang sesuai.
telnet INSTANCE_IP_ADDRESS 6379
Jika Anda dapat terhubung ke instance, perintah akan menampilkan hasil ini:
Trying INSTANCE_IP_ADDRESS… Connected to INSTANCE_IP_ADDRESS
Di sesi telnet, masukkan beberapa perintah Redis:
Enter:
PING
Hasil:
PONG
Enter
SET HELLO WORLD
Hasil:
+OK
Enter:
GET HELLO
Hasil:
$5 WORLD
Pembersihan
Agar akun Google Cloud Anda tidak dikenai biaya untuk resource yang digunakan pada halaman ini, ikuti langkah-langkah berikut.
- Di konsol Google Cloud , buka halaman Memorystore for Redis.
Memorystore for Redis - Klik ID instance yang ingin Anda hapus.
- Klik Hapus.
- Pada perintah yang muncul, masukkan ID instance.
- Klik Hapus.
- Opsional. Jika Anda membuat VM Compute Engine untuk panduan memulai ini, hapus VM tersebut.
Langkah berikutnya
- Pelajari lebih lanjut cara membuat dan mengelola instance.
- Pelajari cara lain untuk terhubung ke instance Redis Anda.
- Pelajari karakteristik instance Redis.