データ・カタログ・メタストア
Apache Hiveは、分散システムに存在する大規模なデータセットに対する読取り、書込みまたは管理操作を容易にするデータ・ウェアハウス・フレームワークです。
データ・カタログ・メタストアは、Hiveクラスタのメタデータの高可用性およびスケーラブルな中央リポジトリを提供します。データベース、表、パーティションなどのデータ構造のメタデータを、オブジェクト・ストレージで管理されるファイルに連動するリレーショナル・データベースに格納します。Apache Spark SQLは、この目的でデータ・カタログ・メタストアを利用します。
OCIデータ・フロー、OCIビッグ・データ・サービス、OCIデータ・サイエンス・サービス・インスタンスは、データ・カタログ・メタストアにアクセスして、オブジェクト・ストレージなどの非構造化データ・アセットおよび半構造化データ・アセット内のオブジェクトのスキーマ定義を安全に格納および取得します。
前提条件
- 管理対象表: メタストアは表オブジェクトを管理します。
- 外部表: ユーザーとして、表オブジェクトを管理します。
データ・カタログでメタストアを作成するときに、管理対象表および外部表が存在するバケットのURIを指定します。URIの形式はoci://<bucket_name>@<namespace_name>/<folder name of your choice>
である必要があります。
管理対象表と外部表に同じ場所を使用しないことをお薦めします。両方のタイプの表が同じディレクトリにある場合、管理対象表からデータを削除すると、外部表からもデータが失われる可能性があります。
詳細は、HDFSコネクタに関する項を参照してください。
必要なIAMポリシー
メタストア・リソース・プリンシパルがストレージの場所にアクセスできるようにするには、ポリシーを追加する必要があります。
<dg-metastore-ocid>
で表されます:ALLOW dynamic-group <dg-metastore-ocid> to read buckets in tenancy where any {all {target.bucket.name='<managed-table-location-bucket>', request.region='<managed-table-location-bucket-region>'}, all {target.bucket.name='<external-table-location-bucket>', request.region='<external-table-location-bucket-region>'}}
ALLOW dynamic-group <dg-metastore-ocid> to manage objects in tenancy where all {target.bucket.name='<managed-table-location-bucket>', request.region='<managed-table-location-bucket-region>'}
ALLOW dynamic-group <dg-metastore-ocid> to read objects in tenancy where all {target.bucket.name='<external-table-location-bucket>', request.region='<external-table-location-bucket-region>'}
spark.confパラメータ設定oci.dcat.metastore.create.bucket.per.db = trueを使用して、メタストアがデータベースごとにバケットを動的に作成できるようにするには、次のポリシーを追加します:
ALLOW dynamic-group <dg-metastore-ocid> to manage buckets in tenancy where any {all {target.bucket.name='<managed-table-location-bucket>', request.region='<managed-table-location-bucket-region>'})
ALLOW dynamic-group <dg-metastore-ocid> to read buckets in tenancy where any {all {target.bucket.name='<external-table-location-bucket>', request.region='<external-table-location-bucket-region>'}}
Admin
およびAdministrators
グループのユーザーのみが、すべてのデータ・カタログ・メタストア・リソースにアクセスできます。Admin
として、次のポリシーを使用して、すべてのメタストア・リソースへのアクセスを提供できます。
allow <any-user> to manage data-catalog-metastore-assets in compartment <compartment-name>
allow group <any-group> to manage data-catalog-metastore-assets in compartment <compartment-name>
カタログ、データベースまたは表レベルのリソースに粗いポリシーが定義されていないかぎり、これらのポリシーは必須です。詳細は、粗いアクセス制御に必要なIAMポリシーを参照してください。
データ・カタログ・メタストア内の大まかなアクセス制御
データ・カタログ・メタストアは、Identity and Access Managementサービスを使用して、別のユーザーが作成したリソースへの偶発的なアクセスおよび変更を回避するための、大まかなアクセス制御を提供します。管理者は、メタストア詳細ページの「リソース・リスト」に記載されている事前定義済ポリシーを使用して、カタログ、データベース、表などのリソースへのアクセス権を付与できます。メタストア・リソースの表示の詳細は、「メタストア・リソース・リストの表示」を参照してください。
デフォルトでは、粗いアクセス制御は無効になっているため、すべてのメタストア・リソースにアクセスするために必要なポリシーを定義する必要があります。必要なIAMポリシーを参照してください。これらのポリシーを定義した後、
Spark.Conf
パラメータをtrue
(oci.dcat.metastore.enable.cgac = true
)に設定します。 粗いアクセス制御に必要なIAMポリシー
次のポリシーを使用して、カタログ、データベースまたは表レベルのリソースへのアクセスを提供します。
- データベースまたは表レベルでポリシーを適用するには、
<hive-default>
を管理する権限が必要です。 - ポリシーがデータベース・レベルまたは表レベルで適用されると、グループ内のユーザーは、別のユーザーが作成したデータベースおよび表を表示またはリストできません。
カタログ・レベルのリソースへのアクセスを許可します。
target.metastore.catalog.name
の使用allow group <any-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.catalog.name = '<metastore-catalog-name>'}
target.metastore.catalog.key
の使用allow group <any-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.catalog.key = '<metastore-catalog-key>'}
ノート
名前、キーおよびサンプル・ポリシー・ステートメントは、「リソース」セクションのメタストア・ページで使用できます。新しいカタログのポリシーを作成する場合は、そのカタログの一部として作成されたデフォルト・データベースのポリシーも作成する必要があります。allow group <any-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.catalog.name = '<metastore-catalog-name>'}
allow group <any-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.database.name = <metastore-catalog-name.default>}
<specific-group>
が特定のカタログのデータベースまたは表レベルのリソースにアクセスできるようにします。ユーザーは、そのカタログの子リソースにアクセスできます。
target.metastore.catalog.name
の使用allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.database.name = '<metastore-catalog-name.default>'}
allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.catalog.name = '<metastore-catalog-name>'}
allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.database.name = '*'}
allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.table.name = '*'}
target.metastore.catalog.key
の使用allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.catalog.key = '<catalog-ID>'}
allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.database.name = <metastore-catalog-name.default>}
allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.database.key = '*'}
allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.table.key = '*'}
次のいずれかのポリシーを適用して、<specific-group>
が特定のカタログのデータベース・レベルのリソースにアクセスできるようにします:
target.metastore.database.name
の使用allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.catalog.name = '<metastore-catalog-name>'}
allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.database.name = '<catalog-name>.<database-name>'}
target.metastore.database.key
の使用allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.database.key = '<metastore-database-ID>'}
次のいずれかのポリシーを適用して、<specific-group>
が特定のデータベースの表レベルのリソースにアクセスできるようにします:
target.metastore.table.name
の使用allow group <any-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.catalog.name = '<metastore-catalog-name>'}
allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.database.name = '<catalog-name>.<database-name>'}
allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.table.name = '<catalog-name>.<database-name>.<table-name>'}
target.metastore.table.key
の使用allow group <specific-group> to manage data-catalog-metastore-assets in compartment <compartment-name> where all {target.metastore.id = '<metastore-id>', target.metastore.table.key = '<metastore-table-ID>'}