Melampirkan hyperdisk ke VM Managed Service for Apache Spark

Halaman ini menunjukkan cara melampirkan hyperdisk ke virtual machine (VM) di cluster Managed Service untuk Apache Spark. Anda dapat mengonfigurasi disk secara terpisah untuk grup node master, worker utama, dan worker sekunder. Disk ini dipasang ke node cluster selain boot disk dan SSD lokal yang dipasang ke node cluster.

Sebelum memulai

  1. 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.
  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. Verify that you have the permissions required to complete this guide.

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

  5. Enable the Managed Service for Apache Spark API.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). 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. Verify that you have the permissions required to complete this guide.

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

  9. Enable the Managed Service for Apache Spark API.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the API

Peran yang diperlukan

Peran IAM tertentu diperlukan untuk menjalankan contoh di halaman ini. Bergantung pada kebijakan organisasi, peran ini mungkin sudah diberikan. Untuk memeriksa pemberian peran, lihat Apakah Anda perlu memberikan peran?.

Untuk mengetahui informasi selengkapnya tentang pemberian peran, lihat Mengelola akses ke project, folder, dan organisasi.

Peran pengguna

Untuk mendapatkan izin yang Anda perlukan untuk membuat cluster Managed Service untuk Apache Spark, minta administrator untuk memberi Anda peran IAM berikut:

Peran akun layanan

Untuk memastikan bahwa akun layanan default Compute Engine memiliki izin yang diperlukan untuk membuat cluster Managed Service untuk Apache Spark, minta administrator Anda untuk memberikan peran IAM Dataproc Worker (roles/dataproc.worker) kepada akun layanan default Compute Engine di project.

Karakteristik disk

Disk terlampir memiliki karakteristik berikut:

  • Siklus proses: Masa aktif disk terpasang cocok dengan masa aktif VM yang terpasang ke disk tersebut. Managed Service untuk Apache Spark membuat disk saat membuat VM dan menghapus disk saat menghapus VM.
  • Immutability: Anda tidak dapat memperbarui properti disk terlampir, seperti ukuran, IOPS, atau throughput, setelah cluster dibuat.
  • Pemasangan dan penggunaan: Managed Service untuk Apache Spark memasang disk di /mnt/N, dengan N adalah bilangan bulat positif (misalnya, /mnt/1, /mnt/2). HDFS dan data sementara, seperti output shuffle, menggunakan disk terlampir, bukan persistent disk boot.

Konfigurasi disk

Anda dapat menentukan parameter konfigurasi disk berikut saat memasang disk ke node cluster Managed Service untuk Apache Spark:

  • Jenis disk - wajib: Jenis disk yang akan dipasang ke instance VM. Hyperdisk berikut didukung:

    • hyperdisk-balanced
    • hyperdisk-extreme
    • hyperdisk-ml
    • hyperdisk-throughput

    Jenis hyperdisk balanced high availability dan disk persisten tidak dapat dilampirkan ke node cluster.

  • Ukuran - opsional: Ukuran disk. Nilai harus berupa bilangan bulat yang diikuti dengan GB untuk gigabyte atau TB untuk terabyte. Misalnya, 10GB melampirkan disk 10 gigabyte. Untuk mengetahui informasi selengkapnya, lihat Batas ukuran Hyperdisk.

  • IOPs - opsional: Menunjukkan IOPS yang akan disediakan untuk disk terlampir. Parameter ini menetapkan batas untuk operasi I/O disk per detik. Untuk mengetahui informasi selengkapnya, lihat Tingkat performa default.

  • Throughput - opsional: Menunjukkan throughput yang akan disediakan untuk disk terlampir. Parameter ini menetapkan batas untuk throughput dalam MiB per detik. Untuk mengetahui informasi selengkapnya, lihat Tingkat performa default.

Melampirkan disk ke cluster

Anda dapat melampirkan disk saat membuat cluster Managed Service untuk Apache Spark menggunakan gcloud CLI atau Dataproc API untuk menentukan konfigurasi disk.

gcloud CLI

  • Untuk melampirkan disk saat Anda membuat cluster, gunakan flag --master-attached-disks, --worker-attached-disks, atau --secondary-worker-attached-disks dengan perintah gcloud dataproc clusters create.

  • Setiap tanda menerima daftar konfigurasi disk yang dipisahkan dengan titik koma. Setiap konfigurasi disk adalah daftar key-value pair yang dipisahkan koma untuk type, size, iops, dan throughput (lihat Konfigurasi disk).

Contoh: Perintah berikut membuat cluster dan melampirkan dua hyperdisk ke setiap node worker utama.

gcloud dataproc clusters create CLUSTER_NAME \
    --region=REGION \
    --worker-attached-disks='type=hyperdisk-balanced,size=100GB,iops=5000,throughput=200;type=hyperdisk-throughput,size=9000GB'

API

  • Untuk melampirkan disk, sertakan array attachedDiskConfigs dalam objek diskConfig untuk grup instance masterConfig, workerConfig, atau secondaryWorkerConfig.

  • Berikan konfigurasi di isi permintaan API clusters.create.

Contoh: Cuplikan JSON berikut menunjukkan array attachedDiskConfigs yang melampirkan dua hyperdisk:

[
  {
    "diskType": "HYPERDISK_BALANCED",
    "diskSizeGb": 100,
    "provisionedIops": 5000,
    "provisionedThroughput": 200
  },
  {
    "diskType": "HYPERDISK_THROUGHPUT",
    "diskSizeGb": 9000
  }
]