Membuat instance Filestore menggunakan Google Cloud konsol

Panduan memulai ini menunjukkan cara melakukan operasi dasar di Filestore menggunakan konsol ini Google Cloud . Dalam panduan memulai ini, Anda akan:

  • Membuat instance Filestore.
  • Memasang berbagi file dari instance tersebut di instance VM klien Compute Engine.
  • Membuat file di berbagi file yang terpasang.
  • Menghapus instance Filestore.

Sebelum memulai

  1. Login ke akun Anda. Google Cloud 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.
  2. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. 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.

  4. Verify that billing is enabled for your Google Cloud project.

  5. Enable the Filestore API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

  6. 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 the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  7. 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.

  8. Verify that billing is enabled for your Google Cloud project.

  9. Enable the Filestore API.

    Roles required to enable APIs

    To enable APIs, you need the Service Usage Admin IAM role (roles/serviceusage.serviceUsageAdmin), which contains the serviceusage.services.enable permission. Learn how to grant roles.

    Enable the API

Peran yang diperlukan

Untuk mendapatkan izin yang Anda perlukan untuk menyelesaikan panduan memulai ini, minta administrator Anda untuk memberi Anda peran IAM berikut di project Anda:

  • Membuat dan mengelola instance Filestore: Cloud Filestore Editor (roles/file.editor)
  • Membuat dan mengelola instance Compute Engine: Compute Instance Admin (v1) (roles/compute.instanceAdmin.v1)
  • Membuat, mengubah, dan menghapus resource jaringan, kecuali aturan firewall: Compute Network Admin (roles/compute.networkAdmin)
  • Menjalankan operasi pada akun layanan IAM: Service Account User (roles/iam.serviceAccountUser)
  • Mengelola jaringan dan resource terkait: Network Administrator (roles/iam.networkAdmin) Google Cloud

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.

Setelah menyelesaikan tugas yang dijelaskan dalam dokumen ini, Anda dapat menghindari penagihan berkelanjutan dengan menghapus resource yang Anda buat. Untuk mengetahui informasi selengkapnya, baca bagian Pembersihan.

Membuat instance VM Compute Engine untuk menjadi klien

  1. Di Google Cloud konsol, buka halaman VM Instances.

    Buka halaman instance Compute Engine

  2. Klik Create Instance dan konfigurasi instance sebagai berikut.

    • Setel Name ke nfs-client.
    • Setel Zone ke us-central1-c.
    • Pertahankan disk boot default.
    • Di bagian Networking > Firewall, centang kotak Allow HTTP traffic.
    • Pertahankan jaringan sebagai default.
  3. Klik Create untuk membuat instance.

Membuat instance Filestore

Panduan memulai ini menunjukkan cara membuat instance di tingkat Regional dengan performa kustom diaktifkan. Untuk mengetahui detail cara membuat instance, lihat membuat instance.

  1. Di Google Cloud konsol, buka halaman Instances Filestore.

    Buka halaman Instances Filestore

  2. Klik Create Instance dan konfigurasi instance sebagai berikut:

    • Setel Instance ID ke nfs-server.
    • Setel Instance type ke Regional.
    • Di Capacity, masukkan 1 TiB.
    • Di Performance, klik tombol Custom performance untuk mengaktifkan performa kustom. Secara default, Anda akan mendapatkan 12.000 IOPS di kolom Performance. Kotak centang Scale performance with capacity dicentang, jadi jika Anda mengubah nilai di kolom Capacity, performa akan diskalakan sesuai dengan perubahan tersebut. Untuk mengetahui detail opsi konfigurasi, lihat mengonfigurasi performa.

    • Setel Region ke us-central1.

    • Setel VPC network ke default.

    • Setel File share name ke vol1.

    • Setel Allocated IP range ke Use an automatically allocated IP range.

    • Setel Access controls ke Grant access to all clients.

  3. Klik Create.

Memasang berbagi file Filestore di klien

  1. Di Google Cloud konsol, buka halaman VM Instances.

    Buka halaman VM instances

  2. Di daftar instance VM, klik tombol SSH untuk nfs-client guna membuka jendela terminal yang terhubung ke instance tersebut.

  3. Instal NFS dengan menjalankan perintah berikut:

    sudo apt-get -y update &&
    sudo apt-get -y install nfs-common
    
  4. Buat direktori pemasangan untuk berbagi file Filestore dengan menjalankan perintah berikut:

    sudo mkdir -p /mnt/test
    
  5. Pasang berbagi file dengan menjalankan perintah mount dan menentukan alamat IP instance Filestore dan nama berbagi file:

    sudo mount MOUNT-POINT-DIRECTORY /mnt/test
    

    dengan:

    MOUNT-POINT-DIRECTORY adalah jalur ke direktori tempat berbagi file Filestore dipasang. Contoh: 10.0.0.2:/vol1

  6. Opsional: Pastikan berbagi file Filestore terpasang:

    df -h --type=nfs
    
  7. Buat berbagi file dapat diakses dengan mengubah izin:

    sudo chmod go+rw /mnt/test
    

Membuat file di berbagi file

  1. Di jendela terminal yang terhubung ke instance nfs-client, buat file bernama testfile dengan menjalankan perintah berikut:

    echo 'This is a test' > /mnt/test/testfile
    
  2. Pastikan file dibuat dengan menjalankan perintah berikut:

    ls /mnt/test
    

    dan memverifikasi bahwa testfile tercantum.

Pembersihan

Agar akunAnda tidak dikenai biaya untuk resource yang digunakan pada halaman ini, ikuti langkah-langkah berikut. Google Cloud

Menghapus Google Cloud project

  1. Di Google Cloud konsol, buka halaman Manage resources.

    Buka Kelola resource

  2. Pada daftar project, pilih project yang Anda ingin Anda hapus, lalu klik Delete.
  3. Pada dialog, ketik project ID, lalu klik Shut down untuk menghapus project.

Menghapus instance Filestore

  1. Di Google Cloud konsol, buka halaman Instances Filestore.

    Buka halaman instance Filestore

  2. Klik ID instance nfs-server untuk membuka halaman detail instance.

  3. Klik Delete .

  4. Saat diminta, ketik ID instance.

  5. Klik Delete.

Menghapus instance Compute Engine

  1. Di Google Cloud konsol, buka halaman Instances Filestore.

    Buka halaman VM instances

  2. Centang kotak di samping nama instance nfs-client.

  3. Klik Delete .

  4. Saat diminta, klik Delete lagi.

Langkah berikutnya