Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Quando crei un servizio Dataproc Metastore, devi scegliere di utilizzare
il tipo di database MySQL o il tipo di database Spanner.
Questa scelta influisce sulle funzionalità che puoi integrare e utilizzare con il tuo
servizio Dataproc Metastore. È importante notare che non puoi
aggiornare il tipo di database dopo aver creato un servizio
Dataproc Metastore. Assicurati di scegliere il tipo di database appropriato per le tue esigenze.
Questa pagina spiega le differenze tra questi tipi di database e come selezionarne uno per il tuo servizio.
Differenze tra MySQL e Spanner
MySQL
Il tipo di database MySQL di Dataproc Metastore è un'implementazione di Cloud SQL.
Tieni presente quanto segue quando utilizzi un database MySQL:
MySQL è il tipo di database predefinito quando crei un Dataproc Metastore.
MySQL è supportato da tutte le versioni di Hive.
MySQL supporta tutte le funzionalità di Dataproc Metastore.
MySQL supporta la crittografia di Dataproc Metastore, ad esempio l'utilizzo di chiavi di crittografia gestite dal cliente (CMEK).
Spanner
Il tipo di database Spanner di Dataproc Metastore è un'implementazione di Spanner.
Tieni presente quanto segue quando utilizzi un database Spanner:
Spanner è supportato solo nelle versioni 2.3.6 e 3.1.2 di Hive.
Spanner supporta solo le importazioni Avro.
Ulteriori dettagli
La tabella seguente fornisce ulteriori dettagli su queste differenze.
MySQL
Spanner
Affidabilità (uptime)
SLO di Cloud SQL del 99,95%*
SLO di Spanner 99,99%*
Periodi di manutenzione
Obbligatorio
Non obbligatoria
Note:
*Gli SLO di Cloud SQL e Spanner non si traducono direttamente negli SLO di Dataproc Metastore.
Dataproc Metastore
La selezione del tipo di database non influisce sugli SLO di Dataproc Metastore.
Non c'è alcuna differenza di prezzo tra i due tipi di database.
Per ottenere l'autorizzazione necessaria per creare un Dataproc Metastore, chiedi all'amministratore di concederti i seguenti ruoli IAM sul tuo progetto, in base al principio del privilegio minimo:
Scegli il tipo di database quando crei un servizio Dataproc Metastore.
L'esempio seguente mostra una versione abbreviata dei passaggi da seguire
per scegliere un tipo di database. Per istruzioni dettagliate, vedi
Creare un servizio Dataproc Metastore.
Console
Nella console Google Cloud , apri la pagina Dataproc Metastore:
SERVICE_ID: il nome o l'ID del servizio Dataproc Metastore.
LOCATION: la regione in cui si trova il servizio Dataproc Metastore.
DATABASE_TYPE: il tipo di database che vuoi
impostare per il servizio Dataproc Metastore.
I valori accettati includono mysql e spanner. Il valore predefinito è
mysql.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[[["\u003cp\u003eDataproc Metastore services require the selection of either MySQL or Spanner as the database type during creation, which cannot be changed afterward.\u003c/p\u003e\n"],["\u003cp\u003eMySQL is the default database type, supporting all Hive versions and Dataproc Metastore features, including customer-managed encryption keys (CMEK).\u003c/p\u003e\n"],["\u003cp\u003eSpanner supports Hive versions 2.3.6 and 3.1.2, but only supports Avro imports.\u003c/p\u003e\n"],["\u003cp\u003eWhile there's no pricing difference, Spanner offers a higher reliability (uptime) SLO of 99.99%, compared to MySQL's 99.95%.\u003c/p\u003e\n"],["\u003cp\u003eMySQL requires maintenance windows, while Spanner does not.\u003c/p\u003e\n"]]],[],null,["# Database types\n\nWhen you create a Dataproc Metastore service, you must choose to use\neither the MySQL database type or the Spanner database type.\n\nThis choice affects the features that you can integrate and use with your\nDataproc Metastore service. It's important to note that you can't\nupdate your database type after you create a Dataproc Metastore\nservice. Make sure you choose the appropriate database type for your needs.\n\nThis page explains the differences between these database types and how to select\none for your service.\n\nDifferences between MySQL and Spanner\n-------------------------------------\n\n### MySQL\n\nThe Dataproc Metastore MySQL database type is an implementation of [Cloud SQL](/sql).\nNote the following when using a MySQL database:\n\n- MySQL is the default database type when creating a Dataproc Metastore.\n- MySQL is supported by all Hive versions.\n- MySQL supports all Dataproc Metastore features.\n- MySQL supports Dataproc Metastore encryption, such as using customer-managed encryption keys (CMEK).\n\n### Spanner\n\nThe Dataproc Metastore Spanner database type is an implementation of [Spanner](/spanner).\nNote the following when using a Spanner database:\n\n- Spanner is only supported on Hive versions 2.3.6 and 3.1.2.\n- Spanner only supports Avro imports.\n\n### Additional details\n\nThe following table provides additional details about these differences.\n\nNotes:\n\n- ^\\*^The Cloud SQL and Spanner SLOs don't directly translate to Dataproc Metastore SLOs. Dataproc Metastore Your database type selection does not affect Dataproc Metastore SLOs.\n- There's no pricing difference between the two database types.\n\nBefore you begin\n----------------\n\n- [Enable Dataproc Metastore](/dataproc-metastore/docs/enable-service) in your project.\n- [Understand networking requirements](/dataproc-metastore/docs/access-service) specific to your project.\n\n### Required Roles\n\n\nTo get the permission that\nyou need to create a Dataproc Metastore,\n\nask your administrator to grant you the\nfollowing IAM roles on your project, based on the principle of least privilege:\n\n- [Grant full control of Dataproc Metastore resources](/iam/docs/roles-permissions/metastore#metastore.editor) (`roles/metastore.editor`)\n- [Grant full access to all Dataproc Metastore resources, including IAM policy administration](/iam/docs/roles-permissions/metastore#metastore.admin) (`roles/metastore.admin`)\n\n\nFor more information about granting roles, see [Manage access to projects, folders, and organizations](/iam/docs/granting-changing-revoking-access).\n\n\nThis predefined role contains the\n` metastore.services.create`\npermission,\nwhich is required to\ncreate a Dataproc Metastore.\n\n\nYou might also be able to get\nthis permission\nwith [custom roles](/iam/docs/creating-custom-roles) or\nother [predefined roles](/iam/docs/roles-overview#predefined).\nFor more information about specific Dataproc Metastore roles and permissions, see [Manage Dataproc access with IAM](/dataproc-metastore/docs/iam-and-access-control).\n\n\u003cbr /\u003e\n\nChoose your database type\n-------------------------\n\nYou choose your database type when you first create a\nDataproc Metastore service.\n\nThe following example shows an abbreviated version of the steps that you follow\nto choose a database type. For complete step-by-step instructions, see\n[Create a Dataproc Metastore service](/dataproc-metastore/docs/create-service).\n**Caution:** You can't update your database type after you create a Dataproc Metastore service. Make sure you choose the appropriate database type for your requirements. To change your database type, you must delete and recreate your service. \n\n### Console\n\n1. In the Google Cloud console, open the Dataproc Metastore page:\n\n [Open Dataproc Metastore](https://console.cloud.google.com/dataproc/metastore/services)\n2. In the navigation bar, click **Create**.\n\n The **Create service** page opens.\n3. For **Database type** , select either **MySQL** or **Spanner**.\n\n MySQL is the default database type.\n4. Choose the [remaining configurations](/dataproc-metastore/docs/create-service#create-a-service)\n for your service, as needed.\n\n5. Click **Submit**.\n\n### gcloud CLI\n\n1. Run the following [`gcloud metastore services create`](/sdk/gcloud/reference/metastore/services/create)\n command:\n\n ```\n gcloud metastore services create SERVICE_ID \\\n --location=LOCATION \\\n --database-type=DATABASE_TYPE; default=\"mysql\"\n ```\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eSERVICE_ID\u003c/var\u003e: the name or ID for your Dataproc Metastore service.\n - \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: the region that your Dataproc Metastore service resides in.\n - \u003cvar translate=\"no\"\u003eDATABASE_TYPE\u003c/var\u003e: the database type that you want to set for your Dataproc Metastore service. Accepted values include `mysql` and `spanner`. The default value is `mysql`.\n\nWhat's next\n-----------\n\n- [Create a service](/dataproc-metastore/docs/create-service)\n- [Update and delete a service](/dataproc-metastore/docs/manage-service)\n- [Data storage for internal tables](/dataproc-metastore/docs/data-storage-internal-tables)"]]