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
- 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.
-
Verify that you have the permissions required to complete this guide.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Managed Service for Apache Spark API.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. 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.-
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.
-
Verify that you have the permissions required to complete this guide.
-
Verify that billing is enabled for your Google Cloud project.
Enable the Managed Service for Apache Spark API.
Roles required to enable APIs
To enable APIs, you need the
serviceusage.services.enablepermission. 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.
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:
- Dataproc Editor (
roles/dataproc.editor) di project - Pengguna Akun Layanan (
roles/iam.serviceAccountUser) di akun layanan default Compute Engine
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, denganNadalah 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-balancedhyperdisk-extremehyperdisk-mlhyperdisk-throughput
Jenis
hyperdisk balanced high availabilitydan disk persisten tidak dapat dilampirkan ke node cluster.Ukuran - opsional: Ukuran disk. Nilai harus berupa bilangan bulat yang diikuti dengan
GBuntuk gigabyte atauTBuntuk terabyte. Misalnya,10GBmelampirkan 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
MiBper 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-disksdengan perintahgcloud 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, danthroughput(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
attachedDiskConfigsdalam objekdiskConfiguntuk grup instancemasterConfig,workerConfig, atausecondaryWorkerConfig.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
}
]