Create a Unity Catalog metastore
This article shows how to create a metastore in Unity Catalog and link it to workspaces. A metastore is the top-level container of objects in Unity Catalog. It stores metadata about data assets (tables and views) and the permissions that govern access to them. You must create one metastore for each region in which your organization operates.
Note
In addition to the approaches described in this article, you can also create a metastore by using the Databricks Terraform provider, specifically the databricks_metastore resource. To enable Unity Catalog to access the metastore, use databricks_metastore_data_access. To link workspaces to a metastore, use databricks_metastore_assignment.
Requirements
To create a metastore:
You must be a Databricks account admin.
Your Databricks account must be on the Premium plan.
In Google Cloud, you must have the ability to create GCS buckets and assign permissions to the GCS buckets you create.
Create the metastore
To create a metastore:
Configure a GCS bucket in Google Cloud.
The storage bucket is where data for managed tables will be stored for this metastore. All managed tables will be stored in this bucket unless you override the storage location at the catalog or schema levels.
When you create the bucket:
Create it in the same region as the workspaces you will to use to access the data.
Use a dedicated GCS bucket for each metastore that you create.
Do not allow direct user access to the bucket.
Make a note of the bucket path (
gs://bucket-name
).Log in to the Databricks account console.
Click
Data.
Click Create Metastore.
Enter the following:
A name for the metastore.
The region where you want to deploy the metastore.
This must be in the same region as the workspaces you want to use to access the data. Make sure that this matches the region of the GCS bucket you created earlier.
The path to the GCS bucket that you created in the previous task.
Click Create.
The Provide Storage Access dialog appears. It displays the system-generated Service Account Name and asks you to grant that service account two IAM roles for the GCS bucket. Keep this dialog open when you proceed to the next task.
Give the service account access to your GCS bucket and assign workspaces
To give the system-generated service account access to your bucket and assign your first workspaces to the metastore:
In another browser tab or window, go to the Google Cloud console and open the GCS bucket that you provided in the previous step.
On the Permission tab, click + Grant access and assign the service account the following roles:
Storage Legacy Bucket Reader
Storage Object Admin
Use the service account’s email address as the principal identifier.
Return to the Provide Storage Access dialog in the Databricks account console and click Permissions granted.
Databricks validates that the service account has the correct access to the bucket.
When the validation is successful, you can select workspaces to assign to the metastore.
To learn how to assign workspaces to metastores, see Enable a workspace for Unity Catalog.
(Recommended) Transfer the metastore admin role to a group.
The user who creates a metastore is its owner, also called the metastore admin. The metastore admin can create top-level objects in the metastore such as catalogs and can manage access to tables and other objects. Databricks recommends that you reassign the metastore admin role to a group. See Assign a metastore admin.
Delete a metastore
If you are closing your Databricks account or have another reason to delete access to data managed by your Unity Catalog metastore, you can delete the metastore.
Warning
All objects managed by the metastore will become inaccessible using Databricks workspaces. This action cannot be undone.
Managed table data and metadata will be auto-deleted after 30 days. External table data in your cloud storage is not affected by metastore deletion.
To delete a metastore:
As a metastore admin, log in to the account console.
Click
Data.
Click the metastore name.
On the Configuration tab, click the three-button menu at the far upper right and select Delete.
On the confirmation dialog, enter the name of the metastore and click Delete.